Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
JavaScript for Automation
Search
Ryoichi Izumita
November 16, 2014
Programming
300
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
Transcript
13 slides
@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
More Decks by Ryoichi Izumita
See All by Ryoichi Izumita
モバイル開発における共通性・可変性分析入門
rizumita
0
120
Flutterアプリを生成AIで生成する勘所
rizumita
0
1.6k
FlutterアプリのテストでBuilderパターンを活用しよう
rizumita
0
810
SwiftUIの大地を駆け巡るための仕組みを作る
rizumita
0
300
VIPERアーキテクチャ
rizumita
1
870
FRPを使いはじめて3年が過ぎました。
rizumita
4
1.5k
とあるプログラマのリモートワーク
rizumita
0
410
Other Decks in Programming
See All in Programming
Ruby から Emacs を操作したい
phigasui
0
380
SODA - FACT BOOK(EN)
sodainc
1
280
マルチプロダクトSaaSの アプリ一覧を速くする——複数プロダクトにまたがる「権限行脚」を減らすまで #techramen26conf
mktakuya
1
130
SODA - FACT BOOK(JP)
sodainc
1
40k
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
140
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
690
AppFunctionsの内部実装を紐解く
hiroaki404
0
110
AI Augmentation Techniques with Liberty
ivargrimstad
1
550
[DroidKnights 2026] Workflow AX: From Auto-Documented Policies to E2E Testing
raeminkang
0
610
読みやすい!と評判(?)の発表の準備にかける私のこだわり
shoheimitani
0
140
例外からRich Errorsまで Kotlinエラーハンドリングの進化を読み解く
shiita0903
0
240
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
330
Featured
See All Featured
Exploring anti-patterns in Rails
aemeredith
4
580
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
390
Code Reviewing Like a Champion
maltzj
529
40k
Navigating Weather and Climate Data
rabernat
0
600
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
430
KATA
mclloyd
PRO
35
16k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
360
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Balancing Empowerment & Direction
lara
6
1.4k
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
830
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.9k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
400