• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scripting Image Events - some kind of bug ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Image Events - some kind of bug ?


  • Subject: Re: Scripting Image Events - some kind of bug ?
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 13 Sep 2005 10:29:02 -0700

On Sep 13, 2005, at 6:30 AM, Jay Louvion wrote:

le 13/09/05 13:34, Yvan KOENIG à email@hidden est réputé(e) avoir
écrit :


why not add here something like

if not exist folder (thisFolder as text) & "bogus_folder_name" then
make new folder (thisFolder as text) & "bogus_folder_name" (* check the
syntax *)

My previous script used that functionnality, but I was wondering how to
adapt a new version to make it really easy to create a hierarchy without
ever calling on "make folder". Specifying a path, that would create folders
if they didn't exist. Some apps can do that, no ?


All I would have had to do is list the paths, get thefolder as delimiter and
replace the end of the path, starting with a referrence to an "LD" folder
(whether that existed or not) to create the hierarchy as the resizing went
along...


You see, the bogus_folder is just a test, since in some cases, the path can
be - thefolder &
":LDbogus_container:bogus_folder1:bogus_folder2:LD_DSC_1234.jpg"...

In general, applications will not create folders for you when referencing a file. Sorry. However, if you don't want to do all the processing yourself, then there's a shortcut involving the shell, namely mkdir(1). This will rely on two tricks: first, the "POSIX path" property doesn't care (mostly) about whether or not any of the path components exist; second, mkdir(1) has a "-p" option that will create *all* the folders specified in the path. So, for instance:


set p to thefolder & ":LDbogus_container:bogus_folder1:bogus_folder2:"
do shell script "mkdir -p " & quoted form of POSIX path of p


I'm breaking my own standard advice again by applying "POSIX path" to a string, but the upshot is that when this is done, LDbogus_container, bogus_folder1, and bogus_folder2 will all exist. (That's the other feature of -p -- it won't error if any of the folders already exist.)


--Chris Nebel AppleScript and Automator Engineering

_______________________________________________
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


  • Follow-Ups:
    • Re: Scripting Image Events - some kind of bug ?
      • From: Jay Louvion <email@hidden>
    • Re: Scripting Image Events - some kind of bug ?
      • From: Adam Wuellner <email@hidden>
References: 
 >Re: Scripting Image Events - some kind of bug ? (From: Jay Louvion <email@hidden>)

  • Prev by Date: Re: exit this repeat loop
  • Next by Date: Re: "Numeric overflow"?
  • Previous by thread: Re: Scripting Image Events - some kind of bug ?
  • Next by thread: Re: Scripting Image Events - some kind of bug ?
  • Index(es):
    • Date
    • Thread