Applescript and InDesign: Packaging/exporting -- can you help?

I found and tweaked a droplet script that isn't quite working right. I tried and failed to learn to do this myself. Any help is greatly appreciated! This is for InDesign CS6 -- you don't really need to know InDesign in order to help (at least I don't think so).
For the moment, I simply drag multiple InDesign files (for this example, "filename1.indd" and "filename2.indd") onto the droplet. InDesign packages them separately and outputs PDFs into each output folder. The problem is that it's creating too many folders and not putting things where I want.
Another thing: when InDesign packages a file, it creates a "Instructions.txt" file for each package that I need deleted. I'd really like this added to the script as well. Is it possible?
Current output (messy!)
Desired output (perfect!)
"exports" folder
     "filename1" folder
          filename1.pdf
          "filename1" folder
               filename1.indd
               Instructions.txt
     "filename2" folder
          filename2.pdf
          "filename2" folder
               filename2.indd
               Instructions.txt
baseFolder <--- directory of original files
     "filename1" folder
          filename1.indd
          "PDF" folder
               filename1.pdf
     "filename2" folder
          filename2.indd
          "PDF" folder
               filename2.pdf
Here's the script I have so far:
property baseFolder : (path to desktop as text) & "exports:"
on open mgItems
     repeat with mgThisItem in mgItems
          tell application id "com.adobe.InDesign"
               try
          open mgThisItem
               set mgDocName to name of active document
               set text item delimiters of AppleScript to ".indd"
               set mgShortName to text item 1 of mgDocName
               set targetFolderPath to my createFolder(mgShortName)
               set text item delimiters of AppleScript to ""
               set mgPackageFilePath to targetFolderPath & mgShortName as string
               set mgProofFilePath to mgPackageFilePath & ".pdf" as string
               set properties of PDF export preferences to properties of PDF export preset "[Smallest File Size]"
               tell the active document to export format PDF type to mgProofFilePath without showing options
               tell the active document to package to mgPackageFilePath with copying fonts, ignore preflight errors, copying profiles, updating graphics, including hidden layers,copying linked graphics and creating report
  close active document saving no
               on error e
                    display dialog e
               end try
          end tell
     end repeat
     display dialog "PDFs created and InDesign file packaged"
end open
on createFolder(nameString)
     set macFolderPath to baseFolder & nameString
     do shell script "mkdir -p " & quoted form of POSIX path of macFolderPath
     return macFolderPath & ":"
end createFolder
Thanks very much!

Easy enough. Note that I've moved things around a little to make a nicer flow:
on open mgItems
  --make a date slug
          set shortDateString to short date string of (current date)
          set {oldTID, my text item delimiters} to {my text item delimiters, "/"}
          set dateBits to (text items of shortDateString)
          set my text item delimiters to ""
          set datePrefixString to (text item 3 of dateBits & text items 1 thru 2 of dateBits & "_Release") as text
          set my text item delimiters to oldTID
          repeat with mgThisItem in mgItems
                    tell application "System Events"
  --get path of the container of the passed in object
                              set targetFolderPath to path of container of disk item (mgThisItem as text)
                    end tell
                    tell application id "com.adobe.InDesign"
                              try
                                        open mgThisItem
                                        set mgDocName to name of active document
                                        set text item delimiters of AppleScript to ".indd"
                                        set mgShortName to text item 1 of mgDocName
  -- set up folder and file references
                                        set mgPackageFilePath to targetFolderPath & datePrefixString & ":" & mgShortName & ":"
                                        set mgProofFilePath to mgPackageFilePath & "PDF:" & mgShortName & ".pdf" as string
                                        set text item delimiters of AppleScript to ""
  -- create dat folder, main folder and internal PDF folder; passing in POSIX path, though most everything ele uses HFS paths
                                        my createFolders(POSIX path of file (mgPackageFilePath & "PDF:"))
                                        set properties of PDF export preferences to properties of PDF export preset "[Smallest File Size]"
                                        tell the active document to export format PDF type to mgProofFilePath without showing options
                                        tell the active document to package to mgPackageFilePath with copying fonts, ignore preflight errors, copying profiles, updating graphics, including hidden layers, copying linked graphics and creating report
                                        close active document saving no
                              on error e
                                        display dialog e
                              end try
                    end tell
  -- delete the instructions file
                    tell application "System Events"
                              delete file (mgPackageFilePath & "instructions.txt")
                    end tell
          end repeat
          display dialog "PDFs created and InDesign file packaged"
end open
on createFolders(pathString)
          do shell script "mkdir -p " & quoted form of pathString
end createFolders

Similar Messages

  • My hard drive's gone, I did repair it and now I'd like to get my 'photoshop Elements 7 back, but got a message saying that the serial number is incorrect and it's not. can you help me, please?

    My hard drive's gone, I did repair it and now I'd like to get my 'photoshop Elements 7 back, but got a message saying that the serial number is incorrect and it's not. can you help me, please?

    Mseixas you can try running the CC Cleaner Tool located at Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6 - http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html and then reinstalling.

  • HT4759 hello my frend, i dont know what i have to do. I bought iphone 4 from ebay and it is locked can you help my to unlock ?

    hello my frend, i dont know what i have to do. I bought iphone 4 from ebay and it is locked can you help my to unlock ?
    <Edited By Host>

    Only the wireless carrier to which the iPhone is locked can unlock
    it. Contact them to see if they offer unlocking and if you qualify.
    Apple does not unlock iPhones - wireless carrier has this responsibility.

  • I taked this through with a mac support agent, but forgot the method, As my Opticle drive fefuses to burn a full ML dvd   Re setting be re starting and pressing some keys, Can you help?

    I taked this through with a mac support agent, but forgot the method, As my Opticle drive fefuses to burn a full ML dvd
    Re setting be re starting and pressing some keys, Can you help?

    I taked this through with a mac support agent, but forgot the method, As my Opticle drive fefuses to burn a full ML dvd
    Re setting be re starting and pressing some keys, Can you help?

  • Hi, I just downloaded iBooks and I downloaded a book but i wanted to get the hunger games one and they dont Havre it so I erased the app and when I wanted to download another one it just says waiting and it does nothing , CAN YOU HELP ME!

    Hi, I just downloaded iBooks and I downloaded a book but i wanted to get the hunger games one and they dont Havre it so I erased the app and when I wanted to download another one it just says waiting and it does nothing , CAN YOU HELP ME!

    Don't know if there is an option make the download window stay up, but you can bring it back with Ctrl+J then right-click on the download to open the folder it was downloaded to.
    * keyboard shortcuts -- http://dmcritchie.mvps.org/firefox/keyboard.htm
    Where files get downloaded to is in your '''about:config''' settings.
    * [http://kb.mozillazine.org/About:config About:config - MozillaZine Knowledge Base]
    * [http://kb.mozillazine.org/About:config_entries About:config entries - MozillaZine Knowledge Base]
    check out variables beginning browser.download.

  • My one day old nano 6 has stopped working and will not restart can you help?

    my one day old nano 6 has stopped working and will not restart can you help?

    try this........ http://www.apple.com/support/ipodnano/assistant/itunes/

  • Hi.My problem is that i am looking forward the email address and also the address of shanghai and pudong apple retailers.Can you help me please?

    Hi.My problem is that i am looking forward the email address and also the address of shanghai and pudong apple retailers.Can you help me please?

    For the street addresses tap the link then enter China in the search field.
    https://www.apple.com/retail/storelist/

  • I keep pressing  verify and it not working can you help me out , Thanks Please reply back .

    I keep pressing  verify and it not working can you help me out , Thanks Please reply back .HELP!

    Have you tried logging out of your account on the phone by tapping on your id in Settings > iTunes & App Stores and then logging back in and seeing if that 'refreshes' the account on it ?
    If that doesn't work then you can contact iTunes support via this page (these are user-to-user forums, you are not talking to Apple here) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page

  • HT5312 hi i forgot my security question and cannot reset this can you help me?

    hi i forgot my security question and cannot reset this can you help me?

    Didn't the link to contact the iTunes Store staff in the 'Additional Information' section of that article work for you? If you don't already have a valid rescue email address, only Apple itself can reset the questions.
    (90152)

  • Lost all my pix on an export-can you help?

    Went to export a picture, entered the information, clicked " export" and Lightroom disapppeared. Recovered it or so i thought. The title bar now reads "Ice caves 2014-Adobe Lightroom 3, and all my pictures are missing. Can you help? Thanks in advance. Sorry, Windows 8, lightroom 3.6
    Message was edited by: triplesrock  Sorry, Windows 8, lightroom 3.6

    Sounds awfully like a new catalog has been created.
    Open "File" in the dropdown menu go to "Open Recent" and seewhat you can find.
    There is a very high likelihood that your usual catalog is there ready to be opened.
    Let us know how you go.
    Tony Jay

  • Ive lost my bookmark and backspace icons. Can you help?

    Ive somehow lost these icons. Also Ive got another toolbar-Elf which I cant seem to ged rid of. Can you help?

    * If, on Windows, in Firefox 3.6 the menu bar is hidden then press and hold the Alt key down or press F10, that should make the "Menu Bar" appear
    * Go to "View > Toolbars" and check-mark "Menu Bar" with a click on it to make that permanent. See [[Menu bar is missing]]).
    * Make sure that you have the "Navigation Toolbar" and the "Bookmarks Toolbar" visible: "View > Toolbars"
    * If items are missing then see if you can find them in the "View > Toolbars > Customize" window
    * If you see the missing item in the Customize window then drag it back from the Customize window onto one of the toolbars.
    * If, in "View > Toolbars > Customize", you do not see that item then click the "Restore Default Set" button
    See also:
    * [[Back and forward or other toolbar buttons are missing]]
    * [[Navigation Toolbar items]]
    * http://kb.mozillazine.org/Toolbar_customization
    For the toolbar see:
    * http://kb.mozillazine.org/Uninstalling_add-ons
    * http://kb.mozillazine.org/Uninstalling_toolbars

  • My windows photoshop elements 11 is frozen and will notopen. Can You help me?

    My windows photoshop elementa11 is frozen and will not open. Can you help me?

    You should also ask this in the iPad forum. This is the forum for the white and black plastic MacBooks that were discontinued in 2010. You should also post this question there to increase your chances of getting an answer.
    https://discussions.apple.com/community/ipad/using_ipad

  • HT4623 I updated my ipad to ios 7 and lost my ibooks can you help me please?

    I updated to ios7 and lost all books in ibooks app. Please can you help?

    Perform a Reset on the iPad (different from just restarting).
    Hold down on both the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears. When you see the Apple logo on the black screen, let go of the buttons.
    After the reset, go to "Settings" then "iBooks". Go to "online content" and turn it on.  Try downloading from iBooks again.
    Hope this answers your question!
    ~Joe

  • HT1229 i have upgraded to yosmite and los my photos can you help please

    lost my photos can you help please.

    lost my photos can you help please.
    Explain please:
    How did you upgrade to Yosemite? Did you make a clean install and wiped the drive? Or did you install on top of the current system? In what way have you lost the photos? 
    is the iPhoto Library missing? Or do you get an error message, when you try to open iPhoto? What error message exactly?
    Have you already updated the iPhoto application? You need to update to iPhoto 9.6 for MacOS X 10.10. The earlier versions will not work.

  • When I tgry to drop a video from the main screen to a time line with no secuence i receive an error with no number, just tell me the progran stop working and the program closes can you help me please

    please someone who help me please
    when I tgry to drop a video from the main screen to a time line with no secuence i receive an error with no number, just tell me the progran stop working and the program closes

    You need to help us first ...
    Computer specs:
    OS, CPU, RAM, GPU, vRAM ... and also disc layout & connections can be useful (as in, "2 internal hard-drives and an external on Thunderbolt connection for exports")
    Program specs:
    Specific build of Premier Pro from the bottom of the "About" splash screen off the "Help" menu is best.
    Footage file type: MXF, AVCHD, MOV, m2s, what?
    Even the camera it was shot on can be of interest at times.
    And did you use media browser to import, then project panel to drag & drop?
    Neil

Maybe you are looking for