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 Dec 8, 2011, 11:14 AM   #1
Dr Kevorkian94
macrumors 68000
 
Dr Kevorkian94's Avatar
 
Join Date: Jun 2009
Location: # 12 Grimmauld Place
Script that will mount an external HD

Ok so I'm moving all of my iTunes library to an external HD (DETAILS: http://forums.macrumors.com/showthre...#post139799730 and i want a script that will connect to my external hd when i open iTunes so the music is there. so can someone help me with this?
__________________
ipod nano X3ipod touch 2 Gen 27 in aluminum ImaciPad 2 3G 16gb, iPad 64gb 32GB iPhone 4 S⃣ 10/5/11 Never Forget
Dr Kevorkian94 is offline   0 Reply With Quote
Old Dec 8, 2011, 11:28 AM   #2
Partron22
macrumors 6502
 
Join Date: Apr 2011
This Applescript should do it for you:
Code:
set volumename to "Betelgeuse" -- change this to the volume name you want

try
	do shell script "diskutil mount " & quoted form of volumename
	
	-- To unmount the volume use:
	-- do shell script "diskutil unmount /Volumes/" & quoted form of volumename
	
	-- To start up iTunes use
	-- tell application "iTunes" to activate
	
on error
	-- something went wrong with the mount, or unmount
	-- you can try to fix it here
end try
see http://hints.macworld.com/article.ph...41024142036862

Last edited by Partron22; Dec 8, 2011 at 11:32 AM. Reason: 'quoted form' for vols w space in name
Partron22 is offline   0 Reply With Quote
Old Dec 8, 2011, 11:57 AM   #3
Dr Kevorkian94
Thread Starter
macrumors 68000
 
Dr Kevorkian94's Avatar
 
Join Date: Jun 2009
Location: # 12 Grimmauld Place
Quote:
Originally Posted by Partron22 View Post
This Applescript should do it for you:
Code:
set volumename to "Betelgeuse" -- change this to the volume name you want

try
	do shell script "diskutil mount " & quoted form of volumename
	
	-- To unmount the volume use:
	-- do shell script "diskutil unmount /Volumes/" & quoted form of volumename
	
	-- To start up iTunes use
	-- tell application "iTunes" to activate
	
on error
	-- something went wrong with the mount, or unmount
	-- you can try to fix it here
end try
see http://hints.macworld.com/article.ph...41024142036862
I sort of understand that but i can't figure out how to get it to work in the applescript editor.
__________________
ipod nano X3ipod touch 2 Gen 27 in aluminum ImaciPad 2 3G 16gb, iPad 64gb 32GB iPhone 4 S⃣ 10/5/11 Never Forget
Dr Kevorkian94 is offline   0 Reply With Quote
Old Dec 8, 2011, 12:37 PM   #4
Partron22
macrumors 6502
 
Join Date: Apr 2011
Copy the text in that "Code" block into an AppleScript Editor window
Change the word "Betelgeuse" to whatever the name of your drive is.
Click the run button.
It should mount the drive.

All those lines that start with --
are comments.

If you remove the -- from the "-- tell application "iTunes" to activate"
The script will start up iTunes after mounting the drive.
Partron22 is offline   0 Reply With Quote
Old Dec 8, 2011, 12:53 PM   #5
Dr Kevorkian94
Thread Starter
macrumors 68000
 
Dr Kevorkian94's Avatar
 
Join Date: Jun 2009
Location: # 12 Grimmauld Place
Quote:
Originally Posted by Partron22 View Post
Copy the text in that "Code" block into an AppleScript Editor window
Change the word "Betelgeuse" to whatever the name of your drive is.
Click the run button.
It should mount the drive.

All those lines that start with --
are comments.

If you remove the -- from the "-- tell application "iTunes" to activate"
The script will start up iTunes after mounting the drive.
This is what i had done, and it give me error: "Unable to find disk for Kevorkian" number 1. The eternal HD is in the finder under the shared section, that might have something to do with it.
__________________
ipod nano X3ipod touch 2 Gen 27 in aluminum ImaciPad 2 3G 16gb, iPad 64gb 32GB iPhone 4 S⃣ 10/5/11 Never Forget

