mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Hiding the cmd window

Hello Sony,

This is happening because you must provide the full path to the BAT in your VBScript.
Does the BAT file reside on the target machine or installed along with your package?

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Hiding the cmd window

Hi Sony,

Since you are in a hurry and I won't be available to answer your further posts until Monday next year :) , I have attached a sample project , BAT and VBS file that have implemented the case in which your BAT file is installed as a temporary file. Also you can see the output parameter on the D:\ drive in the output.txt file. This is for only tests and proving the functionality and you can change the output path from the BAT file in case you don't have a D: drive. In the BAT file I also received the parameter as you do in your service BAT file by using the %1 syntax. You should note that in the case your BAT is a temporary file installed with the package, you should also set the VBS custom action with "Deferred" and use the CustomActionData property to pass the public properties ("Action Data" field in Advanced Installer). All this is implemented in my attached project.

In case your BAT file already resides on the target machine then you can simply modify the following script line and mention the entire path where the BAT resides and use the script sample I posted for you in my previous posts.

Code: Select all

WSO.run "%comspec% /c install-service.bat """& Parameter &"""", WindowStyleStealth, false
I also mentioned in one of my previous posts that I would also need the .AIP (project) in order to see what you are dealing with. Since you only sent the log file I don't have all the data and all I can do is assume certain scenarios.
Hope this can help you understand the issue and solve the problem in good time.

Happy new year !
Mihai
Attachments
sample.zip
(3.3 KiB) Downloaded 346 times
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: Hiding the cmd window

Hi Mihai,
This is happening because you must provide the full path to the BAT in your VBScript.
Does the BAT file reside on the target machine or installed along with your package?
Bat doesnt reside on the target machine. It will be installed along with the package.

I have given the whole path for the bat file in the .vbs file. Here is the code:

Dim Parameter,WSO
Parameter=Session.Property("DIR")
const WindowStyleStealth = &H20000000
set WSO = createobject("Scripting.FileSystemObject")
WSO.run "%comspec% /c Parameter/NGN Posting Service/install-service.bat """& Parameter &"""", WindowStyleStealth, false

But its not working. Is this a correct of giving the bat path? I have specified the .vbs custom action as the deferred but the bat file is not getting executed.

Regards
Sony
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Hiding the cmd window

Hello,
Is this a correct of giving the bat path?
If you want to use the same variable in your BAT file path and the BAT will be installed on the target machine along with the package, here is the correct syntax for the last line of your VBScript:

Code: Select all

WSO.run "%comspec% /c " & Parameter & "\NGN Posting Service\install-service.bat """ & Parameter & """", WindowStyleStealth, false
Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: Hiding the cmd window

Hi Mihai,

I have the script that you have given me, but I still get an error in the vbscript. Please find the error screen shot in the attachment.

Regards
Sony
Attachments
error.zip
(211.32 KiB) Downloaded 327 times
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Hiding the cmd window

Hello Sony,

Please use the attached sample from my previous post as a guideline and note that you cannot pass a public property to a "Deffered" custom action unless you use the CustomActionData property. You must parse the CustomActionData property and get the DIR property from it inside your VBScript.
It is not within our support boundaries to assist in debugging custom actions. A simpler way to achieve the same functionality that doesn't require any VBScript knowledge is described in this how to from our user guide.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: Hiding the cmd window

Hi Mihai,

I have tested your sample. In the sample project, the bat file is not getting executed and not creating the output.txt file under D:\ folder location. When I have executed the vbscript separately, its creating the output file successfully.

Any other suggestion?

Regards
Sony
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Hiding the cmd window

Hello,
I have tested your sample. In the sample project, the bat file is not getting executed and not creating the output.txt file under D:\ folder location. When I have executed the vbscript separately, its creating the output file successfully.
The VBScript cannot run separately because it is using a Session object that is only available when attached as a custom action. I have tested the same sample on 3 different machines(XP and Vista) and it works fine.
Any other suggestion?
A simpler way to achieve the same functionality is described in this how to from our user guide.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sony
Posts: 134
Joined: Wed Apr 07, 2010 9:55 am

Re: Hiding the cmd window

Hi Mihai,
A simpler way to achieve the same functionality is described in this how to from our user guide.
This suggestion worked for me!! Thank alot for your time and suggestions.

Regards
Sony
phlow666
Posts: 144
Joined: Thu Jan 27, 2011 8:10 am
Location: Germany

Re: Hiding the cmd window

Hello,
I tried the following settings, but this action will not be executed.
CustAct.PNG
CustAct.PNG (20.12 KiB) Viewed 7885 times
What is the error?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Hiding the cmd window

Hi,

Here is a thread that clarifies this.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”