RE: Differentiating between "A1", "A12", "A13"
RE: Differentiating between "A1", "A12", "A13"
- Subject: RE: Differentiating between "A1", "A12", "A13"
- From: Joe Kelly <email@hidden>
- Date: Wed, 9 Jan 2002 14:09:19 -0800
Each time you find something that begins with "A1", do a more thorough test
on the found name: if there are numeric characters after the 1, then you
haven't found a match.
on TestName(inName, inLookingFor)
if (inName begins with inLookingFor)
repeat with i from ((length of inLookingFor) + 1) to length
of inName
if character i of inName is in {"0", "1", "2", "3",
"4", "5", "6", "7", "8", "9") then
return false
end if
end repeat
return true
end if
return false
end TestName
>
-----Original Message-----
>
From: Wadson, David [mailto:email@hidden]
>
Sent: Wednesday, January 09, 2002 12:51 PM
>
To: 'Applescript'
>
Subject: Differentiating between "A1", "A12", "A13"
>
>
>
A list of files named:
>
>
A1...plus some other characters
>
A10...plus some other characters
>
A11...plus some other characters
>
A12...plus some other characters
>
A2...plus some other characters
>
A3...plus some other characters
>
A4...plus some other characters
>
A5...plus some other characters
>
A6...plus some other characters
>
A7...plus some other characters
>
A8...plus some other characters
>
A9...plus some other characters
>
>
Two problems - there will be other files in the list named
>
started with B1,
>
B2,... C1, C2,...etc. I also won't know how many files will
>
start with "A" -
>
there could be 8, 10, or 12 files.
>
>
I need to process each file in numerical order. By using a simple loop
>
incrementing from 1 to however many files I have, I've been
>
selecting the
>
appropriate files by looking for the the files that "starts
>
with A2", or
>
"starts with A3". But if I'm searching for the page that
>
starts with "A1", I
>
also get pages "A10", "A11" and "A12". I could also use an identifying
>
character after the number to eliminate this problem - i.e.
>
select the files
>
that start with "A1-", "A2-","A11-" and that would select the
>
right file.
>
>
However, I'm trying to really idiot proof this script and make it not
>
necessary to consider have a specific character after the
>
number. That way
>
it won't matter if the user has accidentally named a file incorrectly.
>
>
I've been mucking around trying to figure out how to isolate
>
A1 from the
>
other sequences that start with it but haven't had much luck
>
creating a
>
reliable routine to do it. Perhaps I'm trying to invent a
>
wheel that already
>
exists. Does anyone have any ideas on how to easily
>
accomplish this task?
>
>
In case anyone is wondering, I'm trying to process of bunch
>
of sequential
>
newspaper pages contained in individual PDF files and merge
>
them into a
>
single document, with the pages in proper order. The number
>
of pages and
>
sectiosn will vary depending upon the day. I have the program
>
done but want
>
to make it less stringent on the filenames being 100% correct...
>
>
Thanks in advance..
>
_______________________________________________
>
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.