View unanswered posts | View active topics It is currently Sat May 18, 2013 10:21 pm



Reply to topic  [ 3 posts ] 
 C program to issue Applescript commands 
Author Message
User avatar

Joined: Jun 14, 2006
Posts: 500
Post C program to issue Applescript commands
Can a C program issue Applescript commands? For example if you write a small C program to read a device, can you have the C program issue an Applescript to write data to an Indigo variable? If so is it possible to give some sort of example?

thanks


Tue Dec 20, 2011 3:00 pm
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6642
Location: Austin, Texas
Post Re: C program to issue Applescript commands
From straight C? Not directly (I don't think - I think you'd need to use the old Carbon APIs for executing scripts or something). You could probably cook up some way to fork a process to run an osascript command and pass arguments in to the AppleScript. I don't have any example around for that but you should be able to find examples of starting another process from C and passing command-line parameters to the run handler in AppleScript.

It would probably be much easier just using Python. In fact, if the device is a serial device, Jim Yergey's Simple Serial plugin might do most of what you need. If it's doing network communication, then Perry's Cynical Network plugin might work.

_________________
Jay (Indigo Support)
Image


Tue Dec 20, 2011 3:23 pm
Profile WWW
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11682
Location: Texas
Post Re: C program to issue Applescript commands
As Jay mentioned you can link to Carbon then construct AppleEvents (which are the messages AppleScript uses internally) and send those, but it non-trivial.

Jay is correct -- using Python would be far easier if at all possible.

_________________
Image


Tue Dec 20, 2011 5:52 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.