Copy link to clipboard
Copied
What is the hidden secret here?
Starting FM after case 1 executes the script twice !
Starting FM after case 2 executes (as expected) the script once.
I have cut down my script to something manageable and did the tests with this stub.
// FMdict_test.jsx ------ UTF-8 ------------------------------------------------------------------------
#target framemaker
ShowDictInfo () // At start of FM inform about the User dictionary
SetUpMenus() // inactivate for debugging // Establish menu item to get the information also later.function SetUpMenus() { // =========================================================================
// This function MUST NOT be named DefineMenu - because this is a reserved function!
var sDictMenu = "Dictionary information";
var sShortLbl = "ESC q d i";
var sShortCut = "\\!qdi";var menuLocation = app.GetNamedMenu("FileMenu");
var cmdDoc = menuLocation.DefineAndAddCommand(1, "FMdict_DocInfo", sDictMenu, sShortCut);
cmdDoc.KeyboardShortcutLabel = localize(sShortLbl);
UpdateMenus(); // refresh and actually make the new menu appear
} // --- end SetUpMenusfunction Command(cmd){
switch(cmd) {
case 1:
ShowDictInfo();
break;
}
} // --- end Commandfunction ShowDictInfo () { // === Alert the dictionary information ================================
var appdata = app.UserSettingsDir; // %appdata%\Adobe\FrameMaker\<version>
var FMdictDir = appdata.replace (/Adobe.*/ , "D+DD\\FMdict");
var iniFile = FMdictDir + "\\scripts\\FMdict.ini";
var title = "FMdict — Dictionary information";
var currentPrj = "current Project" // GetIniValue (iniFile, "currentPrj");
var currentDir = "current Directory" // GetIniValue (iniFile, "currentDir");
var text = "The User dictionary was loaded from \nFMdict project:\t" + currentPrj + "\nLocated in: \t" + currentDir;if (currentPrj !== "NONE") { // must fit with FMdict
alert (text, title, false);
}
}
the installation routine is a compiled AHK (AutoHotKey) script which uses this statement:
FileCopy, %installDir%\scripts\*.jsxbin, %FMtarget%, 1
This expands to
FileCopy, C:\Users\Klaus\Desktop\InstallThis\scripts\*.jsxbin, C:\Users\Klaus\AppData\Roaming\Adobe\FrameMaker\14\Startup, 1
Parameter 1 allows to overwrite an existing file.
After deleting the target file I repeated the experiment with the command prompt:
Copy C:\Users\Klaus>copy C:\Users\Klaus\Desktop\InstallThis\scripts\*.jsxbin C:\Users\Klaus\AppData\Roaming\Adobe\FrameMaker\14\Startup
This copied script also hits twice!
Find the jsxbin here - it shoud be the same if you 'Export as Binary' the above script.
A very bewitched situation...
Klaus
Copy link to clipboard
Copied
Testing today 2018-02-16 10:12
Scripts are in Desktop\InstallThis\scripts
FMdict.jsx as presented in first post
FMdict.jsxbin FMdict.jsx Exported as jsxbin
Test.bat is on the Desktop (edited between the tests)
REM Copy C:\Users\Klaus\Desktop\InstallThis\scripts\*.jsx C:\Users\Klaus\AppData\Roaming\Adobe\FrameMaker\14\Startup
Copy C:\Users\Klaus\Desktop\InstallThis\scripts\*.jsxbin C:\Users\Klaus\AppData\Roaming\Adobe\FrameMaker\14\Startup
Delete script in Startup before copy to avoid prompt for override
Copying via test.bat
1) FMdict.jsx => alert once
2) FMdict.jsxbin => alert twice
Manual (drag and drop) copy
1) FMdict.jsx => alert once
2) FMdict.jsxbin => alert once
I repeated this after a Windows restart - fully reproducible.
FrameMaker 14.0.2.425 UKenglish
I repeated this after a Windows restart:
System: Win 7 x64 SP1 International English
Hardware:
ThinkPad T440p (purchase 2015-10), 2.5 GHz, 8GB RAM, 500GB SSD.
At docking station:
Dual monitor (Dell 2405FPW on DVI-D 1920×1200, Dell U2412M on analog 1920×1200).
USB 3 hub: HD 2.0 TB, scanner, speakers, Wacom tablet, BlueTooth station for KB and mouse.
Printers connected via network.
Locale settings:
Location: UK (to outbluff websites)
Input Language: German (CH)
Keyboard: CH-de
Time Zone: CET/CETS (Amsterdam, Berlin)
As an "immediate fix" I will use the jsx version for this script (others are built of various includes which makes a jsxbin more convenient).
=> Any ideas about this phenomenon are welcome.