Skip to main content
Known Participant
September 15, 2022
Answered

Applescript droplet for Indd Script

  • September 15, 2022
  • 1 reply
  • 435 views

Hello. I have an often used script that I would like to create a droplet for on my desktop. I am hoping to be able to simply drag an InDesign Document to the droplet, the Document opens in InDesign and the script runs.

 

I am not really familiar with Applescript, but I tried this code and saved as an app

-----

on open droppeditems
tell application "Finder"
activate
tell application "Adobe InDesign 2022"
activate
set mydocument to droppeditems
set aScriptPath to "Users:rosami:Library:Preferences:Adobe InDesign:Version 17.0:en_US:Scripts:Scripts Panel:batch_convert.jsx"
do script alias aScriptPath language javascript

end tell
end tell
end open

------

 

When I drag the Doc to the droplet, it opens InDesign and the Script, but not the Document. Any suggestions as to what I am doing wrong? Thank you!

This topic has been closed for replies.
Correct answer rob day

You have to open the dropped items in order to run the script—your mydocument variable isn’t doing anything. Try this:

 

 

 

 

on open
	tell application "Finder"
		activate
		--gets the dropped item(s)
		set the sel to the selection
		repeat with x in sel
			set thePath to (x as Unicode text)
			tell application id "com.adobe.indesign"
				activate
				--opens each dropped item and runs the jsx
				open thePath
				set aScriptPath to "Users:rosami:Library:Preferences:Adobe InDesign:Version 17.0:en_US:Scripts:Scripts Panel:batch_convert.jsx" as alias
				do script aScriptPath language javascript
			end tell
		end repeat
	end tell
end open

 

 

EDIT: Fixed a typo in the do script line after posting

 

1 reply

rob day
Community Expert
Community Expert
September 15, 2022

Hi @michaelr26894937 , can you post the JavaScript you are trying to run?

Known Participant
September 15, 2022

Hi Rob, It's the batch process script. It's quite long but I will post shortly.

rob day
Community Expert
rob dayCommunity ExpertCorrect answer
Community Expert
September 15, 2022

You have to open the dropped items in order to run the script—your mydocument variable isn’t doing anything. Try this:

 

 

 

 

on open
	tell application "Finder"
		activate
		--gets the dropped item(s)
		set the sel to the selection
		repeat with x in sel
			set thePath to (x as Unicode text)
			tell application id "com.adobe.indesign"
				activate
				--opens each dropped item and runs the jsx
				open thePath
				set aScriptPath to "Users:rosami:Library:Preferences:Adobe InDesign:Version 17.0:en_US:Scripts:Scripts Panel:batch_convert.jsx" as alias
				do script aScriptPath language javascript
			end tell
		end repeat
	end tell
end open

 

 

EDIT: Fixed a typo in the do script line after posting