finder - List - Question
finder - List - Question
- Subject: finder - List - Question
- From: Oakley Masten <email@hidden>
- Date: Thu, 12 Apr 2007 14:27:38 -0700 (PDT)
From: Michelle Steiner <email@hidden>
Subject: Re: Finder - List - Question
> display dialog "Are these eCodes Correct?" & return
&
> theList
Problem with that line is that all the numbers are
concatenated with
nothing separating them.
Try this instead.
set text item delimiters to ", "
display dialog "Are these eCodes Correct?" & return &
theList
set text item delimiters to ""
Also, I'd suggest that you put in some error checking
to make sure
they enter only numbers
-- Michelle
--this gets multiple input items and puts them into a
list variable
tell application "Finder"
activate
set Validated to "No"
repeat while Validated is "No"
set theList to words of text returned of (display
dialog "eCodes to Add: " & return & "Enter the
numbers separated by <Returns>" default answer return
& return & return)
tell me to set text item delimiters to ", "
repeat with x from 1 to number of items in theList
set theItem to item x in theList
if number of characters in theItem is not 3 then
display dialog "eCode " & x & " < " & theItem
& "> is NOT 3 Characters" buttons {"OK"}
end if
set CheckDigits to ASCII_Digit_Test(theItem) of me
if CheckDigits is false then
display dialog "eCode " & x & " <" & theItem &
"> is NOT a Number" buttons {"OK"}
end if
end repeat
set Validated to button returned of (display dialog
"Are these eCodes Correct?" & return & return &
theList buttons {"No", "Yes"})
tell me to set text item delimiters to ""
end repeat
repeat with x from 1 to number of items in theList
set theItem to item x in theList
display dialog "eCode " & x & " is " & theItem
end repeat
end tell
---------------------------------ASCII Number
Handler-----------------------------------------------------------
on ASCII_Digit_Test(DataToTest)
-- ascii numbers 48 thru 57 are the zero thru nine
integers
--set DataToTest to text returned of (display dialog
"Enter Text to Check" default answer "")
set IsItAnumber to true
repeat with x from 1 to number of characters in
DataToTest
set ASCIINumber to ASCII number of character x of
DataToTest
if not ((ASCIINumber ? 48) and (ASCIINumber ? 57))
then
set IsItAnumber to false
end if
end repeat
--display dialog IsItAnumber
return IsItAnumber
end ASCII_Digit_Test
I have incorperated your suggestions into my script.
What do you think?
Oakley
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden