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 09-22-2014, 09:32 AM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
Programmatically creating an action

I am creating a script to modify multiple scripts. I have a loop function that goes in and cycles through all our script files and tries to create a "Write Registry" step in the script, I have the index figured out so its really an issue with recreating the steps through vbscript. I have the following so far:

'Create Sub Call
Option Explicit

Dim objApp, objStep, iNewIndex

Set iNewIndex = Application.Macros(vbldMacroTemporary).Item("TMP_N EW_INDEX")

' create VisBuildPro app object
Set objApp = CreateObject("VisBuildSvr8.Application")
objApp.Project.Load "%PROCFILES_FULLPATH%"

Set objStep = objApp.Project.Steps(vbldStepMain).Add("Write Registry", iNewIndex)
objStep.Name = "VS2013 MSI Project Update"
objStep.Indent = 3
objStep.Checked = False
objStep.Property("RootKey") = -2147483647
objStep.Property("SubKey") = "Software\Microsoft\VisualStudio\12.0_Config\MSBui ld"
objStep.Property("ValueData") = 0
objStep.Property("ValueName") = "EnableOutOfProcBuild"
objStep.Property("ValueType") = 4

objApp.Project.Save

Here is the XML from the Step I am trying to recreate
<step action='Write Registry'>
<RootKey type='3'>-2147483647</RootKey>
<SubKey>Software\Microsoft\VisualStudio\12.0_Confi g\MSBuild</SubKey>
<ValueData>0</ValueData>
<ValueName>EnableOutOfProcBuild</ValueName>
<ValueType type='3'>4</ValueType>
<buildfailsteps type='11'>0</buildfailsteps>
<indent type='3'>2</indent>
<name>VS2013 MSI Project Update</name>
</step>

My question is around RootKey, ValueType, and indent, how do I set the Type paramater and the actual value in my script sample above.

PS using VB 8.7
Reply With Quote
  #2  
Old 09-22-2014, 10:08 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
The KeyRoot property values are:

-2147483647 = HKEY_CURRENT_USER
-2147483648 = HKEY_CLASSES_ROOT
-2147483646 = HKEY_LOCAL_MACHINE

The ValueType property values are:

1 = String
4 = DWORD

The ValueData property holds the value to be assigned, and can be a string or integer value.

The indent property indicates the indent level of the step as shown in the step grid.
Reply With Quote
  #3  
Old 09-22-2014, 10:13 AM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
How can I set the type to be a specific value for type in the properties of the XML element?

The output of the XML looks the same except for ValueType its Type value is set to 2 instead of 3

<ValueType type='2'>4</ValueType>

I assume the following
Type ='3' is equal to integer
Type not set is equal to string

What are the other values that this can be set to and how do I set them?
Reply With Quote
  #4  
Old 09-22-2014, 11:33 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
2 is 2-byte integer, 3 is 4-byte integer.
http://msdn.microsoft.com/en-us/library/cc237865.aspx

Either one is fine, but to explicitly set to 3, use

objStep.Property("ValueType") = CLng(4)
Reply With Quote
  #5  
Old 09-22-2014, 12:06 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
It works perfectly now thanks so much!
Reply With Quote
  #6  
Old 05-08-2015, 02:00 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
I am making another update I am trying to create a Sub call using the following code:

Set objStep = objApp.Project.Steps(vbldStepMain).Add("Subroutine Call", iNewIndex + 1)
objStep.Name = "TEMP New Shares Add"
objStep.Indent = 2
objStep.Checked = True
objStep.Property("SubName") = "SUB TEMP New Shares Add"

objApp.Project.Save

This works but there are two line items that are not getting genereated, if I look at the source of the script the lines with the ----- do not appear, what do I need to add to the above code to create BuildFailstops and ExpandType

<step action='Subroutine Call'>
<Expand type='11'>-1</Expand> ----------------------
<SubName>SUB TEMP New Shares Add</SubName>
<buildfailsteps type='11'>0</buildfailsteps> ------------------------
<indent type='3'>2</indent>
<name>TEMP New Shares Add</name>
</step>

Thanks
Reply With Quote
  #7  
Old 05-08-2015, 02:41 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
To reduce file size, properties that are set to the default value for a property are not stored in the .bld file.
Reply With Quote
  #8  
Old 05-08-2015, 02:53 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
When I add the action manually to the script it creates these setting looking at the source of the script, if I do it progamaitcially these items are omitted. How can I add them even if there the default settings?
Reply With Quote
  #9  
Old 05-08-2015, 04:19 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
so I updated it to the following and it seems to be ok

Set objStep = objApp.Project.Steps(vbldStepMain).Add("Subroutine Call", iNewIndex + 1)
objStep.Name = "TEMP New Shares Add"
objStep.Indent = 2
objStep.Checked = True
objStep.Property("SubName") = "SUB TEMP New Shares Add"
objStep.Property("Expand") = CBool(-1)
objStep.Property("buildfailsteps") = CBool(0)

objApp.Project.Save

is this correct?
Reply With Quote
  #10  
Old 05-08-2015, 04:25 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Yes, or

objStep.Property("Expand") = True
objStep.Property("buildfailsteps") = False

I should have also mentioned that the default for buildfailsteps is -1 (True) and Expand is 0 (False).
Reply With Quote
  #11  
Old 05-08-2015, 04:44 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
Thanks,

I first tried to use true and false but the type was wrong in the final file, using the CBool set the correct type to '11'
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 02:18 AM.


Copyright © 1999-2023 Kinook Software, Inc.