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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.2k
1B+ /day規模のログを管理する技術
broadleaf
0
130
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
370
OS アップデート対応の取り組み方がもっと共有されてほしい
andpad
0
110
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
100
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
12
4.7k
Claude Team Plan導入・ガイド
tk3fftk
0
170
act2-costs.pdf
sumedhbala
0
110
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
17
8.9k
Claude Opus 4.6以後の受託開発エンジニアの変化(Claude Code開発ノウハウ大公開スペシャルbyクラスメソッド)
iidatakuma
1
580
どこまでゆるくて許されるのか
tk3fftk
0
470
Embedded SREと共に達成した会員管理システムのAWS移行 - SRE NEXT 2026 ランチスポンサーセッション
niftycorp
PRO
1
2.3k
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.6k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
920
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
370
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
600
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
420
Google's AI Overviews - The New Search
badams
0
1.1k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.4k
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