applescript
#
Resources#
https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/index.htm official document
Line-Continuation Symbol The Line-Continuation Symbol is a symbol that can be used to prevent confusion caused by word-wrapping in AppleScript Editor. Although this code takes up 2 lines, the compiler reads the first line, sees the line-continuation symbol, and then reads the second line as a continuation of the first line. Using the U.S. keyboard, this character can easily be achieved by the key combination Option-l (lowercase L).
codes#
LOOP
1 2 3 4 |
|
1 2 3 4 5 |
|
Tutorial:#
200808 https://segmentfault.com/a/1190000011273388
general#
- delay
--
this is a comment#
this is also a comment
Mac API#
- say "CONTENT_TO_READ"
- tell
- tell application APPNAME
- set VARNAME to VARVALUE
- display dialog STRING
- display dialog STRING buttons {"BUTTON_TEXT_1", "TEXT_2", "TEXT_3"}
- choose folder USELESS_STRING
- keystroke (need
System Events
)
function#
the length of
logic control#
if X is Y then end if
try on error end
repeat with X in Y end repeat
on FUNNAME(PARAM) return PARAM end FUNNAME
data type#
list {,}
#
- item X of LIST X-th item of LIST item -1 of LIST last item of LIST
- items X through Y of LIST
- reverse LIST
- every character of STRING
- equivalent to JS
split
- with parameter "AppleScript's text item delimiters"
- equivalent to JS
- record ~ JS.object
- #question
(xxx)
can comment out codes?
https://sspai.com/post/46912
AppleScript Suite#
- 200809
- Suite = group of class, element and properties.
- Stack Overflow tag [AppleScript] https://stackoverflow.com/questions/tagged/applescript
https://sspai.com/post/43758
Test vscode#
- apple script editor support also UTF-8 and UTF-16LE
- vscode extension
idleberg.applescript
can run AppleScript
NIE page auto fill#
make new window
- navigate to a URL:
open location "https://sede.administracionespublicas.gob.es/icpplus/index.html"
- define a function: both
on
andto
are acceptable keywordThere's no difference between them. Both
on
andto
are acceptable. https://apple.stackexchange.com/a/348046
-
difference in doing JS code :
- Chrome:
applescript execute front window's active tab javascript "alert('example');"
also, need to enable AppleScript * Safari:
applescript tell application "Safari" to do JavaScript "alert('example')" in document 1
- Chrome:
Projects#
NIE auto-fill#
feature requests#
- modularize runJS
- changing INFO like name , NIE etc v0.3 : it works now