Copy link to clipboard
Copied
Hi,
I have a few scripts that are functions that I include in one main file.
This main file is called from a custom menu item.
I want some objects to be available to all of my scripts, including the ones that I include.
For some reason none of my included scripts recognise the global objects.
The code below is the start of my main file. below that is a function, which is called by the menu item when it's clicked.
How do I make the objects below available to all of my included scripts?
#include "C:/Users/jcahill/AppData/Roaming/Adobe/InDesign/Version 12.0-ME/en_AE/Scripts/Scripts Panel/import translations/indexof.jsx"
#include "C:/Users/jcahill/AppData/Roaming/Adobe/InDesign/Version 12.0-ME/en_AE/Scripts/Scripts Panel/import translations/add_hyperlinks_v3.jsx"
#include "C:/Users/jcahill/AppData/Roaming/Adobe/InDesign/Version 12.0-ME/en_AE/Scripts/Scripts Panel/import translations/proofread_translations_v1.1.jsx"
#include "C:/Users/jcahill/AppData/Roaming/Adobe/InDesign/Version 12.0-ME/en_AE/Scripts/Scripts Panel/import translations/open_files_v1.1.jsx"
#include "C:/Users/jcahill/AppData/Roaming/Adobe/InDesign/Version 12.0-ME/en_AE/Scripts/Scripts Panel/import translations/add_pages.jsx"
#include "C:/Users/jcahill/AppData/Roaming/Adobe/InDesign/Version 12.0-ME/en_AE/Scripts/Scripts Panel/import translations/add_sections.jsx"
#include "C:/Users/jcahill/AppData/Roaming/Adobe/InDesign/Version 12.0-ME/en_AE/Scripts/Scripts Panel/import translations/get_each_language_data_v1.1.jsx"
#include "C:/Users/jcahill/AppData/Roaming/Adobe/InDesign/Version 12.0-ME/en_AE/Scripts/Scripts Panel/import translations/add_child_bookmarks.jsx"
#include "C:/Users/jcahill/AppData/Roaming/Adobe/InDesign/Version 12.0-ME/en_AE/Scripts/Scripts Panel/import translations/add_crossreferences.jsx"
#include "C:/Users/jcahill/AppData/Roaming/Adobe/InDesign/Version 12.0-ME/en_AE/Scripts/Scripts Panel/import translations/resize_overset_table.jsx"
#include "C:/Users/jcahill/AppData/Roaming/Adobe/InDesign/Version 12.0-ME/en_AE/Scripts/Scripts Panel/import translations/sort_headings.jsx"
#include "C:/Users/jcahill/AppData/Roaming/Adobe/InDesign/Version 12.0-ME/en_AE/Scripts/Scripts Panel/progress bar.jsx"// this script is the entry point of the import IDML translations script
var ENGLISH = {
FULL: "English",
ABBR: "EN"
},
FRENCH = {
FULL: "French",
ABBR: "FR"
},
GERMAN = {
FULL: "German",
ABBR: "DE"
},
ITALIAN = {
FULL: "Italian",
ABBR: "IT"
},
SPANISH = {
FULL: "Spanish",
ABBR: "ES"
},
NORWEGIAN = {
FULL: "Norwegian",
ABBR: "NO"
},
RUSSIAN = {
FULL: "Russian",
ABBR: "RU"
},
TURKISH = {
FULL: "Turkish",
ABBR: "TR"
},
ARABIC = {
FULL: "Arabic",
ABBR: "AR"
};
If you want your included files to recognise your global object, you'll have to define and initialise that object before calling the the include files. (Same confusion as in the British government about Brexit: May/Davies think that they can negotiate a deal after it was made!)
P.
Copy link to clipboard
Copied
I hope you have to use #includepath not #include...
if you use #include then all the scripts including the main script should be place in the same folder..
for more refer..
Copy link to clipboard
Copied
If you want your included files to recognise your global object, you'll have to define and initialise that object before calling the the include files. (Same confusion as in the British government about Brexit: May/Davies think that they can negotiate a deal after it was made!)
P.
Copy link to clipboard
Copied
Good one Peter (cf Theresa May) Thought it was typically french those kind of "oopsie" troubles
Copy link to clipboard
Copied
Thanks Peter,
I solved it by putting the objects in an include file called global_objects.jsx.
Then, I just included that file first