Re: Variables
Re: Variables
- Subject: Re: Variables
- From: Daniel Rodrigue <email@hidden>
- Date: Sat, 20 Jan 2001 11:23:02 -0500
On 19 January 2001 09:56, Super Julio asked:
Hereafter a solution I use often to pass data to my script without
"Interface". I did adapt it to Super Julio's question but it can be
use for all kind of situation.
As an other example I used the same concept to "facilitate" the
mounting volume task. This was design for Journalism of a press room
to be sure they were using IP mounting and also because they were
complaining about the "long" process to mount many volume...
And also because there is more than one user per Mac.
So after typing their password ounce all the volume are mounted!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
\/\/\
-- Get params from the Applet name --
tell application "Finder"
set myName to name of (path to me)
try
set p_theParams to my DataLister(myName, "x")
set {theWidth, theHeight} to p_theParams
-- Insert...
my YourOwnRoutine(theWidth, theHeight)
-- in between!
on error
display dialog "Something is wrong with that file name..." buttons
{"OK"} default button 1
end try
end tell
on YourOwnRoutine(theWidth, theHeight)
set theMessage to "The width: " & theWidth & return & "The height: " &
theHeight
display dialog theMessage buttons {"OK"} default button 1
end YourOwnRoutine
on DataLister(theData, LeDelimiter)
set LeCheck to {theData, LeDelimiter}
tell (a reference to AppleScript's text item delimiters)
set {oldTIDs, contents} to {contents, LeDelimiter}
set {x, contents} to {text items of ({theData} as string), oldTIDs}
return x
end tell
end DataLister
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
/\/\/
Second example:
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
\/\/\
tell application "Finder"
set LeUser to name of (path to me)
end tell
set LeServer to "10.0.0.100"
set LesVolumes to {"staff", "images", "production", "scratch", "solo"}
repeat with VolumeNom in LesVolumes
try
mount volume "afp://" & LeUser & ":@" & LeServer & "/" & contents of
VolumeNom
on error
return
end try
end repeat
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
/\/\/
Best regads,
Dan
- - - ----------------------------------------------------- - - -
Daniel Rodrigue / Simple & Logik
Vox: 450-468-5726 Fax: 450-4-685087 Bip: 514-897-8698
1261 rue Bourgeoys, Longueuil (Quebec) Canada J4M 1Z5
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~