IvanMathy / Boop

A scriptable scratchpad for developers. In slow yet steady progress.
https://boop.okat.best
MIT License
3.84k stars 356 forks source link

A simple AS Script... :) #290

Open gustaf71 opened 3 years ago

gustaf71 commented 3 years ago

There are people in Automation community who believe JavaScript could be more powerful and vanilla AppleScript. The benefit to use a scriptable application we could do multiple actions with a simple select text + keyboard shortcuts.

If someone need the string from Boop... this AS Script will do it.

on performOpenPickerWithString(theString) tell application "System Events" to tell application process "Boop" set frontmost to true key code 0 using {command down} delay 0.1 key code 11 using {command down} delay 0.1 keystroke theString keystroke return end tell end performOpenPickerWithString

on stringToBoop(theString) tell application "System Events" to tell application process "Boop" -- set frontmost to true tell window 1 to tell scroll area 1 set value of text area 1 to theString end tell end tell end stringToBoop

on stringFromBoop() tell application "System Events" to tell application process "Boop" -- set frontmost to true tell window 1 to tell scroll area 1 set theString to its value of text area 1 end tell end tell return theString as text end stringFromBoop

set theString to quoted form of "hello world!" stringToBoop(theString)

performOpenPickerWithString("add slashes")

set theString to stringFromBoop()

tell application "System Events" activate display dialog theString end tell