jarby Posted September 28, 2012 Posted September 28, 2012 Hi guys may i ask if you can help me convert this script to auto it ; <AUT2EXE VERSION: 3.2.2.0> #NoTrayIcon 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 Err.Clear '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\" else if checkOSArch = "x86" Then 'Wscript.Echo "The OS Architecture is 32 bit" regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\AdventNet\DesktopCentral\DCAgent\" else '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 #NoTrayIcon 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)
hannes08 Posted September 28, 2012 Posted September 28, 2012 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 (3.3.8.1 is current stable) and read the helpfile. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
FireFox Posted September 28, 2012 Posted September 28, 2012 Hi, Try this : #NoTrayIcon 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" Else If $sCheckOSArchRead = "x86" Then MsgBox(64, "", "The OS Architecture is 32 bit") $sRegKey = "HKEY_LOCAL_MACHINESOFTWAREAdventNetDesktopCentralDCAgent" Else MsgBox(64, "", "The OS Architecture is 64 bit") $sRegKey = "HKEY_LOCAL_MACHINESOFTWAREWow6432NodeAdventNetDesktopCentralDCAgent" EndIf EndIf 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now