Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 14, 2007, 02:51 PM   #1
jdr999
macrumors newbie
 
Join Date: Feb 2007
Location: NJ
Applescript / image mounting help

I'm trying to create a script to open disk images, change the screen resolution, run an application, then eject the images and reset the desktop resolution.

I don't know why but I can't this to work reliably. Anyone have any ideas?

Code:
property myPath : "Macintosh HD:Users:Shared:Disk Images:"
property myApp : myPath & "Reader Rabbit Storybook"
property myTask : "TLClauncher"

property diskname1 : "RRERLS Disk1"
property diskISO1 : myPath & "Reader Rabbit Storybook.iso"

property diskname2 : ""
property diskISO2 : ""

on idle
	tell application "System Events" to set myProcesses to (name of every process)
	if myTask is not in myProcesses then
		tell application "Finder"
			if exists (disk diskname1) then eject diskname1
			if not (diskname2 = "") then
				if exists (disk diskname2) then eject diskname2
			end if
		end tell
		do shell script "cscreen -x 1920 -y 1200 -r 60"
		tell me to quit
	end if
	return 2
end idle

on run
	tell application "Finder"
		
		if not (exists the disk diskname1) then
			do shell script ("hdiutil attach " & quoted form of 
				POSIX path of (diskISO1 as string) & " -mount required -noverify")
			repeat until name of every disk contains diskname1
				delay 1
			end repeat
		end if
		
		if not (diskname2 = "") then
			if not (exists the disk diskname2) then
				do shell script ("hdiutil attach " & quoted form of 
					POSIX path of (diskISO2 as string) & " -mount required -noverify")
				repeat until name of every disk contains diskname2
					delay 1
				end repeat
			end if
		end if
		
	end tell
	
	do shell script "cscreen -x 640 -y 480 -r 60"
	tell application myApp to activate
	idle
end run
jdr999 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Applescript: How do I scan an image to a file? moonman239 Mac Programming 2 May 11, 2014 04:40 PM
AppleScript help for server mounting automation elwyn1979 Mac Programming 2 Apr 18, 2014 04:13 PM
Help with attaching image to messages in AppleScript Pegoto Mac Programming 2 Dec 24, 2013 11:58 AM
Mounting a partition with AppleScript that has a space in the name alec6542 OS X 10.8 Mountain Lion 4 Aug 14, 2013 04:04 PM
Encrypted disk image mounting without password brijazz OS X 10.8 Mountain Lion 0 Mar 24, 2013 09:43 AM

Forum Jump

All times are GMT -5. The time now is 04:26 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC