Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-26-2011, 06:12 PM
iboulder iboulder is online now
Registered User
 
Join Date: 05-26-2011
Posts: 2
How to Dump all Macro to the log

Hi,

Is there a quick way to dump all macros (temp, project, and environment) to the log?

Thanks,
SMckeown
Reply With Quote
  #2  
Old 05-26-2011, 07:04 PM
joe12 joe12 is online now
Registered User
 
Join Date: 05-26-2011
Posts: 8
Here's how I did it, dump them to a file and then read the file into the log, but I figure there's probably a better way.

More on this at:
http://www.kinook.com/Forum/showthread.php?t=4468



Using a VBScript "Run Script" action:

Dim objMacro, theNumberOfThem, theFileName1, theFileName2


Set objMacro = Application.Macros(vbldTemporary) 'just the temporary macros
theNumberOfThem = objMacro.Count
theFileName1 = "C:\Tempmacros"
objMacro.Save(theFileName1)
Builder.LogMessage theNumberOfThem & " Temporary macros have been dumped to a file called: " & theFileName1


' collection of all unique macros, with highest precedence for macros with same name in multiple collections
Set objMacro = Application.Macros(vbldMacroAll)
theNumberOfThem = objMacro.Count
theFileName2 = "C:\AllActiveMacros"
objMacro.Save(theFileName2)
Builder.LogMessage "All (" & theNumberOfThem & " total) Active macros have been dumped to a file called: " & theFileName2

Last edited by joe12; 05-26-2011 at 11:15 PM.
Reply With Quote
  #3  
Old 05-27-2011, 07:28 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
See the attached sample.
Attached Files
File Type: bld LogMacros.bld (3.2 KB, 1432 views)
Reply With Quote
  #4  
Old 06-06-2011, 07:48 PM
joe12 joe12 is online now
Registered User
 
Join Date: 05-26-2011
Posts: 8
I used the Run Script step from the above "LogMacros.bld" example.
It worked for a while, but now out of the blue, I get an error on that VBScript code. The error reads:

Error in Run Script (VBScript) script code at Line 15, Column 4 (Type mismatch: 'Application.ExpandMacrosAndScript')
6/6/2011 5:37:12 PM: Step '14 - Dump All Macro Information to Log' failed
6/6/2011 5:37:12 PM: Build ended (elapsed = 00:00:00).




In the log , it stopped right after writing the lines:

=============================================
****** temporary macros ******



So I examined my Temporary macros, and sure enough I found what is causing the failure. I have an ADO_RS macro sitting around in the temp macros (from an earlier call to SQL with a Loop Action Step to parse that SQL just after).

If I delete that ADO_RS macro, then the "Dump All Macros" step goes back to working.

Is there a way to make this VBScript more robust so that it will dump all the macros even when the macros collections contain one or more macros that are some type of list or whatever?
Reply With Quote
  #5  
Old 06-06-2011, 10:23 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Here is an updated project which handles that.
Attached Files
File Type: bld LogMacros.bld (3.3 KB, 1416 views)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 05:50 PM.


Copyright © 1999-2023 Kinook Software, Inc.