Last active
April 3, 2016 13:58
-
-
Save gitbricho/3ae2893ed667fbf6e19e726a3b4f33eb to your computer and use it in GitHub Desktop.
JXA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = Application("Safari"); | |
app.includeStandardAdditions = true; | |
app.activate(); | |
app.displayDialog('Hello'); | |
/*------------------------- | |
app = Application("Safari") | |
app.activate() | |
app.displayDialog("Hello") | |
--> {"buttonReturned":"OK"} | |
結果: | |
{"buttonReturned":"OK"} | |
---------------------------*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = Application("TextEdit"); | |
app.open("/Users/bri_tcho/_wsp/_test/file01.txt"); | |
/*-------------------------------- | |
app = Library(<unknown>) | |
app.aevtodoc("/Users/bri_tcho/_wsp/_test/file01.txt") | |
--> app.elementsForClassCode("docu").byName("file01.txt") | |
結果: | |
Application("テキストエディット").documents.byName("file01.txt") | |
---------------------------------*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = Application('Safari') | |
app.includeStandardAdditions = true | |
app.activate() | |
delay(0.3)// 若干のスパイス | |
var tab = app.windows[0].tabs[0] | |
tab.url = "https://www.google.co.jp" | |
/*---------------------------------- | |
app = Application("Safari") | |
app.activate() | |
app.windows.at(0).tabs.at(0).url = "https://www.google.co.jp" | |
結果: | |
"https://www.google.co.jp" | |
------------------------------------*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = Application.currentApplication(); | |
app.includeStandardAdditions = true | |
app.doShellScript(" echo 1 " ) | |
/*--------------------------------- | |
app = Library(<unknown>) | |
app.sysoexec(" echo 1 ") | |
--> "1" | |
結果: | |
"1" | |
-----------------------------------*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = Application("Reminders") | |
entry = app.Reminder( | |
{ name : "todo01", | |
body: "JavaScript化されたAppleScriptについて書く" | |
} ) | |
app.lists["test"].reminders.push( entry ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment