Re: Script Objects
Re: Script Objects
- Subject: Re: Script Objects
- From: "Marc K. Myers" <email@hidden>
- Date: Wed, 16 Oct 2002 16:14:19 -0400
Subject: Script Objects
Date: Wed, 16 Oct 2002 09:58:10 -0400
From: "Steve Suranie" <email@hidden>
To: <email@hidden>
Hi
I'm trying to run this script:
script checkServerStatus
property serverName : ""
to checkThisServer to thisServer
set serverName to thisServer
if not (disk thisServer exists) then
beep
display dialog "The " & thisServer & "needs to be mounted in order
for this script to function."
end if
end checkThisServer
end script
tell checkServerStatus
set thisServer to "StorageServer"
tell checkServerStatus to checkThisServer to thisServer
end tell
but I keep getting the following error message:
<<checkServerStatus>> doesn't understand the disk message
The code in your script object doesn't recognize what a "disk" is
because a disk is a Finder object and you don't have the code in a
Finder tell block.
Any help would be appreciated. I'm trying to check if certain servers
are mounted before I continue with a script. Since on most of the
scripts I write I have to check servers I thought I would just write a
script object and pass along to it which server(s) I am checking. Am I
not understanding the concept of the script object? Is there another
way to do this? Also, how would I call the script object from another
script - do you use the path to the script something like this:
tell desktop folder:AppleScripts:scriptObjects:checkServerStatus
set thisServer to "StorageServer"
tell checkServerStatus to checkThisServer to thisServer
end tell
You have a couple of options. You can use "load script" to bring the
script object into your main script or you can save it as an applet.
If you save it as an applet you need to dispense with the "script...end
script" and put the code into a handler. Then you'd call it like this:
tell application "appName" to set rtrnValue to
checkThisServer("serverName")
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[10/16/02 4:13:36 PM]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.