Solved

Script to mount hundred of DVD iso image on Windows Share at OSX startup

Posted on 2010-09-17
2
549 Views
Last Modified: 2012-05-10
(OSX 10.6.3 / Mac Mini Mid 2010)
(Windows Server 2008 64bit))

Hello,

I want to write script to mount hundred of iso image on windows share at startup.
At the beginning, I use login config through "system preference > accounts > login items",
however this didn't work well.

ISO mount fails because of timeout error. I have around 100 iso images but in most cases
mount fails at 60-70, but sometimes 90 ok.
I have old intel MacMini 10.5.8 and had been had no problem at all.

Now I gave up to resolve mount failure and try to write mount script at startup.

Script requirements are
- Run at startup
- Can adjust startup timing ( by using such as sleep command which windows has)

Thank you so much for your help.
If you have idea other than above scripting, please let me know.
0
Comment
Question by:kimakabane
  • 2
2 Comments
 
LVL 12

Expert Comment

by:nxnw
ID: 33827251
This script works with a mechanism similar to the OS 9 (and earlier) startup items folder.
To use the script,
1. make a new folder named "staggeredlaunchitems" in your preference folder (the one in the library in your home directory)
2. put aliases of the files you want to open/applications you want to launch into the staggeredlaunchitems folder
3. launch applescript editor and paste the attached code snippet into a new applescript
4. customize the delays, if desired, in the two "set" commands at the top of the script
5. save the script as an application, and make it a login item (in accounts under system prefs)
6. any login items that are now being launched by the script should be removed from the login items pane (in accounts under system prefs).

The files in your staggeredlaunchitems folder will launch in accordance with the set delays. They will launch in alphabetical order according to the names of the aliases. Change the names of the aliases to change the launch order.
-- this script emulates to OS 9 (and earlier) startup items folder, with the added ability to stagger and delay launches
-- to use this script, 
--   1. make a new folder in your preference folder (the one in the library in your home directory) called (exactly)
--       staggeredlaunchitems
--   2. put aliases of the files you want to open/applications you want to launch into the staggeredlaunchitems
--   3. customize the delays, if desired, in the two "set" commands at the top of the script
--   4. save this script as an application, and make it a login item in (in accounts under system prefs)

set launchdelay to 5 -- change this as required to customize the number of seconds before the first item launches
set itemdelay to 5 -- change this as required to customize the number of seconds between launches

tell application "Finder"
	activate
	set launchitemsfolder to (path to preferences folder as string) & "staggeredlaunchitems"
	set theItems to list folder launchitemsfolder without invisibles
	delay launchdelay
	repeat with x from 1 to (the number of files of folder launchitemsfolder)
		-- set thefile to (launchitemsfolder & ":" & (file x of folder launchitemsfolder)) as string
		set thefile to (file x of folder launchitemsfolder) as string
		do shell script "open " & quoted form of POSIX path of thefile
		delay 2
	end repeat
end tell
quit

Open in new window

0
 
LVL 12

Accepted Solution

by:
nxnw earned 500 total points
ID: 33827819
Attached snippet has corrections and tweaks to the applescript. Please use this one (primary issue: the itemdelay variable will not work in the original).
-- this script emulates the OS 9 (and earlier) startup items folder, with the added ability to stagger and delay launches
-- to use this script, 
--   1. make a new folder in your preference folder (the one in the library in your home directory) called (exactly)
--       staggeredlaunchitems
--   2. put aliases of the files you want to open/applications you want to launch into the staggeredlaunchitems
--   3. customize the delays, if desired, in the two "set" commands at the top of the script
--   4. save this script as an application, and make it a login item in (in accounts under system prefs)

set launchdelay to 10 -- change this as required to customize the number of seconds before the first item launches
set itemdelay to 5 -- change this as required to customize the number of seconds between launches

tell application "Finder"
	set launchitemsfolder to (path to preferences folder as string) & "staggeredlaunchitems"
	delay launchdelay
	repeat with x from 1 to (the number of files of folder launchitemsfolder)
		set thefile to (file x of folder launchitemsfolder) as string
		do shell script "open " & (quoted form of POSIX path of thefile)
		delay itemdelay
	end repeat
end tell
quit

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The /etc/authorization file in Mac OS X 10.x can be used to control access to the various panes of the System Preferences amongst other things. It’s used by some of us Mac Sys Admin’s to give Standard Users access to System Prefs panes that only adm…
In this article we will discuss some EI Capitan Mail app issues and provide some manual process to resolve them.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now