Easier way to check for numbered string
Easier way to check for numbered string
- Subject: Easier way to check for numbered string
- From: Chris Tangora <email@hidden>
- Date: Fri, 27 Apr 2007 11:36:36 -0400
Hi all.
I have a script that goes through and pulls specific characters
out of a filename and checks to see if they are all numbers. While
it works now, I was hoping somebody knew of a more efficient way of
doing this. What I would prefer to figure out is a way to do it with
a series of if then else if's, but I haven't figured that part out
yet. Any help is appreciated.
Current working script.
set file_name to "01THISFILE-S-mmdd.pdf"
try
set mac_test to ((characters 1 thru 2 of file_name) as string) as
integer
end try
if class of mac_test is integer then
beep
end if
It works fine, but it has to go through three separate "try's" for
each file. I was hoping to condense it down to a single if / then,
but am having trouble. This is what I have so far, but it doesn't work.
if class of ((characters 1 thru 2 of file_name) as string) is integer
then
beep
end if
the class of the string is a string, not an integer. Is there a
simple way to say in one command, if these characters are numbers
then do this? (in this case, beep).
thanks to all for your help.
chris
###
Chris Tangora
Department 55
The Daytona Beach News-Journal
OPINION DISCLAIMER :
The content of this email was created as a service to the world.
Neither the author's employer nor any of its employees, makes any
warranty, expressed or implied, or assumes any legal liability or
responsibility for the accuracy, completeness, or usefulness of any
information, product, or process disclosed, or represents that its
use would not infringe privately owned rights. Reference herein to
any specific commercial products, process, or service by trade name,
trademark manufacturer, or otherwise, does not necessarily constitute
or imply its endorsement, recommendation, or favoring by the author's
employer or any of it's employees. The opinions of the author
expressed here do not necessarily state or reflect those of the
author's employer or any of it's employees and shall not be used for
advertising or product endorsement purposes.
_______________________________________________
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