Copy link to clipboard
Copied
Is there a way to get my Script to autoload and be placed in the menu's where the plugin's are found? maybe right before the help menu. I have a markzware plugin that is in the menu's and i just click on that and go from there. It would be nice to have this script up there too. Is there a way to make this happen?
example:
var
myEventListener = app.eventListeners.item("xx");
if (!myEventListener.isValid) {
myEventListener = app.addEventListener( "onInvoke", doJob );
myEventListener.name = "xx";
}
function doJob() {
//your main function
}
Copy link to clipboard
Copied
I should say is there a easy way where i'm not going to have to remake this script all together.
Copy link to clipboard
Copied
I found this if there is a newer way let me know. I may have questions if this gives me errors.
//=============================Script Start =============================//
var mySampleScriptAction = app.scriptMenuActions.add("First Script");
var myEventListener = mySampleScriptAction.eventListeners.add("onInvoke", function(){alert("This menu item was added by a script.");});
//If the submenu "Script Menu Action" does not already exist, create it.
try{
var mySampleScriptMenu = app.menus.item("$ID/Main").submenus.item("NewMenu");
mySampleScriptMenu.title;
}
catch (myError){
var mySampleScriptMenu = app.menus.item("$ID/Main").submenus.add("New Menu");
}
var mySampleScriptMenuItem = mySampleScriptMenu.menuItems.add(mySampleScriptAction);
//============================== Script End ===============================//
Thanks & Regards
T.R.Harihara Sudhan
Copy link to clipboard
Copied
Ok this does put a menu where i'm wanting but i cannot see where to place my script. Any ideas?
Copy link to clipboard
Copied
just add this on top of your main script..
Copy link to clipboard
Copied
example:
var
myEventListener = app.eventListeners.item("xx");
if (!myEventListener.isValid) {
myEventListener = app.addEventListener( "onInvoke", doJob );
myEventListener.name = "xx";
}
function doJob() {
//your main function
}
Copy link to clipboard
Copied
Oh i see what i was doping wrong. I was placing my script after the last } .. Thank you..
Copy link to clipboard
Copied
One more thing. I cannot seem to get rid of the other 2 menu's this placed up on my menu bar.
I checked to see if i had any test scripts still running but i do not.
Copy link to clipboard
Copied
Never mind after i worded it different i found it. The below script worked.
try { |
app.menus.item("$ID/Main").submenus.item("New Menu").remove(); |
}catch(e){} |
Copy link to clipboard
Copied
Never mind after i worded it different i found it. The below script worked.
Be very careful with removing menus or submenus.
Some years ago when I experimented with that I ruined my InDesign installation completely by removing the wrong menu.
Even after reinstalling I had some problems so I had to to use the cleaner tools to get rid of all entries somewhere in my system and install again.
Uwe
Copy link to clipboard
Copied
I was very careful to only delete those two menu's. I am way to afraid to play around with that script.
Copy link to clipboard
Copied
The safe way to do this is to delete your preferences on start-up: Press (the Mac equivalent) of Shift+Ctrl+Alt when you start Indesign, and when it asks you if you want to delete the prefeences, answer yes.
Peter
Copy link to clipboard
Copied
Ok I didnt think that would work because it was a script that i used that added those menu's. So my thinking was the Reseting Preferences would not remove the unused script menu's
Copy link to clipboard
Copied
You should have tried
Find more inspiration, events, and resources on the new Adobe Community
Explore Now