Jump to content

How can I pass a variable back to a vbscript file?


 Share

Recommended Posts

So I'm running a vbscript file in BartPE (a limited 32-bit environment, for those that dont know) that requires a password. Obviously, vbscript doesn't allow for masking passwords, and the "normal" methods for trying don't work in BartPE. So my question is, is there a way to launch a AutoIt executable that will prompt for a password, then pass it back to the vbscript?

Thanks for any help guys.

Link to comment
Share on other sites

figure out how to HTA for bartPE :)

<html>
<head>
<title>Password Box Demo in HTA</title>

<HTA:APPLICATION 
     ID="oHTA"
     APPLICATIONNAME="Passwordbox"
     SCROLL="NO"
     SINGLEINSTANCE="NO"
     WINDOWSTATE="maximize"
>
</head>

<script Language="VBScript">

Sub runscript()
MsgBox "Your password :" & PasswordArea.Value, 0, ""
End Sub

</SCRIPT>
<body>
<input type="text" name="BasicTextBox" size="50" title="Username"><BR>
<input type="password" name="PasswordArea" size="30" title="passwordbox">
<input id=runbutton  class="button" type="button" value="Run Button" name="run_button"  onclick="RunScript">
</body>
</html>

save this as run.hta and see if this helps..

(you need to add the MS HTA Package to your builder)

have a nice day

Edited by lordofthestrings
Link to comment
Share on other sites

So I'm running a vbscript file in BartPE (a limited 32-bit environment, for those that dont know) that requires a password. Obviously, vbscript doesn't allow for masking passwords, and the "normal" methods for trying don't work in BartPE. So my question is, is there a way to launch a AutoIt executable that will prompt for a password, then pass it back to the vbscript?

Thanks for any help guys.

In AutoIt use an InputBox with the password flag

$Pass = InputBox("My App", "Please enter your password","","*")

Pass it to the clipboard

ClipPut($Pass)

Exit the script

When you open the VB script, read the password from the clipboard.

Have you looked at the possibility of just converting the vbs to AutoIt? That would make the whole process easier.

Edit:

$Pass = InputBox("My App", "Please enter your password","","*")
If $Pass Then
   ClipPut($Pass)
   ShellExecute(<Path> & "\Bart.vbs")
EndIf
Exit
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

The reason its not totally done in AutoIt is that I'd like to keep it as simple as possible so others in my group understand what is going on, without having to search for and/or understand AutoIt. However, I may be forced to do the whole thing in AutoIt, as I'm not sure I can grab clipboard contents via VBScript in Bart. Or I could go the HTA route, but damn do I hate (even limited) HTML coding.

:)

Thanks for your help, as usual guys. If anyone has any other suggestions, I'd love to hear em.

Link to comment
Share on other sites

Another options is to run your VBScript inline with your AutoIt code. Search the forum for examples of the use of the "ScriptControl" COM object and you'll be surprised at the doors that might open for you.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

You have other good options now from the smart people. This is kind of a brute-force method from one of the dimmer lights.

Compile the following in AutoIt as GetPass.exe:

; GetPass.au3 -- passes an input password out to the console
ConsoleWrite(InputBox("Password", "Password: ", "", "*"))

Run the following from a command prompt:

for /f %P in ('GetPass.exe') do (echo %P)

If you can do that from the CMD shell command line, you can do it from VB.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You guys never cease to amaze me with new and different ways to skin a cat.

there hasn't been any truly "NEW" code written in a long time. It's all just different approaches to old code and different applications for that code.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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...