Jump to content

How to send hidden variables to a VB script ?


Recommended Posts

Hi all

In an AutoIT script, I have to execute a VB script (with the RunWait command : RunWait("C:\WINDOWS\system32\wscript.exe " & $ScriptName,$PathToScriptFolder,@SW_HIDE) ).

This VB script has to connect to a database using a password.

But I don't want this password to be wrote in the VB script (because he can be visible by anyone editing the VB script).

I would rather like to write it in the AutoIT script and then to send it to the VB script in a confidential way.

Do you have a solution (or a begining of solution!) for me ?

Thanks !

Link to comment
Share on other sites

But I don't want this password to be wrote in the VB script (because he can be visible by anyone editing the VB script).

FYI, There is a VBS encoder from MS that can encode the script into something that others cannot read.

Pass arguments to the VBS file and then process the arguments within the VBS file

Au3 snip of code

$switches = '"My password here"'
RunWait('"C:\WINDOWS\system32\wscript.exe" "' & $ScriptName & '" ' & $switches, $PathToScriptFolder, @SW_HIDE)

VBS snip of code

Set oArgs = WScript.Arguments
If oArgs.Count() > 0 Then
    Password = Args.item(0)
End If

:)

Link to comment
Share on other sites

FYI, There is a VBS encoder from MS that can encode the script into something that others cannot read.

Pass arguments to the VBS file and then process the arguments within the VBS file

Au3 snip of code

$switches = '"My password here"'
RunWait('"C:\WINDOWS\system32\wscript.exe" "' & $ScriptName & '" ' & $switches, $PathToScriptFolder, @SW_HIDE)

VBS snip of code

Set oArgs = WScript.Arguments
If oArgs.Count() > 0 Then
    Password = Args.item(0)
End If

:)

Great !

Thank ya very much MHz ! ;)

This solves my problem.

See you

ps : I just bring a little correction to your VB snip of code :

Set oArgs = WScript.Arguments
If oArgs.Count() > 0 Then
    Password = oArgs.item(0)      'Here : oArgs instead of Args
End If
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...