AppleScript help please - what's wrong with this?



I'm writing an AppleScript to run on login for the Mac Mini. Its aims:

1. To wait until an external drive has mounted
2. To run up iPhoto, dismiss any resolution warnings dialog and then hide it
3. To run up iTunes and hide it
4. To run up VersionTracker Pro and hide it
5. To activate Front Row

These aims aren't being met. I'm not noticing resolution dialogs in iPhoto anymore, but it's not hiding. iTunes is successfully starting which means the waiting-for-an-external-disk thing is going fine, but once again it's not hiding. The odd thing is that both -do- hide if I run this script after login.


Via Google and my own playing around I've come up with the script below. I then compile this to an app, and ask the app to run on login (no splashscreen, hide app while running).

Two questions then:
1. Any ideas why the two apps aren't hiding when run at login?
2. If I wanted to detect the Bluetooth Setup was running and ask it to quit if so, how would I do that?


Thanks in advance for any information, script is below.


Cheers,
Ian

----------------------



-- Wait for the external drive
do shell script "sleep 20"

-- Press return to remove any 'wrong resolution'
-- dialogs, then hide the application
tell application "iPhoto"
activate
do shell script "sleep 10"
tell application "System Events" to key code 36
end tell
tell application "System Events"
set visible of process "iPhoto" to false
end tell

-- Start up iTunes and hide it
tell application "iTunes"
activate
end tell
tell application "System Events"
set visible of process "iTunes" to false
end tell

-- Start up Front Row
tell application "System Events"
tell process "Front Row"
key code 53 using {command down}
end tell
end tell

-- Now VersionTracker
tell application "VersionTracker Pro"
activate
end tell
tell application "System Events"
set visible of process "VersionTracker Pro" to false
end tell

.



Relevant Pages

  • Re: Hacker activity?
    ... >login to a server, most as root but some are attempts to login to ... >telnet, all come from the same remote server, and all fail. ... >getting some odd cgi calls to a script on a secure ssl server. ... Make sure root cannot login to your system via ssh. ...
    (freebsd-questions)
  • Abusing poor programming techniques in webserver scripts V 1.0
    ... $login = Request.Form ... fool the database parser. ... verified in the script of access to the database, ... The SQL statement will be parsed by the database manager, ...
    (SecProg)
  • Re: Limit desktop & start menu
    ... Create a login script that runs when users log into the TS, and map the R: ... persisitent "R" drive on the server itself and that may cure it. ...
    (microsoft.public.windows.terminal_services)
  • RE: vb script called from login script exits when login script ter
    ... In Novell our login times (from the time the user types in their ... seconds with a very bare bones login script. ... that was an improvement but still not as good as our NetWare login times. ... VBScipt is terminated after the synchronous part of logon script is ...
    (microsoft.public.scripting.vbscript)