Re: Scripting Image Events - some kind of bug ?
Re: Scripting Image Events - some kind of bug ?
- Subject: Re: Scripting Image Events - some kind of bug ?
- From: Adam Wuellner <email@hidden>
- Date: Thu, 15 Sep 2005 13:55:28 -0500
On 9/15/05, Jay Louvion <email@hidden> wrote:
> Whereas in the script listed at the end of this mail, when asked to return
> POSIX path of thefinalstring, the SE returns: "/Users/me/ EN
> COURS/BuildingAS/HD/artistes/bogus_folder_name/LD_DSC_5603.JPG"
>
> The images are actually being saved to "/Users/me/ EN
> COURS/BuildingAS/HD/artistes/bogus_folder_name/LD_DSC_5603/LD_DSC_5603.JPG"
>
> What's the extra folder about ?
The argument that you're giving to mkdir contains the basename of the
file at the end. Don't append that part, yet.
> ...
> repeat with OneFile in EveryPicture
> tell application "Finder" to set FileName to name of OneFile as text
> set LDFileName to ("LD_" & FileName) as string
> set TheFinalFileString to ((thisFolder as text) &
> "bogus_folder_name" & ":" & LDFileName) as string
> do shell script "mkdir -p " & quoted form of POSIX path of
> TheFinalFileString
You don't want to send the final file path to mkdir - you want to send
the path to the desired folder. Just don't add LDFileName to
TheFinalFileString until after you've used the variable as the
argument to mkdir, or create a separate variable that only contains
the path to the folder - not the file in that folder.
Also, unless your real code alters thisFolder or "bogus_folder_name"
within this repeat loop, you're wasting time calling mkdir on each
iteration. If the directory isn't going to change within the loop,
mkdir it once before the loop starts. You aren't otherwise hurting
anything the way you've got it - mkdir does nothing if the specified
directory already exists - but it's needless, to say the least.
> tell application "Image Events"
> launch
> set this_image to open OneFile
> scale this_image to size (decided_width as integer)
> save this_image in file TheFinalFileString with icon
> close this_image
> end tell
>
>
> set incrementprogress to incrementprogress + 1
> update progress indicator ImageResizeProgress current value
> incrementprogress
>
> end repeat
> ...
HTH,
Adam
_______________________________________________
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