Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

BigladUK

macrumors member
Original poster
Mar 29, 2004
31
1
Sorry to bother you guys but I'm trying to work out how to do 4 simple tasks that I currently manually do.

If I was doing this under windows I could simply write a batch file with the commands in but I'm unsure of how to go about the same thing on my Mac.

The simple command are

Mount 2 Network shares
Change folders to /applications/Moviejukebox
Run Moviejukebox.sh with some switches.
Unmount the 2 network shares.


I looked at automator but couldn't really get my head round it and I'm no developer.

Should I add the commands I want in to the .sh file ?

I was thinking maybe applescript is the way to go but have no idea of the commands.

Like I said if I was doing this under windows then simple dos commands could be used and I would put these in a batch file.

Any one help me out or point in the right direction ?

Thanks in advance and please be gentle with me

Regards

Si
 

2xMcK

macrumors newbie
Dec 25, 2008
4
0
Spain
That should be easy to do with applescript.

Open Script editor and type something like:

do shell script "command1"
do shell script "command2"
...

Then click execute to try it, and if it works as expected, choose "Save as Application", and there you go.
 

BigladUK

macrumors member
Original poster
Mar 29, 2004
31
1
That should be easy to do with applescript.

Open Script editor and type something like:

do shell script "command1"
do shell script "command2"
...

Then click execute to try it, and if it works as expected, choose "Save as Application", and there you go.

Thanks for the reply but I'm not sure I have enough skills to be able to do what I need from he commands you have shown above.

I've opened up applescript and can see it's a very powerful application and can also see if has lots of Finder script commands so I'm sure I'll be able to work our how to mount and unmount my shares but how do I pass a CD command and then a command line in to the terminal window ?

My scripting skills as basic and I have no Mac scripting skills at all.

Any more help would be appreciated

Thanks

Si
 

Cromulent

macrumors 604
Oct 2, 2006
6,817
1,102
The Land of Hope and Glory
Thanks for the reply but I'm not sure I have enough skills to be able to do what I need from he commands you have shown above.

I've opened up applescript and can see it's a very powerful application and can also see if has lots of Finder script commands so I'm sure I'll be able to work our how to mount and unmount my shares but how do I pass a CD command and then a command line in to the terminal window ?

My scripting skills as basic and I have no Mac scripting skills at all.

Any more help would be appreciated

Thanks

Si

There is nothing stopping you from using Unix shell scripts if you prefer.
 

Ramashalanka

macrumors regular
Dec 26, 2008
125
81
Lanka Ravi Shanka
If you want unix shell code, you could type something like this. You can type it in TextEdit, save it without an extension, and run it (eg by double clicking it in Finder or dragging it from Finder onto your desktop).

First you should get the details of your mount working (the directory name etc) by typing it directly into terminal.

Code:
#!/bin/bash

mkdir /Volumes/tmp1
mkdir /Volumes/tmp2
sudo mount_afp afp://uname:pwd@computername/dir1 /Volumes/tmp1
sudo mount_afp afp://uname:pwd@computername/dir2 /Volumes/tmp2
cd /applications/Moviejukebox
./Moviejukebox.sh -options here
umount /Volumes/tmp1
umount /Volumes/tmp2
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.