Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exporting Macros with All Custom Functions Packaged
#1
I want to share the code of Macro A with my friend. The usual method is to select "Export Item..." from Macro A's context menu.
However, Macro A uses many functions I have written myself, and these functions are spread across different folders(For the sake of easier management, it's not possible to place all custom functions in the same folder). I need to manually select them all for export,

which is very time-consuming. Is there a simpler way to export them all together?
Thanks in advance for any suggestions or help.

Additionally, when importing these macros and functions, I want to directly overwrite the existing macros and functions with the same names.
I have the same confusion regarding LA as well.
#2
Quote:Is there a simpler way to export them all together?
No. In LA it's possible to add this feature or extension, but not in QM.
 
Quote:these functions are spread across different folders(For the sake of easier management, it's not possible to place all custom functions in the same folder)
But maybe in your workspace you can place these folders in a single folder, or in several folders. Then, when exporting macro A, export that folder too. Two files to share. Nothing bad if only some functions are needed for macro A. Of course all your "never share" functions would live elsewhere. Not tested, just an idea.
#3
I just came up with an idea:  Idea

 ########################## Operations on My Computer
 Step1: to export a list of all built-in normal functions and member functions' names as List1

 Step2: Obtain List 2, which contains the names of all normal functions and member functions in the main function you want to share.

 Step3: Perform an intersection operation between List1 and List2 to determine the names of the normal functions and member functions to be exported.


 Step4: Loop through the selected function names, retrieve their corresponding text, and save them in the 666 folder on the desktop.

 ########################## Operations on My Friend's Computer
 Get the list of files from the 666 folder on the desktop.
 Loop through the files, and replace the text of the same-named functions in QM with the content from the corresponding files.

 Now, the code for Step 2 and Step 3 needs to be implemented.

Macro ExportItem
Code:
Copy      Help
;########################## Operations on My Computer

;Step1: to export a list of all built-in normal functions and member functions' names as List1
ARRAY(str) nameArr
QMITEM q; int i
rep
,i=qmitem(-i 1|4|8|64 &q 1)
,if(i=0) break
,nameArr[]=q.name
_s=nameArr
_s.setfile("$desktop$\qmFuncLists.txt")

;Step2: Obtain List 2, which contains the names of all normal functions and member functions in the main function you want to share.

;Step3: Perform an intersection operation between List1 and List2 to determine the names of the normal functions and member functions to be exported.

;Step4: Loop through the selected function names, retrieve their corresponding text, and save them in the 666 folder on the desktop.
str funcName="str.XXXX"
_s.getmacro(funcName)
_s.setfile(F"$desktop$\666\{funcName}.txt")

;########################## Operations on My Friend's Computer
;Get the list of files from the 666 folder on the desktop.
;Loop through the files, and replace the text of the same-named functions in QM with the content from the corresponding files.
ARRAY(str) funcLists; GetFilesInFolder funcLists "$desktop$\666\"
str fls=funcLists
foreach _s fls
,str c.getfile(_s)
,str n.getfilename(_s)
,out n
,c.setmacro(n)

Similarly, I also need to implement the above functionality in LA. Although LA has synchronization features, it can be a bit complex to use.

I really need this feature. After modifying the macro code on the test computer, I want to export it and then import it on my home computer.For safety, create a backup of the macro code to be overwritten with the current timestamp before importing.
#4
I noticed that in LA, a certain class name or script name is not unique in the file list. How can I implement the functionality mentioned above? (When exporting a project, class library, or script, the associated files should be exported together as well). Thank you very much!
 I don't want to use synchronization features as they are not very convenient. Most of the time, I perform export tasks using the functionality mentioned above.

Additionally, importing from LA on another computer and overwriting the same files is too difficult for me. It's even harder than the situation with QM.
#5
Next LA will have an option to export associated files.
#6
Thank you.
Could you also add a similar import feature? That is, support overwriting files associated with the main script/project/library.
When importing files into QM, overwriting is not possible; instead, a "_renamed" suffix is added to the original file name. What I need is to directly overwrite the file with the same name.
If this functionality is not available, I will have to manually check for changes in each associated file, which is very time-consuming.


Forum Jump:


Users browsing this thread: 2 Guest(s)