Why can't it get [file] from list of files??
Why can't it get [file] from list of files??
- Subject: Why can't it get [file] from list of files??
- From: Jerry Krinock <email@hidden>
- Date: Tue, 07 May 2002 18:29:38 -0700
Hi,
I need to share my many C++ source code with a co-worker who uses MS
Windows. Also I want to start using BBEdit instead of CodeWarrior's editor.
So I modified one of Bill Briggs' old scripts to parse a selection of files,
find the CodeWarrior text files, change them to BBEdit text files, then
launch BBEdit, change the line endings to DOS and save each such file.
It compiles OK but when running, when it gets to the line where it sets a
variable to the first item in the list, it "can't". Please help me
understand why not.
The alert says "Can't get item 0 of { file "myFile1.cpp of folder.... of
folder... of application "Finder", file "myFile2.cpp...... of application
"Finder", etc. etc.....of application "Finder"}
Now the funny part is that it calls each file "of application 'Finder'".
That seems rather strange, and is probably the key to the problem, but I
can't figure it out.
Thanks,
Jerry Krinock
San Jose, CA
Here is my script:
property oldType : "TEXT"
property oldCreator : "CWIE"
property newType : "TEXT"
property newCreator : "R*ch"
tell application "Finder"
set docFileList to document files in selection as list
if document files in selection as list is {} then
my PostError("No document files are selected.")
else
set i to 0
repeat until i > (count of docFileList)
set currFile to item i of docFileList -- <-TROUBLE
if creator type of currFile is oldCreator then
if file type of currFile is oldType then
set creator type of currFile to newCreator
set file type of currFile to newType
tell application "BBEdit 6.5"
activate
open currFile
set properties of text document 1 to {line
breaks:DOS}
set properties of text document 1 to {saved
state:BBEdit}
save text window 1
close text window 1
end tell
end if
end if
set i to i + 1
end repeat
end if
end tell
to PostError(theMessage)
beep
display dialog theMessage ,
buttons {"OK"} default button "OK" with icon caution
end PostError
_______________________________________________
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.