Example
====== Macro - Export Macro ======
^ by: | Gregory Haynes, Jan 2016 |
^ published: | http://forum.avolites.com/viewtopic.php?f=20&t=4361#p15847 |
^ description: | exports macro no.1 as file in the [[macros:macrolocation|usermacro location]] |
{{tag>export macro user usermacro}}
==== functions ====
* [[macros:function:setcurrentmacrofromusernumber]]
* [[macros:function:export]]
===== Code =====
Exports the macro with user number 1.
UserMacros.SetCurrentMacroFromUserNumber(1)
UserMacros.Export(UserMacros.CurrentMacroId)
===== Explanation =====
This explains the functional steps within the sequence. For all the other XML details please refer to [[macros:formats_and_syntax#xml_format|Formats and syntax]]
* ''UserMacros.SetCurrentMacroFromUserNumber(1)'' makes the macro with the usernumer 1 current, i.e. selects it. Change the number if you want to export another macro.
* ''UserMacros.Export(UserMacros.CurrentMacroId)'' actually exports the previously selected macro - all the file handling is done in this function
See also http://forum.avolites.com/viewtopic.php?f=20&t=5733 for hints on exporting more macros.
===== How to use it =====
- [[macros:deploying|make this macro available]]
- create another macro and give this macro usernumber 1
- find the Export macro in the show library or via '''' ''[View All]'' and execute (click) it
- open Windows explorer and navigate to your [[macros:macrolocation|usermacro location]]
- there you'll find a file named Macro1.xml - this is the exported macro
~~DISCUSSION~~