Applescript droplet for Indd Script

Community Beginner ,
Sep 15, 2022 Sep 15, 2022

Copy link to clipboard

Copied

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!

TOPICS
How to , Scripting

Views

62

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 15, 2022 Sep 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:
...

Likes

Translate

Translate
Community Expert ,
Sep 15, 2022 Sep 15, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 15, 2022 Sep 15, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2022 Sep 15, 2022

Copy link to clipboard

Copied

LATEST

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

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines