Handler defies logic
Handler defies logic
- Subject: Handler defies logic
- From: Rich Carroll <email@hidden>
- Date: Thu, 25 Sep 2003 08:26:10 -0500
I am experiencing a strange error. If I recursively call this handler a
second time, it holds information from the first iteration. For example, if
you run it and enter an invalid string like ".p" it will catch the "." as
invalid and invoke itself again prompting for a new string. If the second
time through you enter a valid string like "dd" it will iterate through the
second string, step out of the repeat loop, set the final "folderDescript"
variable, AND THEN GO BACK INTO THE REPEAT LOOP! So your result would be
"__ddp" Two underscores and all the valid characters. I'm out of ideas.
What am I missing? Thanks in advance for your help.
property validChars :--no break
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890" --no break
as Unicode text
global folderDescript
global txt
on run
validateFolderDescript()
end run
on validateFolderDescript()
set txt to (text returned of (display dialog "Enter main --no break
folder description.
Maximum of 24 alphanumeric characters." default answer --no break
"myJobFolder")) as string
set folderDescript to ""
set chars to count txt
if chars is greater than 24 then
display dialog "Maximum of 24 characters"
validateFolderDescript() of me
end if
repeat with i in txt
if i is in validChars then
set folderDescript to folderDescript & i
else
display dialog "\"" & i & "\"" & " is a bad character.--no break
You may only use numbers or letters"
validateFolderDescript() of me
end if
end repeat
set folderDescript to "_" & folderDescript
end validateFolderDescript
--
Richard McCormick-Carroll
Application Specialist
Capps Digital Development Group
email@hidden
email@hidden
312.220.1679 @ Desk
312.520.1679 @ Cell
www.cappsdigital.com
_______________________________________________
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.