Jump to content

Search the Community

Showing results for tags 'vbscript'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 21 results

  1. Hello, I am new members. Help me please. I want vbs convert to au3 . This vbs code : 'deneme Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem") strOSArch = GetObject("winmgmts:root\cimv2:Win32_OperatingSystem=@").OSArchitecture Set objNetwork = CreateObject("Wscript.Network") Set wshShell = CreateObject( "WScript.Shell" ) strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" ) Set oShell = WScript.CreateObject("WScript.Shell") proc_arch = oShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%") Set oEnv = oShell.Environment("SYSTEM") strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colMB = objWMIService.ExecQuery("Select * from Win32_BaseBoard") Set colCSes = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") Set colProcessors = objWMIService.ExecQuery("Select * from Win32_Processor") Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItemsx = objWMIService.ExecQuery( _ "SELECT * FROM Win32_VideoController",,48) '------------------------------------------------------------------- Set obj = GetObject("winmgmts:").InstancesOf("Win32_PhysicalMemory") i = 1 For Each obj2 In obj memTmp1 = obj2.capacity / 1024 / 1024 TotalRam = TotalRam + memTmp1 i = i +1 Next '-------------------------------------------------------------------- Dim objWMIService : Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") Set colItems = objWMIService.ExecQuery("Select Architecture from Win32_Processor") For Each objItem in colItems if objItem.Architecture = 0 then strArchitecture = "x86" end if if objItem.Architecture = 9 then strArchitecture = "x64" end if next '-------------------------------------------------------------------- strComputer = "." ' Local computer strMemory = "" i = 1 set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory") For Each objItem In colItems if strMemory <> "" then strMemory = strMemory & vbcrlf strMemory = strMemory & "Bank" & i & " : " & (objItem.Capacity /1024 /1024) & " Mb" i = i + 1 Next installedModules = i - 1 Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemoryArray") For Each objItem in colItems totalSlots = objItem.MemoryDevices Next '---------------------------------------------------------------------- Set objWMISvc = GetObject( "winmgmts:\\.\root\cimv2" ) Set colItems = objWMISvc.ExecQuery( "Select * from Win32_ComputerSystem" ) For Each objItem in colItems strComputerDomain = objItem.Domain Next for each System in SystemSet For Each objItem in colItemsx For Each objProcessor in colProcessors For Each bbType In colMB MbVendor = bbType.Manufacturer MbModel = bbType.Product MsgBox "İşletim Sistemi : " & System.Caption & vbNewLine & _ "İşletim Sistemi Versionu : " & + System.Version & vbNewLine & _ "Windows Mimari Yapısı: " & strOSArch & vbNewLine & _ "Kullanıcı isminiz: " & objNetwork.UserName & vbNewLine & _ "Bilgisayar ismi: " & strComputerName & vbNewLine & _ "Çalışma Grubu: " & strComputerDomain & vbNewLine & _ "--------------------------------------" & vbNewLine & _ "Anakart: " & MbVendor & " " & "[" & MbModel & "]" & vbNewLine & _ "--------------------------------------" & vbNewLine & _ "Grafik Kartı: " & objItem.Caption & vbNewLine & _ "Driver Version: " & objItem.DriverVersion & vbNewLine & _ "--------------------------------------" & vbNewLine & _ "İşlemci Üreticisi: " & objProcessor.Manufacturer & vbNewLine & _ "İşlemci İsmi: " & objProcessor.Name & vbNewLine & _ "CPU Mimarisi: " & strArchitecture & vbNewLine & _ "İşlemci Çekirdek sayısı: " & oEnv("NUMBER_OF_PROCESSORS") & vbNewLine & _ "--------------------------------------" & vbNewLine & _ "Toplam RAM: " & TotalRam & " MB" & vbNewLine & _ "Toplam Slot: " & totalSlots & vbNewLine & _ "Boş Slot: " & (totalSlots - installedModules) & vbNewLine & _ "Ramlerin bulunduğu slotlar:" & vbcrlf & strMemory,0,"deneme" Next Next Next Next please help me , thanks.
  2. I'm trying to add a bit of functionality to the FastStone File Rename dialog. I can access every control that I need to except the one that contains the files to be renamed. If I do some exploring in a vbScript shell I get :c = "TTntTreeView.UnicodeClass1" :?aut.ControlTreeView(win,"",c,"GetItemCount","","") 5 You can see that the treeview control reports having five items, which is the number displayed. If I manually select (mouse) item #3 I can see the result by :?aut.ControlTreeView(win,"",c,"GetSelected","1","") #3 But I do not know how to get the text for the selected item. If "#3" is the item reference then I should be able to :?aut.ControlTreeView(win,"",c,"GetText","1","#3") or :?aut.ControlTreeView(win,"",c,"GetText","1","#3") if I go strictly by the help file, but it returns nothing. :?aut.ControlTreeView(win,"",c,"Exists","","3") 1 So it appears that item 3 exists, but :?aut.ControlTreeView(win,"",c,"GetText","","3") does not have any text??? :?aut.ControlTreeView(win,"",c,"Exists","","9") 1 and it also appears item 9 exists (it does not) :?aut.ControlTreeView(win,"",c,"Select","","") 1 causes the first item to be selected, as does :?aut.ControlTreeView(win,"",c,"Select","","3") 1 Here is the output from the Window Info tool >>>> Window <<<< Title: Batch Image Convert / Rename Class: TBatchConvert Position: 501, 83 Size: 760, 520 Style: 0x16CD0000 ExStyle: 0x00010100 Handle: 0x0000000001950796 >>>> Control <<<< Class: TTntTreeView.UnicodeClass Instance: 1 ClassnameNN: TTntTreeView.UnicodeClass1 Name: Advanced (Class): [CLASS:TTntTreeView.UnicodeClass; INSTANCE:1] ID: 37030040 Text: Position: 354, 79 Size: 378, 188 ControlClick Coords: 108, 86 Style: 0x54010039 ExStyle: 0x00000200 Handle: 0x0000000002350898 >>>> Mouse <<<< Position: 970, 279 Cursor ID: 0 Color: 0xE1E1E1 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Batch Rename ... D:\temp\picsave\ Images + Videos (*.jpg;*.jpe;*.jpeg;*.bmp;*.gif;*.tif;*.tiff;*.cur;*.ico;*.png;*.pcx;*.jp2;*.j2k;*.tga;*.ppm;*.wmf;*.psd;*.crw;*.nef;*.cr2;*.orf;*.raf;*.dng;*.mrw;*.pef;*.srf;*.arw;*.rw2;*.x3f;*.sr2;*.srw;*.nrw;*.rwl;*.eps;*.avi;*.mpeg;*.mpg;*.wmv;*.mov;*.mp4;*.mts;*.mkv;*.m4v) Search and Replace Use Filename Template No Sort Clear Remove Add All Add Preview Close Rename No Change ?
  3. I'm struggling to launch a VBS file via autoit using RunWait. Due to the nature of the deployment tool I am using for said script, I only know that the .vbs files will be in the same directory as my AutoIt-generated .exe, but not what that path will be. The path will look something like this: c:\programdata\vendor\lots\of\folders\randomnumber This is generated during deployment and I have no way of predicting the path - therefore, I am not sure how to call back to "same directory" in order to successfully launch the .vbs. This line is as close as I have gotten - this fires off the cmd window, but it closes immediately with out information, and the .vbs is not launched. RunWait (@ComSpec & " /c" & 'cscript.exe WORKPLEASE.vbs ALL /Q /NoCancel') I thought /c might be the problem, but leaving out the /c element causes me not to even see the momentary CMD window flash by. Any help will be greatly appreciated, and thanks in advance.
  4. I am maintaining all the reusable code in a separate file as library.au3. In that file I have referenced some dependent files using fileinstall, so that they will be extracted when necessary. Problem is, if I use a function in the library.au3 in another script which doesn't require this dependent file, as I am including the whole file using include tag, it is embedding that file also. Is there any way to exclude that.
  5. I recently tried to use ControlClick method to send a mouse click command to a button in a application, but I noticed that it is not working when I give first parameter as a window handle (HWND). But, when I give class name or window title, it works fine. I used AutoItX3 and VBScript. Following are the commands I tried in VBScript: Dim WINAPI: Set WINAPI = WScript.CreateObject("WinAPIWrapper.WINAPI") Dim AutoItX3: Set AutoItX3 = WScript.CreateObject("AutoItX3.Control") Dim WindowHandle: WindowHandle = WINAPI.WinAPI_FindWindow("my window title", "my window class") 'Window handle obtains fine by my wrapper function 'Above window handle is obtained as a hexadecimal string. (I.E. - 0x00000000) I tried it like: WScript.Echo CStr(AutoItX3.ControlClick(WindowHandle, "", "[CLASS:Button; INSTANCE:1]")) // DOES NOT WORK WScript.Echo CStr(AutoItX3.ControlClick(CLng("&h" + Replace(WindowHandle, "0x", "")), "", "[CLASS:Button; INSTANCE:1]")) // DOES NOT WORK WScript.Echo CStr(AutoItX3.ControlClick(000000, "", "[CLASS:Button; INSTANCE:1]")) // DOES NOT WORK WScript.Echo CStr(AutoItX3.ControlClick(0x00000000, "", "[CLASS:Button; INSTANCE:1]")) // DOES NOT WORK Only following commands work: WScript.Echo CStr(AutoItX3.ControlClick("[CLASS:my window class]", "", "[CLASS:Button; INSTANCE:1]")) // WORKS FINE WScript.Echo CStr(AutoItX3.ControlClick("My window title", "", "[CLASS:Button; INSTANCE:1]")) // WORKS FINE If any of your suggestions don't work, I will have to write a wrapper function myself to send mouse click commands. I chosen AutoIt V3 because it is good specially when comes to send keystrokes to applications. Please tell me why this won't work when I give window handle as first parameter. Thanks in advance.
  6. i have a vbscript that called an autoit exe file and autoit exe file will return value to vbscript. vbscriptto call the exe and create array: Set objShell = CreateObject("WScript.Shell") objShell.Run ( "C:\Datalog\test.exe") Dim intCtr: intCtr=-1 Dim tempArr() Set UID = CreateObject("System.Collections.ArrayList") CurLot = "" For Each filelog in FileList LogFile = Split(filelog, "~")(1) Set otf = fso.OpenTextFile("C:\Datalog\" & LogFile, 1) intCtr=intCtr+1 sFile = Split(LogFile, "_") CurStep = sFile(4) Redim preserve tempArr(intCtr) tempArr(intCtr)=CurStep next autoit: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <Array.au3> Global $Count = 10 Global $CheckBox[$Count] global $array1[1] $hGUI = GUICreate("Test", 500, 500) Global $array_Pstep[10] = ["P1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10"] $Spacing = 24 For $i = 0 To UBound($array_Pstep) - 1 $CheckBox[$i] = GUICtrlCreateCheckbox($array_Pstep[$i], 80, $Spacing + (20 * $i), 65, 17) Next $submit = GUICtrlCreateButton("submit",10, 300, 80, 30) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg case $submit _ArrayDisplay($array1) Case Else For $i = 0 To $Count - 1 If $CheckBox[$i] = $Msg Then MsgBox("", "Pressed", $i) _ArrayAdd($array1, $array_Pstep[$i]) ExitLoop EndIf Next EndSwitch WEnd i need to compare the array in vbscript and array return by autoit. but i dont know how to pass the value of array in autoit to vbscript. Please help.
  7. Hello Trying to add below code in my main script but this is not functioning can you advise what else i need to do? Dim fn As String Const myDir As String = "C:\AR\" '<- alter here Const newFolder As String = "C:\AR1\" '<- alter here fn = Dir(myDir & "AR_*.xlsm") Do While fn <> "" FileCopy myDir & fn, newFolder & Replace(fn, "AR", "AI") fn = Dir Loop
  8. Is there any change that I can return a code for success or not success in my script? I have a script that look in a SQL db and write to the registry. I want to return some kind of a control, because I will call my script *.exe from VBScript. _Main() Func _Main() Local $sConnectionString = 'DRIVER={' & $sDriver & '};SERVER=' & $sServer & ';DATABASE=' & $sDatabase & ';UID=' & $sUser & ';PWD=' & $sPassword & ';', $sQUERY, $oRecordset, $aRecordsetArray, $aRecordset_inner Local $oConnection = _ADO_Connection_Create() _ADO_Connection_OpenConString($oConnection, $sConnectionString) If @error Then Return SetError(@error, @extended, $ADO_RET_FAILURE) $sQUERY = "Select Shipdate from " & $sTableName & " where ComputerName = '" & @ComputerName & "'" $oRecordset = _ADO_Execute($oConnection, $sQUERY) $aRecordsetArray = _ADO_Recordset_ToArray($oRecordset, False) $aRecordset_inner = _ADO_RecordsetArray_GetContent($aRecordsetArray) RegWrite("HKEY_CURRENT_USER\SOFTWARE\ComputerInfo", "Shipdate", "REG_SZ", $aRecordset_inner[0][0]) EndFunc
  9. crash report

    how do i get the crash report of any application and any running script?????
  10. time difference

    respected sir, how could I calculate the time difference using auto IT function ?
  11. AU3_PixelSearch

    I am trying to use pixel search using VBA but it is returning Bad DLL calling convention error. I don't know where this is going wrong Hoping that you may be able to help. Here's my code: Public Function PixelSearch(lX1 As Long, lY1 As Long, lX2 As Long, lY2 As Long, lColor As Long, Optional lVariations As Long = 0, Optional lStep As Long = 1) As String Dim Rect As LPRECT, szResult As String, pos As Integer 'szResult = String(255, vbNullChar) Rect.X = lX1 Rect.Y = lY1 Rect.Width = lX2 Rect.Height = lY2 'Private Declare Sub AU3_PixelSearch Lib "AutoItX3.dll" (ByRef LRECT As LPRECT, ByVal nColor As Long, ByVal nVariations As Long, ByVal nStep As Long, ByVal szResult As LongPtr, ByVal nBufSize As Long) AU3_PixelSearch Rect, lColor, lVariations, lStep, StrPtr(szResult), Len(szResult) If pos > 0 Then szResult = Left(szResult, pos - 1) End If PixelSearch = Trim(szResult) End Function
  12. Who could help me to convert this vbs to AuoIT? on error resume next dim oCPAppletMgr 'Control Applet manager object. dim oClientAction 'Individual client action. dim oClientActions 'A collection of client actions. 'Get the Control Panel manager object. set oCPAppletMgr=CreateObject("CPApplet.CPAppletMgr") if err.number <> 0 then Wscript.echo "Couldn't create control panel application manager" WScript.Quit end if 'Get a collection of actions. set oClientActions=oCPAppletMgr.GetClientActions if err.number<>0 then wscript.echo "Couldn't get the client actions" set oCPAppletMgr=nothing WScript.Quit end if 'Display each client action name and perform it. For Each oClientAction In oClientActions if oClientAction.Name = "Request & Evaluate Machine Policy" then wscript.echo "Performing action " + oClientAction.Name oClientAction.PerformAction end if if oClientAction.Name = "Software Metering Usage Report Cycle" then wscript.echo "Performing action " + oClientAction.Name oClientAction.PerformAction end if if oClientAction.Name = "Updates Source Scan Cycle" then wscript.echo "Performing action " + oClientAction.Name oClientAction.PerformAction end if if oClientAction.Name = "Request & Evaluate User Policy" then wscript.echo "Performing action " + oClientAction.Name oClientAction.PerformAction end if if oClientAction.Name = "Hardware Inventory Collection Cycle" then wscript.echo "Performing action " + oClientAction.Name oClientAction.PerformAction end if if oClientAction.Name = "Software Inventory Collection Cycle" then wscript.echo "Performing action " + oClientAction.Name oClientAction.PerformAction end if if oClientAction.Name = "Application Global Evaluation Task" then wscript.echo "Performing action " + oClientAction.Name oClientAction.PerformAction end if if oClientAction.Name = "Software Updates Assignments Evaluation Cycle" then wscript.echo "Performing action " + oClientAction.Name oClientAction.PerformAction end if if oClientAction.Name = "Discovery Data Collection Cycle" then wscript.echo "Performing action " + oClientAction.Name oClientAction.PerformAction end if if oClientAction.Name = "MSI Product Source Update Cycle" then wscript.echo "Performing action " + oClientAction.Name oClientAction.PerformAction end if if oClientAction.Name = "Standard File Collection Cycle" then wscript.echo "Performing action " + oClientAction.Name oClientAction.PerformAction end if next set oClientActions=nothing set oCPAppletMgr=nothing
  13. I need a function where it will get a string as parameter which will of syntax in VBScript like below a&"asdasd"&asd&"as&dsf&gdf"&fs Here in the above string what ever in the quotes we shouldn't replace them as they are taken as normal strings.And if the ampersand(&) if outside the quotes then we need to replace them with plus(+).And the normal words which are outside the quotes we need to append them with $. So the output will be as below. $a+"asdasd"+$asd+"as&dsf&gdf"+$fs. Can you please help me on this.I'm unable to differentiate with & in the quotes and outside the quotes. Don't know how to check whether a string is in quotes or not.
  14. Good day!!! In the process of the script vbs I use as an information window function ToolTip, example: Set objAutoItTT = WScript.CreateObject("AutoItX3.Control") strTT = "Update Adress Book. " & VbLf & "#############################" & VbLf objAutoItTT.ToolTip strTT & "Preparation, checks." , 50, 50In the process of writing the script used AutoitX3.dll library version 3.3.8.1 Everything worked great. After upgrading to version 3.3.14.2 of the library, the script works, but the windows are not displayed tooltip. Help me please!!!
  15. With Hotkeys, the file is .ahk and the code inside is this: ^w:: Send, This is some text Return What is the equivalent in AutoIt Additionally how to launch a program with a hotkey? #n:: Run Notepad returnAny VERY simple way to do this with AutoIt? Thanks,
  16. Hello, i would like to ask for some help on how to write something like this in Autoit If CType(update, WUApiLib.IUpdate3).BrowseOnly = True Then opt_updates = opt_updates + 1 Else imp_updates = imp_updates + 1 End IfI`m trying to find Important Windows updates only, but for some reason this code: $ColNeeded = $objSearcher.Search("BrowseOnly=0 and IsInstalled=0 and IsHidden=0") $update = $ColNeeded.Updates.Item($i - 1)returns all update (important and optional) as important (even though BrowseOnly=0). I think i`m missing a reference to WUApi.DLL in my code but i couldn`t find anything else to help me :/ If someone could help me either by providing a Autoit alternative to CType(update, WUApiLib.IUpdate3).BrowseOnly = Trueor another way to find only important Windows updates i would be very grateful. Thank you
  17. Hi, I have a .dll (custom specific: ICE.dll) file created using vb.net and there is a function inside: when i read the api spec, got the following information: request you to provide the code to open/close. tried dllcall, dllopen, dllclose but it doesnt work. any help with code will be really appreciated. Thanks a lot. Best regards, Karthi Service name: ICE21 Syntax: byte ICE21 (byte status) Parameters (in): status (0-Open, 1- Close) Return value: byte 0 if everything was OK. Description: The function opens/closes the ICE plugin
  18. Hello I'm not so familiar with the scriptcontrol, can you help me with this little problem? Why is this script not working correctly? Global $oVbs = ObjCreate('MSScriptControl.ScriptControl') With $ovbs .Language = "VBScript" .AllowUI = True .AddCode('Class Test:Public Function X:X = 123:End Function:Set C = New Test') .AddCode('MsgBox IsObject(C)'); should be true, no? EndWith MsgBox(0,'',$oVbs.Eval('C').X)Also: how do I add code to the global module? Thanks, TheAutomator
  19. This is a script I did ages go to fix problems when you have a lot of DPs on ConfigMgr 2012 and some of the packages are in a stuck or failed state. It's a massive pain to try and fix it manually. ' **************************************************************************** ' ' Purpose: Checks all packages assigned to a DP and redistributes any with errors. ' ' Usage: cscript.exe CM2012_DP_Redist.vbs ' ' Version: 1.0.0 ' ' History: ' 1.0.0 20-Nov-2013 - Jonathan Bennett ' First version. ' ' **************************************************************************** ' **************************************************************************** ' Global constant and variable declarations ' **************************************************************************** Option Explicit ' CHANGEABLE VARIABLES ' The name of the CAS/Primary site server Public Const CASServerName = "CASSERVERNAME" ' Which DP to refresh packages for - leave this blank to check ALL DPs Public Const DPServerName = "DPSERVERNAME" ' END OF CHANGABLE VARIABLES Public Const wbemFlagReturnImmediately = 16 Public Const wbemFlagForwardOnly = 32 Dim oSWbemServices ' **************************************************************************** ' End declarations ' **************************************************************************** ' **************************************************************************** ' Main routine ' **************************************************************************** ' Connect to CM 2012 (CAS) If ConnectServer(CASServerName) = False Then WScript.Echo "Unable to connect to server." WScript.Quit 1 End If ' Find all packages with a bad status Dim queryString Dim dpStatuses, dpStatus, serverName, packageID, packageDPs, packageDP, nalPath If DPServerName = "" Then queryString = "SELECT Name,PackageID,MessageState FROM SMS_DistributionDPStatus WHERE MessageState > 2" Else queryString = "SELECT Name,PackageID,MessageState FROM SMS_DistributionDPStatus WHERE Name LIKE '%" & DPServerName & "%' AND MessageState > 2" End If Set dpStatuses = oSWbemServices.ExecQuery(queryString,, wbemFlagForwardOnly+wbemFlagReturnImmediately) For Each dpStatus in dpStatuses serverName = UCase(dpStatus.Name) packageID = dpStatus.PackageID queryString = "SELECT * FROM SMS_DistributionPoint WHERE PackageID = '" & packageID & "'" Set packageDPs = oSWbemServices.ExecQuery(queryString,, wbemFlagForwardOnly+wbemFlagReturnImmediately) For Each packageDP in packageDPs nalPath = UCase(packageDP.ServerNalPath) If InStr(1, nalPath, serverName) > 0 Then WScript.Echo "Redistributing " & packageID & " on " & serverName & "..." packageDP.RefreshNow = True On Error Resume Next packageDP.Put_ On Error Goto 0 End If Next Next WScript.Quit 0 ' **************************************************************************** ' Functions ' **************************************************************************** Function ConnectServer(ByVal serverName) If serverName = "" Then serverName = "." Dim oSWbemLocator : Set oSWbemLocator = CreateObject("WbemScripting.SWbemLocator") On Error Resume Next Set oSWbemServices = oSWbemLocator.ConnectServer(serverName, "root\sms") If Err.Number <> 0 Then ConnectServer = False Exit Function End If On Error Goto 0 Dim ProviderLoc : Set ProviderLoc = oSWbemServices.ExecQuery("Select * FROM SMS_ProviderLocation WHERE ProviderForLocalSite='True'") Dim Location For Each Location In ProviderLoc Set oSWbemServices = oSWbemLocator.ConnectServer(Location.Machine, "root\sms\site_" + Location.SiteCode) Exit For Next ConnectServer = True End Function More details on this blog post: https://www.autoitconsulting.com/site/deployment/mass-redistribute-packages-configmgr-2012/
  20. My objective was to translate to VBScript into an au3 file so I can code in autoit. I have most of it done however There seems to be certain COM events that autoit does not seem to catch. Mostly the session_SessionStatusChanged and session_SessionStatusLoginError that do not seem to work. When I run it in VBScript it works fine. Any ideas on what I might be doing wrong? I also attached the VBS file I was copying from. ;~ 'SessionStatusCode enum Const $SessionStatusCode_Disconnected = 0 Const $SessionStatusCode_Connecting = 1 Const $SessionStatusCode_TradingSessionRequested = 2 Const $SessionStatusCode_Connected = 3 Const $SessionStatusCode_Disconnecting = 5 Const $SessionStatusCode_SessionLost = 6 Const $SessionStatusCode_PriceSessionReconnecting = 7 Const $SessionStatusCode_Unknown = 8 $username = "" $password = "" If $username = "" Or $password = "" Then MsgBox(16, "Error", "Please provide username and password to the appropriate variables") Exit EndIf $LastStatus = "" $LastError = "" MsgBox(0, "", "Login and logout") $core = ObjCreate("fxcore2.com.Transport") $session = $core.createSession() $Event = ObjEvent($session, "session_") MsgBox(0, "", "Log in...") $session.login($username, $password, "http://www.fxcorporate.com/Hosts.jsp", "Demo") While $LastStatus <> $SessionStatusCode_Connected And $LastError = "" Sleep(50) WEnd MsgBox(0, "", "Log out...") $session.logout While $LastStatus <> $SessionStatusCode_Disconnected Sleep(50) WEnd MsgBox(0, "", "Session status:" & GetStatusName($LastStatus)) $session = "" MsgBox(0, "", "Done !") Func session_SessionStatusChanged($status) MsgBox(0, "", "Status changed: " & GetStatusName($status)) $LastStatus = $status EndFunc ;==>session_SessionStatusChanged Func session_SessionStatusLoginError($err) MsgBox(16, "Error", "Error occured: " & $err) $LastError = "err" EndFunc ;==>session_SessionStatusLoginError Func GetStatusName($status) Switch $status Case $SessionStatusCode_Connected $varGetStatusName = "connected" Case $SessionStatusCode_Disconnected $varGetStatusName = "disconnected" Case $SessionStatusCode_Connecting $varGetStatusName = "connecting" Case $SessionStatusCode_TradingSessionRequested $varGetStatusName = "trading session requested" Case $SessionStatusCode_Disconnecting $varGetStatusName = "disconnecting" Case $SessionStatusCode_SessionLost $varGetStatusName = "session lost" Case $SessionStatusCode_PriceSessionReconnecting $varGetStatusName = "price session reconnecting" Case $SessionStatusCode_Unknown $varGetStatusName = "unknown" Case Else $varGetStatusName = $status EndSwitch Return $varGetStatusName EndFunc ;==>GetStatusName login.vbs
  21. $VBS = ObjCreate("ScriptControl") $VBS.language = "VBScript" Global Const $Nothing = $VBS.eval("Nothing") $VBS = $Nothing Can someone say me what i'm doing wrong here? ERROR: "test.au3" (2) : ==> Variable must be of type "Object".: $VBS.language = "VBScript" $VBS^ ERROR ->19:22:34 AutoIt3.exe ended.rc:1 >Exit code: 1 Time: 0.462 Thanks. TheAutomator.
×