Re: Easier way to check for numbered string
Re: Easier way to check for numbered string
- Subject: Re: Easier way to check for numbered string
- From: Michelle Steiner <email@hidden>
- Date: Fri, 27 Apr 2007 19:02:22 -0700
On Apr 27, 2007, at 10:24 AM, Chris Tangora wrote:
if (class of (((text 1 through 2 of file_name) as string) as
integer) is integer)
Since you're using the "text a through b of c" syntax, you don't need
"as string". More importantly, you'll never get to "is integer"
because as you discovered if the text cannot be cast as an integer,
it errors. Further, if it can be cast as an integer, it will return
true. So that syntax really won't work.
Try this on for size:
set file_nameS to {"05C4567890-xyz.pdf", "01ABCDEF-Z-1234.pdf",
"1NJ0100A1234.pdf", "#PP1NJ0100A1234.pdf"}
repeat with file_name in file_nameS
try
{(text 1 through 2 of file_name) as integer, (text 4 through 7 of
file_name) as integer, (text 8 through 10) of file_name as integer}
on error msg
display dialog msg
end try
end repeat
-- Michelle
--
Approximately 20% of workday absences occur on Tuesdays.
_______________________________________________
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