I’m trying to write a script that will open a terminal window and execute a couple of commands, one of which will remain running in the window (this is to avoid the suggestion that I use “do shell script”). However, I am unable to make even the simplest “do script” command work. Here is some sample code:
tell application "Terminal"
set scriptCommand to "cd " & " /"
activate
do script scriptCommand
end tell
I tried the single-liner script and it didn’t work.
My partner came into my office with her G3 firewire PowerBook.
We tried the one-liner script on her machine. It worked.
Back to the G4. It didn’t work.
Quit Terminal and Script Editor.
Restarted Script Editor. Typed in the one-liner. It worked. (What’s weird is that, in my previous struggles, I had restarted the computer and the script still hadn’t worked…)
Went to the G4 PowerBook. Quit Terminal and Script Editor. Typed in the one-liner. It worked.
Same thing on the beige G3.
Entered in the multi-line program. It worked.
I don’t know what to say, and I don’t know why things started working. But they do. Must be your good vibes.
As a single line of code, which worked on my machine (iBook G4), though I guess I can’t judge quite exactly, since I don’t know what it does. Regardless, it did a thing and didn;t give me any errors. I’m also having a similar problem with something like that. I’m having trouble getting this to work, in an Application context:
do shell script "diskutil repairPermissions /" password thePass with administrator privileges
The variable thePass is predetermined, and that’s not the problem. I can do the same thing in an AppleScript file, and it works perfectly. However the same thing in the application gives me an error. This is the error it gives me:
Can you clarify what you mean? Which application? Terminal? If you are sending the command to Terminal from a script, the command is different than when using ‘do shell script’.