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 Nov 8, 2012, 12:06 AM   #1
mac'n'nz
macrumors newbie
 
Join Date: May 2010
Location: Havelock North, New Zealand
Scripting help: application launching

Hey all. I have an external drive with my entire iTunes media folder on it, linked to iTunes . If the external is ejected or turned off , iTunes cannot locate the files .

This has happened a couple of times by accident . It's easy to reload the media ( exit iTunes and re-open it) but the album artwork seems to stuff up . Eg heaps of missing artwork , swapped artwork etc.

I was wondering if its possible to run a script that will display the message "'please make sure external hard drive Is on before opening iTunes" when iTunes is opened .

It could either delay by 10 seconds or so, or even better ask " is the external on" and if the answer is "yes" then iTunes will open .

Forgive my noobness, only ever done windows batch files so my knowledge is very little .

Thanks in advance guys
mac'n'nz is offline   0 Reply With Quote
Old Nov 8, 2012, 10:49 AM   #2
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
Try this :

Code:
-- Change POMP to the name of your external disk
-- iTunes will only launch if the disk exists eg visisble in Finder
tell application "Finder" to set diskExists to exists disk "POMP"
set theResult to button returned of (display dialog "Is the external on" buttons {"Cancel", "Yes"} default button 2)
if theResult is "Yes" and diskExists then
	tell application "iTunes" to launch
else
	display dialog "Disk \"POMP\" is not on."
end if
There are other ways to do this but you can give it a go.
__________________
Space Corps Directive 34124
kryten2 is offline   0 Reply With Quote
Old Nov 10, 2012, 03:58 PM   #3
mac'n'nz
Thread Starter
macrumors newbie
 
Join Date: May 2010
Location: Havelock North, New Zealand
Quote:
Originally Posted by kryten2 View Post
Try this :

Code:
-- Change POMP to the name of your external disk
-- iTunes will only launch if the disk exists eg visisble in Finder
tell application "Finder" to set diskExists to exists disk "POMP"
set theResult to button returned of (display dialog "Is the external on" buttons {"Cancel", "Yes"} default button 2)
if theResult is "Yes" and diskExists then
	tell application "iTunes" to launch
else
	display dialog "Disk \"POMP\" is not on."
end if
There are other ways to do this but you can give it a go.

Sorry - what is POMP ETC?
__________________
iMac i5 '11, rMBP i5 '13, iPhone5
mac'n'nz is offline   0 Reply With Quote
Old Nov 10, 2012, 05:16 PM   #4
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
Quote:
Sorry - what is POMP ETC?
POMP is the name of my USB stick I used as an example. When you plug in your external drive it should be visible with a name under DEVICES in the Finder Sidebar. If not go to Finder-->Preferences and make sure External Disks is checked in the Show these items in the Sidebar section of the Sidebar tab.
So if the name of your external drive is MyBigDiskWithMyEntireiTunesMediaOnIt then replace POMP in the script with MyBigDiskWithMyEntireiTunesMediaOnIt.
Attached Thumbnails
Click image for larger version

Name:	Picture 1.png
Views:	0
Size:	95.7 KB
ID:	376417  
Attached Images
 
__________________
Space Corps Directive 34124
kryten2 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:00 AM.

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

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