Sign in to follow this  
Followers 0
McGyver

VBS conversion to AU3

2 posts in this topic

I am trying to convert a VBS script for remote assistance to AU# and am having a problem getting the variable for the computer name to work correctly. Any assistance is appreciated.

The original code is as follows:

'start

set shell = createobject("wscript.shell")

dim strComputerName

strComputerName=WScript.Arguments.Item(0)

shell.run "hcp://CN=Microsoft%20Corporation,L=Redmond,S=Washington,C=US/Remote%20Assistance/Escalation/Unsolicited/Unsolicitedrcui.htm"

shell.AppActivate("Help and Support Center")

wscript.sleep 2000

shell.sendkeys "{TAB 9}"

shell.sendkeys strComputerName

wscript.sleep 500

shell.sendkeys "%c"

'end

My AU3 is :

#include <WindowsConstants.au3>

Local $machine

$machine = ObjGet ("WScript.Arguments.Item(0)")

If @OSVersion = "WIN_XP" Then

;Then c:\windows\explorer.exe "hcp://CN=Microsoft Corporation,L=Redmond,S=Washington,C=US/Remote Assistance/Escalation/Unsolicited/Unsolicitedrcui.htm"

Run(@ComSpec & " /c " & 'explorer.exe' & "hcp://CN=Microsoft Corporation,L=Redmond,S=Washington,C=US/Remote Assistance/Escalation/Unsolicited/Unsolicitedrcui.htm","",@SW_HIDE)

ElseIf @OSVersion = "WIN_7" Then

MsgBox (4096, $machine,"")

Run(@ComSpec & " /c " & 'C:\Windows\system32\msra.exe ' & "/offerra","",@SW_HIDE)

Endif

Share this post


Link to post
Share on other sites



If you need a command line argument you can use $CmdLine[] array. In the Help File this is found under Using AutoIt --> Running Scripts.

So it would be something like $machine = $CmdLine[1]

Share this post


Link to post
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
Sign in to follow this  
Followers 0