Copy link to clipboard
Copied
Dear all,
I want to call a script from a menu and tool bar. In both cases I get the message
Script Alert
You are about to run a script in Adobe FrameMaker 2015. You should only run scripts from a trusted source.
Do you want to run the script?
I can accept this with Yes and then the script is executed.
This is more than annoying. So I tried to use jsxbin. But this does not execute the script at all. In menus.cfg I have:
<Command ETBnudge <Label Nudge object info>
<Hypertext message openfile H:/Adobe/FrameMaker.13en/AdobeFrameMaker2015/fminit/configui/ETBnudge.jsx>> ««««««« warning about unsafe script
{Hypertext message openfile H:/Adobe/FrameMaker.13en/AdobeFrameMaker2015/fminit/configui/ETBnudge.jsxbin}} «««««« not executed
{Hypertext message openfile ETBnudge.jsxbin}} «««««« not taken from %appdata%, not executed*** the following is executed in menu, but not in tool bar.
{Hypertext alerttitle Nudging objects: At zoom 100% unit is 1pt... SHIFT+ALT+arrow to nudge 6 units}}
How to get rid of the "unsafe" message ?
Thank You for any idea
Hi Klaus,
I am sorry about that. Check this thread where I asked the question and got a satisfactory answer. Thanks.
-Rick
Copy link to clipboard
Copied
You should put the script in
C:\Users\<UserName>\AppData\Roaming\Adobe\FrameMaker\<VersionNumber>\Startup
where <UserName> is your Windows login name and <VersionNumber> is the FrameMaker version you are using. (Use 13 for 2015 or 14 for 2017.) If the startup folder does not exist, you have to create it. This should be a "safe place" to run your scripts from.
-Rick
Copy link to clipboard
Copied
Thanks Rick for the idea
If I do so - have tried already - then the script is invoked at the start of FM and (it's purpose) displays the message.
Dismissing this of course allows me to open a document, invoke the menu/button - but the script can not be invoked.
I have no clue how to define the command in the menu file.
This does not work:
<Command ETBnudge <Label Nudge object info>
<Hypertext message openfile ETBnudge.jsxbin>> ««««««« not found in %appdata%?
If I place the full path into the menu file:
<Command ETBnudge <Label Nudge object info>
<Hypertext message openfile C:/Users/Klaus/AppData/Roaming/Adobe/FrameMaker/13/Startup/ETBnudge.jsxbin>>
Menu and button opens the jsxbin file in an editor:
Hence my problem is not solved at al - tested in FM-13.
Copy link to clipboard
Copied
Hi Klaus,
I am sorry about that. Check this thread where I asked the question and got a satisfactory answer. Thanks.
-Rick
Copy link to clipboard
Copied
Thank You, Rick - this is really the solution:
<Command ETBnudge <Label Nudge object info>
«corect solution» <Hypertext message openfile C:/Users/Klaus/Documents/Adobe Scripts/ETBnudge.jsx>>
There is however one mystery:
If I use .../ETBnudge.jsxbin, then the script is not executed, but opened in NotePad - see my previous post.
Copy link to clipboard
Copied
Hi Rick,
have now checked the file associations for Open:
jsx: "C:\Program Files (x86)\Adobe\Adobe ExtendScript Toolkit CC\ExtendScript Toolkit.exe" -run "%1"
jsxbin: Notepad
The latter seems to be a default. This should however be set by FM-installation or what?
After changing the assocition for jsxbin for Open to the ESTK, things still go wrong: executing
Hypertext message openfile C:/Users/Klaus/Documents/Adobe Scripts/ETBnudge.jsxbin
opens ESTK, which requests the selection of a (programming) language - and then displays the contents of the binary as we have it in the first post.
Of course an Open by any FM version just tries to open it as text.
=> So what is the correct file association for jsxbin ?
Runnign the script via File > Scripts > Run works correctly also for the jsxbin version.
BTW, the script is quite simple:
// ETBnudge.jsx
// to be placed in C:/Users/Klaus/Documents/Adobe Scripts/
#target framemaker
var msgtitle = "Nudging objects";
var msg = "At zoom 100% unit is 1pt; at zoom 353% unit is 0.1mm"
+ "\n• Use ALT+arrow to nudge 1 unit"
+ "\n• Use SHIFT+ALT+arrow to nudge 6 units"
+ "\n\nATTENTION: SHIFT+ALT (without arrow) changes the system locale. Check your system tray, if keyboard behaves strangly!";
alert(msg, msgtitle);
I have cross-posted this problem in https://forums.adobe.com/thread/2299904
Copy link to clipboard
Copied
I am not sure how to get this to work, but there is a better way to do this. I don't have time to provide details right now, but here is the basic outline:
1) Create a new custom command in your script.
2) Use the built in Command function to wait for the custom command to be invoked and have it call a function with your simple code in it.
3) Compile the script to a jsxbin and install it in the startup folder.
Now you can call your command from the toolbar, etc.
Copy link to clipboard
Copied
Thanks, Rick for Your advice.
There is also a reasonable explanation for the problem of "what is the correct file association for jsxbin" by Ian Proudfoot.