Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
JavaScript for Automation
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Ryoichi Izumita
November 16, 2014
Programming
280
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JavaScript for Automation
NSEG 第57回勉強会 発表資料
Ryoichi Izumita
November 16, 2014
More Decks by Ryoichi Izumita
See All by Ryoichi Izumita
モバイル開発における共通性・可変性分析入門
rizumita
0
100
Flutterアプリを生成AIで生成する勘所
rizumita
0
1.5k
FlutterアプリのテストでBuilderパターンを活用しよう
rizumita
0
760
SwiftUIの大地を駆け巡るための仕組みを作る
rizumita
0
280
VIPERアーキテクチャ
rizumita
1
840
FRPを使いはじめて3年が過ぎました。
rizumita
4
1.5k
とあるプログラマのリモートワーク
rizumita
0
390
Other Decks in Programming
See All in Programming
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
540
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
9
5.2k
net-httpのHTTP/2対応について
naruse
0
490
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
6
1.2k
AIだと陥りがちなJakarta EE最新技術への移行時の落とし穴と解決策
tnagao7
0
110
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
560
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
540
OSもどきOS
arkw
0
570
AIで効率化できた業務・日常
ochtum
0
140
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
6.2k
Vite+ Unified Toolchain for the Web
naokihaba
0
310
RTSPクライアントを自作してみた話
simotin13
0
610
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Are puppies a ranking factor?
jonoalderson
1
3.6k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
310
Ruling the World: When Life Gets Gamed
codingconduct
0
250
How to Talk to Developers About Accessibility
jct
2
230
GitHub's CSS Performance
jonrohan
1033
470k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
580
First, design no harm
axbom
PRO
2
1.2k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Agile that works and the tools we love
rasmusluckow
331
21k
Typedesign – Prime Four
hannesfritz
42
3.1k
Transcript
@rizumita JavaScript for Automation Release Notes͔Β
͡Ίʹ ❖ MacͰͷࣗಈԽεΫϦϓτݴޠAppleScript ❖ AppleScript͋·Γར༻͕͍ͬͯͳ͍ ❖ AppleScriptಛघͳߏจ ❖ Yosemite͔ΒJavaScript͕ར༻Մೳʹͳͬͨ ❖
JavaScript for AutomationͱݺΕΔ
جຊ - AppleScript tell application "Safari" set theWindow to first
window set theTab to current tab of theWindow do JavaScript "alert(document.title)" in theTab end tell
جຊ - JavaScript safari = Application('Safari') window = safari.windows[0] tab
= window.currentTab safari.doJavaScript('alert(document.title)', { in: tab })
ApplicationͷΞΫηεํ๏ Application('Safari') // ໊લ Application('com.apple.safari') // όϯυϧID Application(‘/Applications/Safari.app') // ύε
Application(763) // ϓϩηεID Application(‘eppc://127.0.0.1/Safari') // ϦϞʔτϚγʔϯ Application.currentApplication() // ΧϨϯτΞϓϦ
ྻཁૉͷΞΫηε // Index window = app.windows.at(0) window = app.windows[0] //
Name window = app.windows.byName(‘New Window’) window = app.windows[‘New Window’] // ID window = app.windows.byId(256)
ྻͷϑΟϧλϦϯά windows.whose({query})Ͱߦ͏ɻ { name: 'JavaScript for Automation' } { _match:
[ hoge.tabs[0].name, 'Apple' ] }
݅ͷࢦఆ { hoge: { filter: ‘Fuga’ } } _equals /
‘=' _contains / _beginsWith / _endsWith _greaterThan / ‘>' _greaterThanEquals / ‘>=‘ _lessThan / ‘<‘ _lessThanEquals / '<='
and or not { _and: [ { name: 'Apple' },
{ size: { '<': 20 } }, ]} _and _or _not
ΦϒδΣΫτͷ࡞ message = Mail.OutgoingMessage().make() message = Mail.OutgoingMessage({ subject: 'Hello world',
visible: true }) para = TextEdit.Paragraph({}, 'Some text')
Scripting Additions app = Application.currentApplication() app.includeStandardAdditions = true app.say('Hello world')
app.displayDialog('Please enter your email address', { withTitle: 'Email', defaultAnswer: '
[email protected]
' }) // ϝιουʹ͍ͭͯϥΠϒϥϦͷStandardAdditionsΛࢀর
JavaScriptͷؔ var safari = Application('Safari'); link = makeMarkdownLink(safari); safari.includeStandardAdditions =
true safari.setTheClipboardTo(link) function makeMarkdownLink(aSafari) { var title = aSafari.doJavaScript('document.title', { in: safari.windows[0].currentTab() }); var url = aSafari.doJavaScript('document.URL', { in: safari.windows[0].currentTab() }); return '[' + title + '](' + url + ')'; }
ࢀߟURL ❖ JavaScript for Automation Release Notes https://developer.apple.com/library/mac/ releasenotes/InterapplicationCommunication/RN- JavaScriptForAutomation/index.html