1

I'm on Yosemite 10.10.4, Mac Mini. I have a small Bash shell script to start Quake3 Arena in Wine. It works fine.

#¡/bin/bash
cd Desktop/Quake3ISO
hdiutil mount "Quake 3 Arena.iso"
cd Quake3
wine quake3.exe

Line 2: cd to the folder on my desktop that contains the iso, and also extracted files from the iso. I know it's a mess, but its the only way I can get it to work.

Line 3: mount the iso

Line 4: cd to a folder within the first one, called Quake3

Line 5: run "wine quake3.exe" which lives in that directory. (Desktop/Quake3ISO/Quake3)

So, trying ./quake3.sh mounts the iso, and runs the program happily.

But... I am trying to do the same in AppleScript, but it's failing to find the configuration file for quake3. It loads the image, and changes directories, runs wine and begins quake, but it now can't find the configuration directory, and possibly a few other files. The configuration directory is also below that (Desktop/Quake3ISO/Quake3/baseq3) folder

Q3 1.11 win-x86 Nov 24 1999
----- FS_Startup -----
Current search path:
Z:\Users\robert/baseq3

----------------------

Running in restricted demo mode.

----- FS_Startup -----
Current search path:
Z:\Users\robert/demoq3

----------------------
----- CL_Shutdown -----
-----------------------
Couldn't load default.cfg

I forgot to add. My Applescript

tell application "Terminal"
    activate
    do script "cd ~/Desktop/Quake3ISO"
    do script "hdiutil mount ~/Desktop/Quake3ISO/Quake\\ 3\\ Arena.iso"
    delay 5
    do script "cd ~/Desktop/Quake3ISO/quake3"
    do script "wine ~/Desktop/Quake3ISO/quake3/quake3.exe"
end tell

After some more experimentation I discover the following. As usual with QuakeIII, the CD has to be in the drive. So mounting it seems to fix that. Next, I had done an install in the ~/Desktop/Quake3ISO directory, but a few years back had also done a wine install - which would not run. But just now I copied all the files in the ~/Desktop/Quake3ISO/Quake3/baseq3 folder to the wine install folder in ~/.wine/drive_c/Program\ Files/Quake\ III\ Arena/baseq3 folder, and now I can run Quake directly from that wine folder.

   ie
    cd "/Users/robert/.wine/drive_c/Program Files/Quake III Arena"
    wine quake3.exe

and it runs fine.

I can also so the same in the ~/Desktop/Quake3ISO/Quake3 folder

ie
cd ~/Desktop/Quake3ISO/Quake3
wine quake3.exe

... and it runs fine.

So this tells me that I need to have AppleScript understand that the command to be executed should be executed in the directory it's changed to. So that when the program is looking for it's config files, it uses that directory as the base, or root directory and not the wine base directory? I think?

  • Can you add the AppleScript source code to your question? – nohillside Jul 21 '15 at 10:03
  • sorry, just did that. I forgot. – Harry McGovern Jul 21 '15 at 10:09
  • You should be using do shell script not do script. Have a look at: do shell script in AppleScript – user3439894 Jul 21 '15 at 11:16
  • Still doesn't work. Slightly different error; Can't find Z:/baseq3 now. I need to set the base dir to the dir I cd into. – Harry McGovern Jul 21 '15 at 11:30
1

Every do shell script command starts a new shell, so the cd doesn't have any impact on the following command. So you would be better of with running

tell application "Terminal"
    activate
    do shell script "cd ~/Desktop/Quake3ISO && hdiutil mount ~/Desktop/Quake3ISO/Quake\\ 3\\ Arena.iso"
    delay 5
    do shell script "cd ~/Desktop/Quake3ISO/quake3 && wine ~/Desktop/Quake3ISO/quake3/quake3.exe"
end tell
  • Thank you sir. Most excellent. I knew it had to be something simple. Now I understand what is happening, I won't make that mistake again. Thank you again. Consider this question answered. – Harry McGovern Jul 21 '15 at 12:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .