Re: Testing for a specific value in a folder name
Re: Testing for a specific value in a folder name
- Subject: Re: Testing for a specific value in a folder name
- From: Malcolm Fitzgerald <email@hidden>
- Date: Wed, 5 Jul 2006 15:36:16 +1000
On 05/07/2006, at 1:19 PM, Malcolm Fitzgerald wrote:
on CheckDNum(aFolder)
set Dnum to {}
repeat with chunk in (every word of aFolder)
considering case -- we are looking for capitals
if item 1 of chunk is "D" then
if length of chunk is in {5, 6} then -- is it the right length?
try
(text 2 thru -1 of chunk) * 1 -- is the remainder a number?
set end of Dnum to chunk as Unicode text
end try
end if
end if
end considering
end repeat
return Dnum
end CheckDNum
If you ever need to do this on a large object, putting the faster tests
on the outside will improve the speed. This is arrangement is faster by
a whisker.
on CheckDNum(aFolder)
set Dnum to {}
repeat with chunk in (every word of aFolder)
if length of chunk is in {5, 6} then
considering case
if item 1 of chunk is "D" then
try
(text 2 thru -1 of chunk) * 1
set end of Dnum to chunk as Unicode text
end try
end if
end considering
end if
end repeat
return Dnum
end CheckDNum
Malcolm Fitzgerald
FOR YOUR COMPUTER Customised software built to your specifications.
Using Macs? Automate your workflow with AppleScript. FOR YOU Computer
training, software installation + upgrades, computer setups. IN TIMES
OF NEED Troubleshooting, maintenance + repairs.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden