Re: Need to script tracking in multiple Quark files-correction
Re: Need to script tracking in multiple Quark files-correction
- Subject: Re: Need to script tracking in multiple Quark files-correction
- From: Arthur Knapp <email@hidden>
- Date: Thu, 23 Oct 2003 11:08:27 -0400
Subject: Need to script tracking in multiple Quark files-correction
Date: Wed, 22 Oct 2003 20:16:03 -0400
From: "Rips Ethan J" <email@hidden>
... of about 500 documents, then change the filenames from uppercase
to lowercase.
Length warning:
LowercaseFilenamesInFolder(choose folder)
on LowercaseFilenamesInFolder(f)
set f to f as string as alias --> normalize
set t to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":" --> not in filenames
tell application "Finder" to set sNames to name of every file of f as
string
(*
* --> "hello.html:world.html:etc.html"
*)
set sNames to ToLower(sNames)
repeat with i from 1 to (count text items in sNames)
set sOne to sNames's text item i
(*
* There shouldn't be any problems with renaming a file the
* same thing with just a different case.
*)
tell application "Finder" to set name of file sOne of f to sOne
end repeat
set AppleScript's text item delimiters to t
end LowercaseFilenamesInFolder
property ksUpper : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
property ksLower : "abcdefghijklmnopqrstuvwxyz"
on ToLower(s)
set t to AppleScript's text item delimiters
considering case
repeat with i from 1 to 26
if (s contains ksUpper's character i) then
set AppleScript's text item delimiters to ksUpper's character i
set s to TextItemSubs(s)
set AppleScript's text item delimiters to ksLower's character i
set s to s as string
end if
end repeat
end considering
set AppleScript's text item delimiters to t
return s
end ToLower
property giStringItemsLimit : 4000
on TextItemSubs(s)
set z to count text items in s
set lim to my giStringItemsLimit
repeat
try
if (z < lim + 1) then
return s's text items
else
script o
property p : {}
end script
set e to z mod lim
repeat with x from 1 to (z - e) by lim
set o's p's end to s's text items x thru (x + lim - 1)
end repeat
if (e = 0) then
return o's p
else
return o's p & s's text items -e thru -1
end if
end if
on error number -2706
set lim to lim * 0.9 div 1
end try
end repeat
end TextItemSubs
DISCLAIMER:
The information contained in this e-mail may be confidential
So it's just between you, me, and the hundreds of people on this
list.... ;-)
{ Arthur J. Knapp;
<
mailto:email@hidden>;
What...? Oh...!
}
_______________________________________________
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.