Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 8, 2012, 01: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, 11: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, 04: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, 06: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:	6
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

Similar Threads
thread Thread Starter Forum Replies Last Post
I need help with some scripting flash1996 Mac Basics and Help 0 Mar 30, 2014 09:01 PM
need help on bash scripting tonkpils Mac Programming 6 Dec 10, 2013 08:37 AM
Need help: Perl scripting iAintKnowMac Mac Programming 5 Jul 2, 2013 10:28 PM
In need of scripting advice ebobster Mac Programming 1 May 15, 2013 10:26 AM
Keynote scripting activate Mac Programming 2 Nov 1, 2012 02:33 AM

Forum Jump

All times are GMT -5. The time now is 04:17 PM.

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

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