Last edited by Dr Kevorkian94; Dec 8, 2011 at 01:16 PM.
Dr Kevorkian94 is offline   0 Reply With Quote
Old Dec 8, 2011, 02:14 PM   #6
Partron22
macrumors 6502
 
Join Date: Apr 2011
Quote:
Originally Posted by Dr Kevorkian94 View Post
The eternal HD is in the finder under the shared section
Oh, it's a network device!
That's different: You want something like this:
Code:
set mypth to "afp://XXX._afpovertcp._tcp.local/YYY" -- Get this from the Finder's get Info window for the network disk after you mount it manually The information you want is the "Server:" line.
set err to false
tell application "Finder"
	try
		mount volume mypth
	on error
		set err to true
	end try
end tell
if err is equal to false then
	tell application "iTunes"
		activate
	end tell
end if
-- MountNetworkDrives
-- see: http://www.theothertomelliott.com/node/232
-- Or, you can just put these paths as url's in the startup items folder
-- see also: http://hints.macworld.com/article.ph...50215082247458

Last edited by Partron22; Dec 8, 2011 at 02:16 PM. Reason: added refs
Partron22 is offline   0 Reply With Quote
Old Dec 8, 2011, 03:00 PM   #7
Dr Kevorkian94
Thread Starter
macrumors 68000
 
Dr Kevorkian94's Avatar
 
Join Date: Jun 2009
Location: # 12 Grimmauld Place
Quote:
Originally Posted by Partron22 View Post
Oh, it's a network device!
That's different: You want something like this:
Code:
set mypth to "afp://XXX._afpovertcp._tcp.local/YYY" -- Get this from the Finder's get Info window for the network disk after you mount it manually The information you want is the "Server:" line.
set err to false
tell application "Finder"
	try
		mount volume mypth
	on error
		set err to true
	end try
end tell
if err is equal to false then
	tell application "iTunes"
		activate
	end tell
end if
-- MountNetworkDrives
-- see: http://www.theothertomelliott.com/node/232
-- Or, you can just put these paths as url's in the startup items folder
-- see also: http://hints.macworld.com/article.ph...50215082247458
Good, the only problem is that apparently in get info its not showing any info but ill fiddle with it. next i was hoping to run the script in geek tool and have it so when i was to open iTunes the script would know and then it would connect to the HD so my music would be there.
__________________
ipod nano X3ipod touch 2 Gen 27 in aluminum ImaciPad 2 3G 16gb, iPad 64gb 32GB iPhone 4 S⃣ 10/5/11 Never Forget
Dr Kevorkian94 is offline   0 Reply With Quote
Old Dec 8, 2011, 03:33 PM   #8
Partron22
macrumors 6502
 
Join Date: Apr 2011
The 'Connect to server' item in the Finder's 'Go' menu should also give you that information.
Partron22 is offline   0 Reply With Quote
Old Dec 8, 2011, 05:42 PM   #9
Dr Kevorkian94
Thread Starter
macrumors 68000
 
Dr Kevorkian94's Avatar
 
Join Date: Jun 2009
Location: # 12 Grimmauld Place
ok so i just have to set it up correctly so when i open iTunes it will connect to the HD so my music is there

Edit: I don't think this is going to work the way i want so I'm going to start a new thread to see if i can just stay connected.
__________________
ipod nano X3ipod touch 2 Gen 27 in aluminum ImaciPad 2 3G 16gb, iPad 64gb 32GB iPhone 4 S⃣ 10/5/11 Never Forget

Last edited by Dr Kevorkian94; Dec 8, 2011 at 06:03 PM.
Dr Kevorkian94 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

Similar Threads
thread Thread Starter Forum Replies Last Post
what's a good car mount that will fit an iPhone 4? 212rikanmofo iPhone Accessories 25 Oct 22, 2011 01:26 AM
A script or a way to sched nightly mounting of external HD? Learjet035 Mac Basics and Help 3 Mar 1, 2011 01:51 PM
Mount an external HD connected to PC to use as Time Machine Location? Mugambo MacBook Pro 4 Sep 25, 2010 09:14 AM
An automator or script that will clear my Safari/Firefox tbluhp Mac Applications and Mac App Store 3 Jul 4, 2010 06:51 PM
Terminal help: mounting an external HD mishi Mac Pro 4 Jul 8, 2006 03:05 AM


All times are GMT -5. The time now is 09:26 AM.

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

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC