Highlighting the Proper Window

Hello everyone,

This is most likely a ridiculously easy question but I’m in the midst of a script and I can’t figure out how to highlight a dialog window as a default (while another application being driven by the script is running simultaneously). Here, let me show you the script:

mount volume "afp://username:password@ipaddress:548/ share volume"
set thepath to open "Macintosh HD:Applications:Education Applications:Essential Skills SE:Database Backup Utility.app"
delay 1.5
tell application "System Events"
	keystroke "admin"
	key code 48
	key code 49
	delay 1
	key code 48
	key code 49
	delay 1
	key code 49
	quit application "System Events"
	set stringToBeDisplayed to "                     Sit back, tax and relax...
                    this may take awhile!

		   WAIT UNTIL IT SAYS 
    REPAIR COMPLETED SUCCESSFULLY"
	display dialog stringToBeDisplayed buttons {"OK"} default button 1 giving up after 45
	select window
end tell

OK…now everything runs fine but the dialog box (Sit back, tax…ect) is not highlighted even though I wrote “select window”. I know this is a minor detail but i’d like to figure this out nonetheless.

Thanks for any anticipated responses.

Anthony

Model: MacBook
AppleScript: 1.10.7
Browser: Firefox 2.0.0.2
Operating System: Mac OS X (10.4)

A couple comments…

  1. why are you trying to quit system events? system events isn’t an application that you have to launch or quit, it’s one that’s always running on your computer.
  2. in order for a dsiplay dialog window to come to the front, the application that calls the dialog window must be the front application. in your case system events calls the window but your database backup utility is the front application, so the dialog window won’t come to the front.
  3. from reading your “stringToBeDisplayed” it sounds like the “Database Backup Utility” might be too busy to display the dialog box, so you can tell another application to come to the front and display the dialog box… maybe the Finder.
  4. “select window” means nothing. at least I never saw that command before. plus if you call a window you have to call it by name or by number ie. tell window 1 of application “whatever” to activate.
  5. here’s how you might rewrite your script…

mount volume “afp://username:password@ipaddress:548/ share volume”
open “Macintosh HD:Applications:Education Applications:Essential Skills SE:Database Backup Utility.app”
delay 1.5
tell application “System Events” to tell process “Database Backup Utility”
keystroke “admin”
key code 48
key code 49
delay 1
key code 48
key code 49
delay 1
key code 49
end tell
set stringToBeDisplayed to " Sit back, tax and relax…
this may take awhile!

           WAIT UNTIL IT SAYS 
    REPAIR COMPLETED SUCCESSFULLY"

tell application “Finder”
activate
display dialog stringToBeDisplayed buttons {“OK”} default button 1 giving up after 45
end tell
tell application “Database Backup Utility” to activate