Re: NewbieQ: How to loop properly?
Re: NewbieQ: How to loop properly?
- Subject: Re: NewbieQ: How to loop properly?
- From: Matthew Smith <email@hidden>
- Date: Wed, 06 Mar 2002 08:14:39 +1100
Here's a simple repeat loop for getting file names
on run
set myFolder to choose folder
tell application "Finder"
set fileList to every file of myFolder as alias list
repeat with oneFile in fileList
set fileName to name of oneFile
end repeat
end tell
end run
With "repeat with x in y" x is an item of the list y.
Matthew
on 05/03/2002 23:43, Leif Skoog at email@hidden wrote:
>
I would very much like to animate a movie with picts converted to ascii
>
images. Firstly I have to make the textfiles.
>
>
What I want to do is to make Pict2Ascii open a series of pict-files in
>
a folder and process them one by one and save them as text files in
>
another folder.
>
>
The script I am working on doesn't allow me to get access to the files
>
in the loop because, I think, I only have the number of the loop and
>
not the filename.
>
>
It works when I make a prompt with "choose file" and "choose file
>
name", though.
>
>
>
>
Script is as follows:
>
on run
>
tell application "Finder"
>
activate
>
get the name of every file of the folder "Banzai:Desktop
>
Folder:Asciimovie:Picts"
>
set the fileList to the result
>
>
repeat with i from the first item in the fileList to the last
>
item of the fileList
>
set thisItem to item i of the fileList
>
>
tell application "Pict2AsciiFAT 1.03"
>
activate
>
>
set font to "Monaco"
>
set font size to 5
>
set auto contrast to true
>
set optimize for printer to false
>
set allow high ASCII to true
>
>
--here i tried to get hold of the fileName with "set
>
fileName to thisItem".
>
--Didn't work I can tell you ;). But the following does:
>
set theFile to choose file of type "PICT" with prompt
>
"Please choose a Pict file :"
>
set theString to convert picture to ASCII theFile
>
>
set outFilename to choose file name with prompt "Save
>
converted picture as :"
>
set outFile to open for access outFilename with write permission
>
write theString to outFile
>
close access outFile
>
>
>
end tell
>
end repeat
>
end tell
>
end run
>
>
Am I a hopeless jerk or what.
>
>
Help me, please
>
>
Leif
>
_______________________________________________
>
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.
_______________________________________________
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.