if you are a human please do not click here
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
Username :
Password :
Home
Help
Calendar
Register
Login
XMetaL Community Forums
»
General
»
General XMetaL Discussion
»
Global Function and variable
Pages:
1
« previous
next »
Print
Author
Topic: Global Function and variable (Read 821 times)
gcrews
Member
Posts: 189
Global Function and variable
«
on:
November 08, 2010, 12:47:41 PM »
Is there a way to use the same function between different macros and have a variable that keeps its value between macros?
The On_Application_Query_Service stuff in the programmer’s guid seems to be kind of what I’m looking for. The example has the flowing line:
Application.QueriedServiceImpl = getMyService();
Where do you define the getMyService() function though? If I have a variable in a prototype class will it persist between service calls to it?
«
Last Edit: November 08, 2010, 01:08:58 PM by gcrews
»
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member
Posts: 1546
Re: Global Function and variable
«
Reply #1 on:
November 08, 2010, 01:14:20 PM »
Although you can declare a function in any macro the event called On_Macro_File_Load is a good place to declare them (it is a clean place to do it and this event runs when an MCR is loaded, so the function will be there provided the MCR loaded).
To store values for document-level macros you can use these:
DocumentProperties
(and its associated APIs "
add
", "
item
" and "
count
")
The actual API you use to get to DocumentProperties is
ActiveDocument.CustomDocumentProperties
.
For application-level macros you can use
Application.CustomProperties
.
Logged
gcrews
Member
Posts: 189
Re: Global Function and variable
«
Reply #2 on:
November 08, 2010, 01:20:59 PM »
Ah I see now just found the doc "Variable scope in XMetaL Author". I tried a while back using a function between macros and it didn’t work and thought the macro code functions were completely separate. Thank you that makes complete sense now.
Logged
Pages:
1
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> Forum Information
=> General XMetaL Discussion
=> DITA and XMetaL Discussion
=> XMetaL Tips and Tricks
=> XMetaL Announcements and Events
Loading...
email us