AppleScript help please - what's wrong with this?
- From: Ian McCall <ian@xxxxxxxxxx>
- Date: Sat, 28 Apr 2007 23:37:45 +0100
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
.
- Follow-Ups:
- Re: AppleScript help please - what's wrong with this?
- From: Andrew Brydon
- Re: AppleScript help please - what's wrong with this?
- Prev by Date: Re: Stupid networking question!!
- Next by Date: Re: Mac RPG
- Previous by thread: Sleep command tip in Applescript
- Next by thread: Re: AppleScript help please - what's wrong with this?
- Index(es):
Relevant Pages
|