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

Josias

macrumors 68000
Original poster
Mar 10, 2006
1,908
1
Hey, good to be back :D

I recently pulled out my old Halo cd, and it looks great on my 13" MBP. I don't wanna lug around the CD all the time though, so I copied it as a .dmg to my harddrive.

Every time I start Halo, I have to open Toast, mount the .dmg, close toast and then open Halo. Is there some way for these four actions to be compiled into a single button in for example the dock?
 
If all of the actions are AppleScriptable (will depend on Toast which I don't have) then yes: you could write an AppleScript.
 
I assume they are scriptable, but I never used AS before. Any tips? :p
 
I assume they are scriptable, but I never used AS before. Any tips? :p

Use Google! Seriously for what you want it's going to be something simple like (although this won't actually work as I don't know what Toast's scripting dictionary looks like):

Code:
tell application "Toast"
mount <path to dmg>
end tell
tell application "Halo"
activate
end tell

Basically it's the line with mount you need to research and make work.
 
So far I have:

launch application "Toast Titanium"
tell application "Toast Titanium"
open alias / Users / Josias / documents / Halo / Halo
end tell

Applescript keeps telling me that "Users" is an undefined variable
 
You'll need to do something to convert those bare words into a path: perhaps enclosing the path in quotes might work...
 
launch application "Toast Titanium"
tell application "Toast Titanium"
open alias "/ Users / Josias / documents / Halo / Halo.dmg"
end tell

is accepted by Applescript, but: "Toast Titanium reported an error: a file couldn't be found" :confused:
 
Code:
do shell script "hdiutil attach /Users/Josias/documents/Halo/Halo.dmg"
activate application "Halo"

Done :D I do like AppleScript.

Also, 'tell'ing an app to do something always activates it.
 
Code:
do shell script "hdiutil attach /Users/Josias/documents/Halo/Halo.dmg"
activate application "Halo"

Done :D

Also, 'tell'ing an app to do something always activates it.

I don't understand.
 
I'll do you one better. I've never used it personally, but you should just be able to run a shell script like:

open -a /Applications/ToastMount.app /path/to/Halo.dmg
sleep 10
open /Applications/Halo.app


Or if you want to wrap it in AppleScript I guess you could just wrap it up in

do shell script "open -a /Applications/ToastMount.app /path/to/Halo.dmg"
do shell script "sleep 10"
do shell script "open /Applications/Halo.app"
 
I'll do you one better. I've never used it personally, but you should just be able to run a shell script like:

open -a /Applications/ToastMount.app /path/to/Halo.dmg
sleep 10
open /Applications/Halo.app


Or if you want to wrap it in AppleScript I guess you could just wrap it up in

do shell script "open -a /Applications/ToastMount.app /path/to/Halo.dmg"
do shell script "sleep 10"
do shell script "open /Applications/Halo.app"

My way doesn't need anything additional. You also don't need the "sleep 10" portion because the "do shell script" always waits until the shell action exits before moving on.
 
I'll do you one better. I've never used it personally, but you should just be able to run a shell script like:

open -a /Applications/ToastMount.app /path/to/Halo.dmg
sleep 10
open /Applications/Halo.app


Or if you want to wrap it in AppleScript I guess you could just wrap it up in

do shell script "open -a /Applications/ToastMount.app /path/to/Halo.dmg"
do shell script "sleep 10"
do shell script "open /Applications/Halo.app"

Win! Thanks :D
 
Thanks for your help everyone (and you're probably right robbieduncan) :)

However, now is the time when my noobness is revealed: Can I run an Applescript from the Dock, without launching Applescript? Since this was actually intended as a 1-click start for Halo

Edit: Here is what I'm using now:

do shell script "open -a /Applications/ToastMount.app /Users/Josias/Documents/Halo/Halo.dmg"
do shell script "sleep 10"
do shell script "open /Applications/Halo.app"
 
Win! Thanks :D

Alright...why didn't I win?

However, now is the time when my noobness is revealed: Can I run an Applescript from the Dock, without launching Applescript? Since this was actually intended as a 1-click start for Halo

Copy and paste that into Script Editor (with the correct path). Then in the editor go to "Save As..." then in the 'File Format' drop down, select 'Application'.

Drag the resulting application into your dock.
 
My way doesn't need anything additional. You also don't need the "sleep 10" portion because the "do shell script" always waits until the shell action exits before moving on.

That's true, but it depends how ToastMount works. I figured adding an extra 10 seconds wouldn't hurt, although I'm sure that could be reduced to 2 or 3 seconds.
 
That's true, but it depends how ToastMount works. I figured adding an extra 10 seconds wouldn't hurt, although I'm sure that could be reduced to 2 or 3 seconds.

Yep, I got "sleep 2" in place now, and works just fine.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.