-- $Id: configure.applescript.in 58974 2009-10-08 00:28:43Z ryandesign@macports.org $ global configuration_delay on run argv set save_delims to text item delimiters of AppleScript set text item delimiters of AppleScript to " " set configure_args to argv as string set text item delimiters of AppleScript to ";" set number_of_variations to count of every text item of configure_args set text item delimiters of AppleScript to save_delims -- Base the delay for the configuration run on the processor speed. -- The multiplier was chosen based on observations of a 2.2-GHz -- MacBook Pro and a 466-MHz Power Mac G4. set cpu_mhz to (system attribute "pclk") / 1000000 set configuration_delay to 1400 * number_of_variations / cpu_mhz delay 4 -- wait 1 second for each disk image Mini vMac needs to mount my key_code(22) -- "6" -- select the 6-ClipIn program set the clipboard to configure_args -- copy the configure args to the clipboard my menu_file_open() -- open ClipIn, transferring the clipboard into the emulated machine; ClipIn auto-quits my menu_file_close() -- close Finder window my key_code(11) -- "B" -- select the Build program my menu_file_open() -- open it my menu_edit_paste() -- paste the clipboard contents into the window my menu_file_go() -- do the build my menu_file_quit() -- quit my menu_file_close() -- close Finder window my key_code(32) -- "U" -- select the untitled output disk my menu_file_put_away() -- eject the output disk activate application "@BOOTSTRAP_APP@" tell application "System Events" tell process "Mini vMac" key down control -- open Mini vMac control menu my key_code(12) -- "Q" -- quit my key_code(16) -- "Y" -- yes, really quit key up control -- close Mini vMac control menu end tell end tell return "Variations: " & number_of_variations & ". CPU speed: " & (round cpu_mhz rounding up) & " MHz. Configuration delay: " & ((round configuration_delay * 100 rounding up) / 100) & " seconds." end run on key_code(key_code) my key_code_with_modifiers(key_code, {}) end key_code -- Key codes are used instead of keystrokes because keystrokes would be -- translated through the currently-selected Mac OS X keyboard layout -- but the system software being used on the emulated machine is using -- the US English keyboard layout. on key_code_with_modifiers(key_code, key_modifiers) activate application "@BOOTSTRAP_APP@" tell application "System Events" tell process "Mini vMac" delay 0.3 key code key_code using key_modifiers end tell end tell end key_code_with_modifiers on menu_file_open() my key_code_with_modifiers(31, {command down}) -- "Command-O" delay 0.5 -- wait for zoomrects to draw end menu_file_open on menu_file_close() my key_code_with_modifiers(13, {command down}) -- "Command-W" delay 0.5 -- wait for zoomrects to draw end menu_file_close on menu_file_put_away() my key_code_with_modifiers(16, {command down}) -- "Command-Y" delay 0.5 -- wait for zoomrects to draw end menu_file_put_away on menu_file_go() my key_code_with_modifiers(5, {command down}) -- "Command-G" delay configuration_delay -- wait for configuration to run end menu_file_go on menu_file_quit() my key_code_with_modifiers(12, {command down}) -- "Command-Q" end menu_file_quit on menu_edit_paste() my key_code_with_modifiers(9, {command down}) -- "Command-V" end menu_edit_paste