Skip to main content
iBabs2
Inspiring
July 4, 2010
Answered

My script for moving .indd files into a folder not working

  • July 4, 2010
  • 2 replies
  • 872 views

Hello,

I have been making a bunch of scripts to clean off my desktop and put certain file types in specific folders..All are working except for my InDesign one.

Can some look at the code and maybe tell me why....basically it makes a folder on the desktop called InDesign Folder, if one does not exist and then it is suppose to move any file that ends in indd to it. thanks

property inDesignFolder : "InDesign desktop"

tell application "Finder"

if not (exists folder inDesignFolder) then make new folder with properties {name:inDesignFolder}

move (every document file whose kind ends with "indd") to folder inDesignFolder

end tell

if anyone can tell me why this isn't working, I would appreciate that.

thanks

babs

This topic has been closed for replies.
Correct answer sstanleyau

A-ha. Okay (still in unknown territory, mind!), perhaps you can use the 'creator' attribute:

whose creator type is "R*ch"

is from an example script I found. Now, how to find the creator type of an InDesign file ... (Although on further reading this might not work anymore on OS X. I think I'd better leave it to the AS wizzes.)


> this might not work anymore on OS X

Right -- creator codes aren't used on 10.6. But before then they  were problematic because they often weren't present for files that originated from non-Mac OS sources.

2 replies

Inspiring
July 4, 2010

You have a choice, but "id be tempted to use:

every document file whose name extension is "indd"

iBabs2
iBabs2Author
Inspiring
July 5, 2010

Hello Sstanly,

you wrote:

sstanleyau wrote:

You have a choice, but "id be tempted to use:

every document file whose name extension is "indd"

That worked.....I actually tried that earlier, but realized i wrote .indd...I guess the period messed it up ;-)

thanks!!!

babs

Jongware
Community Expert
Community Expert
July 4, 2010

Purely guesswork (I have a Mac but I only know it can run something called "Applescript" ), but some of your named items are between double quotes, but the 'name' "InDesignFolder" is not. Is that correct syntax?

(Perhaps it's because the property InDesignFolder seems to have the name "InDesign desktop" --? Does it create that folder and then do nothing?)

iBabs2
iBabs2Author
Inspiring
July 4, 2010

Hello,

Yes, it is correct....here is the script I have to do the same thing for PDF files:

property pdfFolder : "PDF desktop"

-- the desktop folder of the current user is the "root" folder of the Finder

tell application "Finder"

if not (exists folder pdfFolder) then make new folder with properties {pdfFolder}

move (every document file whose kind ends with "PDF Document") to folder pdfFolder

end tell

...and this is the one I have for flash files:

property flashFolder : "Flash desktop"

-- the desktop folder of the current user is the "root" folder of the Finder

tell application "Finder"

if not (exists folder flashFolder) then make new folder with properties {name:flashFolder}

move (every document file whose kind ends with "Flash Document") to folder flashFolder

end tell

The problem here, with the InDesign Files is that when I get info on the documents, it's kind ends with document. That could also be, however, a Text File or a word document, etc etc etc.... If I try to type in what the kind says exactly in the info area "InDesign® CS4 Document" It doesn't work...plus, it would never get a CS3 document....so I am trying to figure out how the applescript isolates the kind option so I can place it into the script. I was also trying to come up with having it find all files whose name contains indd...but that too was unsuccessful.

any thoughts?? thanks..babs

Jongware
Community Expert
Community Expert
July 4, 2010

A-ha. Okay (still in unknown territory, mind!), perhaps you can use the 'creator' attribute:

whose creator type is "R*ch"

is from an example script I found. Now, how to find the creator type of an InDesign file ... (Although on further reading this might not work anymore on OS X. I think I'd better leave it to the AS wizzes.)