|
|
AppleScript help!
|
|
|
|
Junior Member
Join Date: Nov 2000
Location: Greece
Status:
Offline
|
|
After 10.2 broke compatibility with the "-install" command of dnetc I decided to write a small script and compile it as an application that will run at boot time and launch the thing for me. However after spending a couple of hours browsing through Apple's scripts help pages I still can't figure out how to create a script that will succesfully launch, enter the command and quit the terminal applicaton. Here's what I've done so far:
tell application "Terminal"
activate
with timeout of 2 seconds
do script " /Applications/dnetc/dnetc -quiet "
end timeout
end tell
how can I add a small pause here in order to let the script launch the thing? If I add
quit application "Terminal"
right after the end tell argument above there's not much time given for the script to launch the client in quiet mode and it quits immediately, any ideas?
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Nov 2001
Status:
Offline
|
|
Why not try simply doing:
Code:
do script " /Applications/dnetc/dnetc -quiet"
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Oct 2000
Status:
Offline
|
|
Originally posted by Ibson:
Why not try simply doing:
Code:
do script " /Applications/dnetc/dnetc -quiet"
Ahem.. small correction
do shell script "/Applications/dnetc/dnetc -quiet"
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Nov 2001
Location: Arizona
Status:
Offline
|
|
Originally posted by [osX]RTouris:
how can I add a small pause here in order to let the script launch the thing?
FYI, Applescript has a "delay" command. E.g. "delay 10" = pause for 10 seconds.
(As stated you don't need to launch the Terminal to run a shell script from Applescript.)
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Nov 2000
Location: Greece
Status:
Offline
|
|
Success! Thanx for you help guys, this is the final script for anyone who might want to do something similar:
tell application "Terminal"
activate
do shell script " /Applications/dnetc/dnetc -quiet &"
end tell
quit application "Terminal"
The "&" flag is used to stop output to the console, otherwise you'll end up with the client sending output to the console the whole time, which is not a nice thing to watch
There's just one thing now, I've compiled a small application out of it, but at certain points and especially the first time this runs after a restart it crashes...The second time around it works, are there any problems with AppleScript out there?
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Nov 2000
Location: Greece
Status:
Offline
|
|
hehe, I just realised that:
do shell script " /Applications/dnetc/dnetc -quiet &"
also works I guess i wasn't paying too much attention to you guys before
The crash thing persists though, any ideas?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|