On 18-Apr-08, at 6:02 PM, Mark J. Reed wrote:
If it's named "MyTest.exe", then "./MyTest" won't work. OS X is not Windows
How are you running the script? I don't think you can safely assume
anything about the current working directory in AppleScript - you will
have to use "path to me" and friends to build an absolute path to
MyTest.
AppleScript has no access to execv*() directly; you have to go through
the shell. Build a command line by concatenating the full path to
MyTest with the quoted forms of the arguments together into a string
separated by spaces, and then run that command line via "do shell
script".
Example:
set prefix to POSIX path of (path to me as alias)
set arg1 to choose file with prompt "first file"
set arg2 to choose file with prompt "second file"
do shell script "\"$(dirname " & quoted form of prefix & ")\" " &
quoted form of POSIX path of arg1 & " " & quoted form of POSIX path of
arg2
But Xcode has much better ways of accomplishing the goal of "prompt
the user for files and then run this C code on them".
I have directory "Test" which consists of MyScript.scpt (Apple script
file created from script editor) and an executable MyTest.exe
(compiled C program).
MyTest.exe takes two parameters as arguments. (Example to run it "./
MyTest name age")
MyScript.scpt must show a dialog to accept two parameters and when
user presses OK button, it must call my MyTest executable with
necessary data from script.
I think I gave clear description now.
please revert back if not clear.
SVV Satyanarayana
Bangalore, India
On 18-Apr-08, at 1:30 PM, Philip Aker wrote:
On 08-04-17, at 21:57, SVV Satyanarayana wrote:
From Apple script, I am showing a dialog with few textboxes and a
button. On click of the button, I want to call some "C" executable
with arguments as strings in textboxes. How can I do this?
To call command line tools, use the 'do shell script' command.
Details are in the Standard Additions dictionary.
It's not clear from your post whether or not you are in an
AppleScript Studio project and whether or not you are targeting a
tool or a scriptable application.
To target a scriptable application use the form:
tell application "System Events"
activate
set flist to path of every file of desktop folder whose visible is
true
choose from list flist
end tell
Philip Aker
Sent from my SE/30
--
Sent from Gmail for mobile | mobile.google.com