Kinook Software Forum

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

Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1  
Old 02-16-2006, 03:02 PM
pjaiswal pjaiswal is online now
Registered User
 
Join Date: 01-26-2006
Posts: 30
Error setting temp macro in vbscript

Hi,

I am using this in my vbscript to set a temporary macro BatFile.

Application.Macros(vbldTemporary).Add "BatFile", vbld_TempMacroObj("ADO_RS").Fields("TLBIMPFile")
MsgBox "%BatFile%"

And then in the next step using the run program to run a bat file as follows:

%DOSCMD% %DestinationDir%\%BatFile%

But this gives me an error.

What am I doing wrong?

Thanks.
Reply With Quote
  #2  
Old 02-16-2006, 03:49 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
What's the error message? If either macro could contain spaces, you'll want to enclose the value in double quotes:

%DOSCMD% "%DestinationDir%\%BatFile%"
Reply With Quote
  #3  
Old 02-16-2006, 04:38 PM
pjaiswal pjaiswal is online now
Registered User
 
Join Date: 01-26-2006
Posts: 30
%DOSCMD% "%DestinationDir%\%BatFile%"

Changing it to this also gives the following error:

The syntax of the command is incorrect.

Process completed with exit code 1
Step 'Run Program' failed

Also, in my VBScript

MsgBox vbld_TempMacroObj("ADO_RS").Fields("TLBIMPFile")

This pops the right value, but the one below pops up a messagebaox with : <object>

Application.Macros(vbldTemporary).Add "BatFile", vbld_TempMacroObj("ADO_RS").Fields("TLBIMPFile")
MsgBox "%BatFile%"

Also, the value destination dir is C:\Xfolder\bin
Reply With Quote
  #4  
Old 02-16-2006, 04:45 PM
pjaiswal pjaiswal is online now
Registered User
 
Join Date: 01-26-2006
Posts: 30
OK. Changing it to this:

Application.Macros(vbldTemporary).Add "BatFile", SFname

and SFname is a string with the recordset value worked....for some reason.

Thanks.
Reply With Quote
  #5  
Old 02-17-2006, 08:48 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Your code stores the recordset field object rather than its value. Use

Application.Macros(vbldTemporary).Add "BatFile", vbld_TempMacroObj("ADO_RS").Fields("TLBIMPFile").V alue

to store the field's value in the macro.
Reply With Quote
  #6  
Old 02-17-2006, 02:31 PM
pjaiswal pjaiswal is online now
Registered User
 
Join Date: 01-26-2006
Posts: 30
Hi,

I am trying to Set Macro called BatFile and giving the following in the value field like this:

%vbld_TempMacroObj("ADO_RS").Fields("TLBIMPFile"). Value%

or

vbld_TempMacroObj("ADO_RS").Fields("TLBIMPFile").V alue

or

vbld_TempMacroObj("ADO_RS").Fields("TLBIMPFile")

or

%vbld_TempMacroObj("ADO_RS").Fields("TLBIMPFile")%

These are the errors I get:


C:\PLTS\Bin\vbld_TempMacroObj' is not recognized as an internal or external command,
operable program or batch file.


Error expanding macros or script in property MacroValue: <Error parsing macros: Unrecoverable Parse Error at position 28 - expecting percent_sign>


What should I use?
Reply With Quote
  #7  
Old 02-17-2006, 03:01 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
http://www.visualbuild.com/Manual?scriptexpressions.htm
Reply With Quote
  #8  
Old 02-17-2006, 06:00 PM
pjaiswal pjaiswal is online now
Registered User
 
Join Date: 01-26-2006
Posts: 30
Thanks!

I have another question:

builder.RunProgram(%DOSCMD% "%DestinationDir%\[vbld_TempMacroObj("ADO_RS").Fields("TLBIMPFile").V alue]")

Adding this line to my vbscript code gives me error:

Error in Run Script (VBScript) script code at Line 61, Column 33 (Expected ')')
Code: builder.RunProgram(C:\WINDOWS\system32\cmd.exe /C "C:\PLTS\Bin\[vbld_TempMacroObj("ADO_RS").Fields("TLBIMPFile").V alue]")

But running this same command in Run program action:

%DOSCMD%
"%DestinationDir%\[vbld_TempMacroObj("ADO_RS").Fields("TLBIMPFile").V alue]"

runs fine.

How can I incorporate this in the script?
Reply With Quote
  #9  
Old 02-17-2006, 06:25 PM
pjaiswal pjaiswal is online now
Registered User
 
Join Date: 01-26-2006
Posts: 30
This gives me the right value when I run the script:

MsgBox vbld_TempMacroObj("ADO_RS").Fields("TLBIMPFile").V alue


But

builder.RunProgramEx(%DOSCMD% %DestinationDir%\vbld_TempMacroObj("ADO_RS").Field s("TLBIMPFile").Value)

gives me the error:

Error in Run Script (VBScript) script code at Line 62, Column 35 (Expected ')')
Code: builder.RunProgramEx(C:\WINDOWS\system32\cmd.exe /C C:\PLTS\Bin\vbld_TempMacroObj("ADO_RS").Fields("TL BIMPFile").Value)
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:33 AM.


Copyright © 1999-2023 Kinook Software, Inc.