AppleScript C Perl Shell Xcode Other

How to run AppleScript from Perl and why?

Post Reply
coding / perl     Views: 3295Prev .. Next
How to run AppleScript from Perl and why?Posted: Wednesday, June 16, 2010 [20:09:03] - 1
rootPosted by:rootMember Since:
June 16 2010
Posts: 357
Perl is pretty powerful language and it is installed by default on Mac OS X.
It can do small and complicated things with ease.
Just to name a few:
- system administration
- cleaning-up your Mac from temp and not needed files
- keep tabs on who's using your Mac
- spy on thief who stole your Mac http://www.mark-up.com/store/MacBook-Call-Home/
- reboot your Mac and all Macs on the network (local and on the Internet, and not just Macs)
- check if Internet connection is good and if not - do something about it as reboot your modem etc.
- water your flowers (no, seriously)
- talk to other languages on your Mac and take orders from them
- ....
List is too long to print

To run AppleScript from Perl - you simply create a script and save it on your Mac with .scpt or .app file extension and run the following command from Perl:
`osascript your.script.or.app.scpt`;
You could also run some AppleScript code from Perl without saving the script file (but it's not as efficient though):
`osascript -e 'say "Hello Johny!"'`;
and your Mac will say outloud "Hello Johny!"

Weird stuff!

Even weirder - you could open AppleScript Editor with AppleScript line from Perl, throw some code to Editor and run newly compiled AppleScript right from the Editor. Then save Script or discard it.

Why run AppleScript from Perl?

Perl is my preferred programming language for most tasks and I run Perl daemon on most of my Macs (including MacBooks) to trigger programs based on events 24/7.
My Mac monitors firewall, FTP files to and from the servers, checks Bank accounts, transfers earnings from PayPal, watches stocks, checks for new things on Hulu, waters flowers, turns alarms on and off, and much much more.
Daemon in case of an event could start any program on my Macs since it runs as "root" including AppleScript programs and regular programs from Applications folder weather they are scriptable or not.

Yes, I am a Mac addict. I can not imagine how to do manually all things my Mac does for me daily.
It's just not feasible.There's no place like ~
coding / perlPrev .. Next
 
Post Reply
Home - Coding: AppleScript C Perl Shell Xcode Other
Our Telegram Group