Hey guys,
Thanks to any one who can answer my questions,
Im making a script for Terminal and Just Need to know how to do the commands and pop-up messages, e.g lets say I want to "cd ~/Desktop/’ and then I want a pop up to say :“Terminal has CD’ed into your desktop”, then click “ok”, then command “mkdir ‘sample’” and then another pop up saying:"Terminal has made a new finder folder.
And Just a few more questions:
1)How would I get a new terminal window open with a new command excuted in it:
2)How would I get a input from user i.e “enter name of new folder” then they type a new name and click ok and then a command lanches like “mkdir name_typed”
3)How would I add a option of cancel and ok to any question like “make new folder?”, thus having ok excute “mkdir” command and cancel not and exit script program
Thanks again to any one who can answer my questions,
Model: MacBook Pro
Browser: Firefox 2.0.0.3
Operating System: Mac OS X (10.4)
Well personally I, generally, don’t see the need for interactive terminal sessions so I’m going to go head and illustrate this without one…
set newFolder to text returned of (display dialog "Please enter the new folder name" default answer "")
try
do shell script "cd ~/Desktop;mkdir " & newFolder
display dialog "Created the folder " & newFolder
on error
display dialog "I'm sorry, but I couldnot make your folder " & newFolder
end try
So pretty simple really, first we ask for the folder name and if they hit cancel (a default dialog button) the script quits. If they enter a name and press OK then the script continues on it’s merry way where is changes directory to the logged in users desktop and makes the folder. It also provides feedback on wheter it was or was not successful.
Hi,
what’s the advantage to use the terminal instead of doing the whole thing in AppleScript
like this:
set theFolder to POSIX path of (choose folder)
set folderName to text returned of (display dialog "Enter folder name" default answer "")
display dialog "Make new folder " & folderName & " at " & theFolder buttons {"Cancel", "Make folder"} default button 2
try
do shell script "mkdir " & quoted form of theFolder & folderName
end try
Hey guys,
Thanks so much, Im building an applescript app to put linux on peoples iPod thats why I need some commands, I think I can do it now,
Thanks again
J
Model: MacBook Pro
Browser: Firefox 2.0.0.3
Operating System: Mac OS X (10.4)