Need help on VBScript

I’d really appreciate it if someone can help me on this small VBScript and the question! Thanks a lot in advance!

I need a VBScript to automatically create a folder for me, like “Build 01.06.0025” which I don’t have to enter anything for the folder’s name since the last two digits will be increment by 1 every time I run it.

By the way, how can I manipulate “drag and drop DLL files to Component Services” Action in FinalBuilder?

Hi Eric,

To create the folder you should not need to use VBScript, simply use the Create Directory action with appropriate variable(s) for the directory name. If 01.06.0025 is a version number, you may be able to use the Property Set action with an autoincrementing Build Number. However, if you need the numbers formatted as above (ie 00.00.0000) then you need to a little bit of custom scripting. If you create a persistent variable called BuildNum, then use VBScript like this:

Buildnum = Buildnum + 1
while Len(BuildNum) < 4
BuildNum = 0 & BuildNum
wend

… then you should get the formatting you need. You could put the above script code into the BeforeAction script of the Create Directory action. Then just use 01.06.%BuildNum% as the name.

Please let me know if you would like to see a more complete example.

[quote] By the way, how can I manipulate “drag and drop DLL files to Component Services” Action in FinalBuilder?[/quote]

I’m not sure exactly what you mean by this, but have you looked at the COM+ Register action? If you let us know exactly what you need to do, we can probably help you some more.

Regards,

Angus

PS I edited your post to tone down the fonts, I hope you don’t mind.

Wow, thank you so much for the quick response.
I’ll try your suggestion for the vbscipt question.
For the second part, here’s what I did manually.
1. unregister the dll file
2. replace it by latest one
3. register the latset dll
4. open Component Services window
5. find COM+ Applicaton I’m using and delete old components
6. drag and drop the dll file to Components area, then the services are available.
How can I manipulate the last step in FinalBuilder? I know step 1 to 5 can be done in FB4.

Thank you so much!
By the way, if I’m right, you are in Australia, aren’t you? :slight_smile:

Hi Eric,

Step 6 can be done using the COM+ Register action. Just enter the COM+ Application name that you’re using, and specify the DLL file for the “Libraries to Register Components”.

You can also complete step 5 using the COM+ Delete action.

- Angus

PS We’re in Canberra, Australia. :-).

Hi Angus,
Thanks a lot for the answer on COM+
I think I need a complete example on the VBScript so that I can have a version number like 00.00.0000 starts with 0030, which means next time I run the FinalBuilder, it will give me 00.00.0031.
Thank you so much for your time!

Hi Angus,
There’s another issue I’d like to ask.
The DLL I was trying to register is located on another server and I’d like to register it remotely on that server. I was trying to execute the batch file which is located on the server, but FB gave me an error seems it registered dll file locally. Thanks for your help!

For the last question, I tried to map the network drive to the worksation which is running the FB4 first. Is there a better to run the batch file remotely? Thanks

Hi Eric,

For the VBScript:

Say you define 3 variables, ‘MajorVer’, ‘MinorVer’ and ‘BuildVer’ and check the box to make them all “Persistent” (ie the value will be saved between runs of FinalBuilder.) Then set them (using Set Variable actions, or load from INI, or whatever) to the version numbers that you need. Then, in the BeforeAction script event of the Create Directory:

Buildnum = Buildnum + 1
while Len(BuildNum) < 4
BuildNum = 0 & BuildNum
wend
while Len(MajorVer) < 2
MajorVer = 0 & MajorVer
wend
while Len(MinorVer) < 2
MinorVer = 0 & MinorVer
wend

… Then set the new directory’s name to be "%MajorVer%.%MinorVer%.%BuildVer%"

2) COM+ Stuff

I don’t actually get what you mean by “batch file”, do you mean an actual .BAT file or the FinalBuilder project file?

If you’re using FinalBuilder and the COM+ Actions, you can choose a Remote Host for each action to register the components with. The DLL paths that you specify will need to be local paths on the remote server (You’ll probably need to just type them in, instead of browsing for them by clicking the folder button on the edit field.)

If you’re using .BAT (or .VBS) files, you’ll probably need to actually run them on the remote computer. You can do this with the WMI Run Process action, or with a tool like SysInternals’ PsExec.

Regards,


Angus

Hi Angus,

For the second part, I'd like to confirm that if I use COM+ Register Action and specify the host server, then I don't have to run regsvr32 in DOS, right? What about unregister? If I use Register DLL/OCX and specify the network path for the dll file on another server? Will it unregister the dll for me on that server remote, or I have to run it locally? If it has to be run the locally, is there a way in FB to do that for me? Thanks!

Hi Eric,

At the moment there is no easy to run regsvr32 on a remote machine, apart from using WMI Run Process to run “regsvr32 /s DLLName.dll”. If you specify a network path and run the action on the local machine, this will just try to register the DLL (from the remote machine) onto the local machine.

However, I don’t think that you necessarily need to use regsvr32 as a prerequisite to registering a DLL as a COM+ Component. You may be able to skip that step. I may be wrong about this, however.

Regards,

Angus