Hi-
I’m working on a stay-open script that will ask the user for a number, and then stay open and monitor a folder named with that number on a server . Something like this:
set myNum to text returned of (display dialog "Please enter your Number:" default answer "" with icon note)
set serverFolder to alias ("The Server:" & myNum)
on idle
if serverFolder contains something then do something
return 1
end idle
The problem is I get an error saying “The variable serverFolder is not defined.” If I place the “set…” lines within the idle block, it works, but of course it’s going to keep asking to enter the number every time it cycles around.
I also tried to pass the variable to the idle similar to a subroutine…
on idle(serverFolder)
if serverFolder contains something then do something
return 1
end idle
…but got another error, “<> doesn’t match the parameter {serverFolder} for idle.”
I’d like the script to ask for the number once when it’s initially launched, and then stay open and monitor the server folder like normal.
Thanks 8)