timogeib Posted October 21, 2014 Posted October 21, 2014 Hey, is there anyone who might be able to tell if its possible to place files in InDesign using the Alfred "File Nav & Result Actions"? I think that would be a super handy feature for everybody using InDesign and Alfred. Thanks in Advance
dsburfitt Posted March 14, 2017 Posted March 14, 2017 A few years later, but id love to have this too. I've got the applescript i feel would be involved. Im just having a tough time applying to Alfred set myNameFile to "file path from alfred" tell application "Adobe InDesign CC 2017" activate set myDoc to active document tell page 1 of myDoc set myRectangle to make rectangle with properties {geometric bounds:{25.6, 13.6, 709.6, 402.4}} try place alias (myNameFile) on myRectangle fit rectangle 1 given center content on error -- do your stuff end try end tell tell document 1 set transform reference point of layout window 1 to center anchor --set theImages to all page items -- scales rectangle set theImages to all graphics -- scales the graphic only repeat with i from 1 to count of theImages set MyImage to item i of theImages set absolute horizontal scale of MyImage to 100 set absolute vertical scale of MyImage to 100 end repeat end tell end tell
dfay Posted March 14, 2017 Posted March 14, 2017 I don't have InDesign to test but if you're passing from a File Action to AppleScript you need to begin the script like this: set myNameFile to POSIX file "{query}" See https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/ReferenceFilesandFolders.html dsburfitt 1
dsburfitt Posted March 14, 2017 Posted March 14, 2017 thanks a million! haha i was dancing with a 100 things trying to figure it out. THANK YOU THANK YOU dfay 1
imurban Posted December 19, 2017 Posted December 19, 2017 Hi dsburfitt. I'm very late to the conversation here, but I hoped to find if you were ultimately able to get the Applescript to work just by replacing that first line with dfay's recommended "POSIX" line. With that edit, I can file-action my script to run as far as activating InDesign (CS6 in my case…changed the app's name in my script), but no placement of the Alfred-actioned file occurs. From what I read of Applescript in InDesign, it shouldn't matter that I'm attempting this with CS6 rather than CC 2017. Just wondering if you needed to otherwise tweak you original script to get it working. Thanks for your time.
dsburfitt Posted December 19, 2017 Posted December 19, 2017 Hey Imurban, I modified it quite a bit since. If you wanted to compare my old script above...to this... on alfred_script(q) tell application "Finder" set myNameFile to (get selection as alias) end tell tell application "Adobe InDesign CC 2017" activate set myDoc to active document tell page 1 of myDoc set myRectangle to make rectangle with properties {geometric bounds:{25.6, 13.6, 709.6, 402.4}} try place myNameFile on myRectangle fit rectangle 1 given center content on error -- do your stuff end try end tell I found setting it as an alias was less complicated.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now