 |
 |
Applescript question
|
 |
|
 |
|
Junior Member
Join Date: Jan 2003
Location: Dartmouth College, NH
Status:
Offline
|
|
Hi.
One of my applications requires a disk image to be mounted in order to run. How would I write an applescript that automatically mounts the disk image when I start the application and ejects it when I quit?
I'm sorry if this is a very basic question, but I just got a mac and I'm just starting to try applescript.
Thanks,
kstor
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
To mount a disk image Disk Copy is used. getURL is the action within the Disk Copy app.
The applescript for just mounting the image is-
tell application "Disk Copy"
getURL alias "HD:users:username:desktop:xxx.img
end tell
If you can tell us a bit more about the app that needs the image mounted, perhaps I could help.
Craig
(Last edited by suthercd; Mar 14, 2003 at 10:54 PM.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jan 2003
Location: Dartmouth College, NH
Status:
Offline
|
|
Thanks a lot, that should make the mounting part work..
Basically, I'm trying to get a game to work without the cd, and the only way seems to have a disk image of the game mounted. So I want to make a script which will mount the disk, wait till the mounting is done, launch game, and possibly eject the disk once the game quits.
How would I do this?
KStor
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
kstor-
Once the image is mounted, is the app that is launched in the mounted disk, or does an app on your hard rive just need the mounted disk for verification?
If the app to be launched is on the mount disk, then it will not eject until the app quits.
Let me know.
Craig
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jan 2003
Location: Dartmouth College, NH
Status:
Offline
|
|
The app is on the hard drive and only needs the disk image for verification.
KStor
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
Ok. Step at a time. Applescript to launch an application for you to try is:
Tell application "HD:applications:xxx.app" to activate
You will need the accurate path to the applications. Are using using 9 or OS X?
Craig
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jan 2003
Location: Dartmouth College, NH
Status:
Offline
|
|
I'm using os x, but finding the path shouldn't be a problem I think. However, the app starts before the image has the time to mount. Is there any way I can make it wait till the disk is mounted to activate?
Also, is there anyway to unmount the disk automatically afterwards?
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
There is a display event in AS. So display 15 would pause the script for 15 seconds. This is not the best way to do this, but will work. Take a look at the Applescript dictionaries for different applications. From Script Editor there is a Dictionaries menu item.
For the Finder app there is an eject reference event. Eject is clear, reference is intially a little trickier. You would think:
eject "HD:users:kstor:desktop:cdName"
but the code is:
Code:
Tell app "Finder"
eject alias "HD: yadda"
end tell
or:
tell app "Finder" to eject alias "HD:yadda"
Alias returns a reference- which is required by the dictionary.
Craig
(Last edited by suthercd; Mar 17, 2003 at 09:51 PM.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jan 2003
Location: Dartmouth College, NH
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|