Jump to content
Sign in to follow this  

Converting vbs to autoit

Recommended Posts

Hi guys may i ask if you can help me convert this script to auto it



RunWait("Set WshShell = WScript.CreateObject("WScript.Shell")

checkOSArch= WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")

'Wscript.Echo checkOSArch

if Err Then


'WScript.Echo "The OS Architecture is unable to find ,so it was assumed to be 32 bit"

regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\AdventNet\DesktopCentral\DCAgent\"


if checkOSArch = "x86" Then

'Wscript.Echo "The OS Architecture is 32 bit"

regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\AdventNet\DesktopCentral\DCAgent\"


'Wscript.Echo "The OS Architecture is 64 bit"

regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\AdventNet\DesktopCentral\DCAgent\"

End IF

end if

regkey=regkey & "DCAgentInstallDir"

'Wscript.Echo regkey

AgentInsallDir = WshShell.RegRead(regkey)

'Wscript.Echo AgentInsallDir

swmeterdir = "bin\dcswmeter.exe"

'Wscript.Echo swmeterdir

wshShell.CurrentDirectory = AgentInsallDir

wshshell.run swmeterdir&" -s"&" ET_CUR_SUM"

set wshshell = nothing

", "", @SW_HIDE)

I tried to use also this script to run it silently but cmd will always pop up.

I had created a batch file to run like this

echo off

start c:\sw-meter-Instant-Report1.vbs

and load it in an auto it script


filecopy("\\hpmds2\Scripts\Software Metering script\sw-meter-Instant-Report1.vbs", "c:\")

filecopy("\\hpmds2\Scripts\Software Metering script\sw.bat", "c:\")

RunWait("c:\sw.bat", "", @SW_HIDE)

Share this post

Link to post
Share on other sites

You can use the @OSArch makro in AutoIt to retrieve the Architecture of the current OS.

Use RegRead() to get registry keys.

My advice: Install a newer version of AutoIt ( is current stable) and read the helpfile.

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post

Link to post
Share on other sites


Try this :


Global $sRegKey, $sCheckOSArchRead, $sAgentInsallDir, $swmeterdir

$sCheckOSArchRead = RegRead("HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironmentPROCESSOR_ARCHITECTURE", "checkOSArch")

If @error Then
MsgBox(16, "", "The OS Architecture is unable to find ,so it was assumed to be 32 bit")

$sRegKey = "HKEY_LOCAL_MACHINESOFTWAREAdventNetDesktopCentralDCAgent"
If $sCheckOSArchRead = "x86" Then
MsgBox(64, "", "The OS Architecture is 32 bit")
$sRegKey = "HKEY_LOCAL_MACHINESOFTWAREAdventNetDesktopCentralDCAgent"
MsgBox(64, "", "The OS Architecture is 64 bit")
$sRegKey = "HKEY_LOCAL_MACHINESOFTWAREWow6432NodeAdventNetDesktopCentralDCAgent"

MsgBox(64, "", $sRegKey & "DCAgentInstallDir")

$sAgentInsallDir = RegRead($sRegKey, "DCAgentInstallDir")

MsgBox(64, "", $sAgentInsallDir)

$swmeterdir = "bindcswmeter.exe"

MsgBox(64, "", $swmeterdir)

Run($swmeterdir & " -s" & " ET_CUR_SUM", $sAgentInsallDir, @SW_HIDE)

And edit the script with hannes08's advices.

Br, FireFox.


OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...