Jump to content

Placing Files in InDesign using Alfred Commands


Recommended Posts

Posted

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

  • 2 years later...
Posted

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

  • 9 months later...
Posted

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.

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...