Is there a way to use defined AppleScript methods in other AppleScripts which reference the original AppleScript with something similar to import (f.e. in PHP)?
I wrote a methode to set Skype status and mood-text:
on setSkypeStatus(status, mood_text) tell application "System Events" set skypeRunning to count (every process whose name is "Skype") if skypeRunning > 0 then --only set status if skype is running tell application "Skype" set myStatus to "SET USERSTATUS " & status set myMood to "SET PROFILE MOOD_TEXT " & mood_text send command myStatus script name "AppleScript" send command myMood script name "AppleScript" return skypeRunning end tell else return skypeRunning end if end tell end setSkypeStatus
now I'm searching for something like import skype_methods.scpt. Is there such a functionality. I can't something related with Google.
AppleScript is a scripting language created by Apple Inc. that facilitates automated control over scriptable Mac applications. First introduced in System 7, it is currently included in all versions of macOS as part of a package of system automation tools.
Don't overdo AppleScript formatting.The slowdown is caused when your script editor is forced to cope with growing numbers of style runs as it displays your script following a compile. The answer is to keep the number of formats you use to a minimum.
What Is AppleScript? AppleScript is a scripting language created by Apple. It allows users to directly control scriptable Macintosh applications, as well as parts of macOS itself.
One way to import another script as a library is to define a property which is initialized by loading the library as a script object. You can then use the tell
command to invoke the library functions.
property pSkypeLibrary : load script POSIX file "/Users/sakra/Desktop/skype_methods.scpt" tell pSkypeLibrary setSkypeStatus("status", "mood") end tell
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With