Search the Community
Showing results for tags 'autoit'.
-
Hello Again! I previously stumbled upon a topic asking for maps datatype's instructions... I too wasn't sure what a map is until I tried it... So I am making this topic to help other newbies (and some oldbies) better understand the Maps datatype of AutoIt! Lets start! A Note for Readers The maps datatype is still in development and is currently in Alpha Stage (More Risky than Beta) and its unstable, so AutoIt can crash indefinably while using Maps! I can't guarantee if this will be implemented in stable versions, this is a fairly new thing to AutoIt coders & in my honest opinion I don't see any use for it Maps are the best datatype in AutoIt, Very Useful ... Not hurting anyone though . Also the maps datatype is DISABLED IN STABLE VERSIONS, So you need to install the latest beta version of AutoIt to make maps work . If you find any bugs while using a map, please report it in the Official Bug Tracker Introduction To Maps Maps are just like arrays, instead they use "keys" to access elements inside them... A key can be either a string or an integer (Other datatypes work too but they are converted to a integer [Equivalent to Int($vKey)] before assignment [Source]). Although Integers don't represent the order of elements in a map unlike in an array... Declaring Maps Its similar to declaring an Array: ; This is the only way to declare a map ; You must have a declarative keyword like Dim/Global/Local before the declaration unless the map is assigned a value from a functions return Local $mMap[] ; Don't insert any numbers or strings it! Simple, Isn't it? Using Maps Using maps is similar to arrays (again!): Local $mMap[] ; Lets declare our map first! ; Adding data to maps is easy... ; This is our key ; | ; v $mMap["Key"] = "Value" ; <--- And our value! ; A key is Case-Sensitive meaning "Key" is not same as "key"! $mMap["key"] = "value" ; Not the same as $mMap["Key"]! ; There are 2 different ways to access an element in a map $mMap["Key"] ; 1st Method $mMap.Key ; 2nd Method Enumerating Maps Its quite easy to enumerate through arrays but what about maps? how can I enumerate through them!? #include <MsgBoxConstants.au3> ; Lets create our map first Local $mMap[] ; Lets add some information to the map, feel free to modify & add new elements $mMap["Name"] = "Damon Harris" $mMap["Alias"] = "TheDcoder" $mMap["Gender"] = "Male" $mMap["Age"] = 14 $mMap["Location"] = "India" $aMapKeys = MapKeys($mMap) ; MapKeys function returns all the keys in the format of an array Local $sProfile = "Profile of " & $mMap["Name"] & ':' & @CRLF ; We will use this string later For $vKey In $aMapKeys ; We use this to get the keys in a map :) $sProfile &= @CRLF & $vKey & ': ' & $mMap[$vKey] ; Add some details to the profile string using our map! Next MsgBox($MB_ICONINFORMATION + $MB_OK, "Profile", $sProfile) ; Finally display the profile :) It is easy as always Multi-Dimensional Maps Now now... I know that you are a little confused that how can an multi-dimensional maps exist... Although I am not 100% sure if its called that but lets continue: #include <MsgBoxConstants.au3> ; Multi-Dimensional maps are just maps in a map Local $mMapOfMapsvilla[] ; This map will store an other map Local $mParkMap[] ; This Park map will be inserted in the Mapsvilla's map :P $mMapOfMapsvilla["Map Item 1"] = "Town Hall" $mMapOfMapsvilla["Map Item 2"] = "Police Station" $mMapOfMapsvilla["Map Item 3"] = "Shopping Mall" $mMapOfMapsvilla["Map Item 4"] = "Residential Area" $mMapOfMapsvilla["Map Item 5"] = "Park" $mParkMap["Map Item 1"] = "Cottan Candy Stand" $mParkMap["Map Item 2"] = "Public Toilet" $mParkMap["Map Item 3"] = "Woods" $mMapOfMapsvilla.Park = $mParkMap MsgBox($MB_OK, "Map Location", $mMapOfMapsvilla["Map Item 1"]) ; Will display Town Hall MsgBox($MB_OK, "Map Location", $mMapOfMapsvilla.Park["Map Item 1"]) ; Will display Cottan Candy Stand I am sure its easy for you to understand now Frequently Asked Questions (FAQs) & Their answers Q #1. Help! My code does not respond to anything (or) I get an "Variable subscript badly formatted" error on the line of declaration... A. DONT USE F5 or Go, Instead use Alt + F5 or Tools -> Beta Run in SciTE (Make sure that you have Beta installed) Q #2. Why are you using "m" in-front of every map variable? A. Best coding Practices: Names of Variables Q #3. What are "Elements" which you mention frequently??? A. This is a newbie question (I have no intention of insulting you ), so I guess you are new to programming. "Elements" are data slots inside a Map (or an Array), you can imagine elements as individual variable which are stored in a Map. You can access them using "keys", Please refer to "Introduction to Maps" section at the starting of this post Q #4. Are Maps faster than Arrays? A. You need to understand that Maps have different purpose than Arrays. Maps are designed to store data dynamically (like storing information for certain controlIDs of GUI) and Arrays are designed to store data in a order (for instance, Storing every character of a string in an element for easy access). If you still want to know then if Maps are faster, then the answer is maybe... Maps are *supposed* (I am not sure ) to be faster in addition of elements (while Arrays are painfully slow while adding or removing elements). Here (Post #24) is a benchmark (Thanks kealper! ) More FAQs coming soon! Feel free to ask a question in the mean while
-
Hi there, I'm new in AutoIt forms and using AutoIt to automate desktop application (able to automate the application normally but facing issue when I've to re-run the application twice within the same script...so need help in this please) here is the steps then followed by the issue in a brief : 1- run application . 2- do some actions (click menus,activate windows,set texts..) 3- close the application. 4- run the application again & access the same controls. 5- open the same windows again (like step 2) 6- perform some validations (by getting texts from some text boxes) 7- close the application again (and repeat 1-7 for 15 times in average ) The issue * all controls are accessible in the first run and actions done successfully on controls (for steps 1-3) BUT from the second run of the application from step-4 it's able to set focus only the main application window. Note: only unique properties used to while mapping the controls. Error that appear in the console : UIAWrappers.au3" (1673) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $x = Int($t[1] + ($t[3] / 2)) $x = Int($t[1] + (^ ERROR Simple spy code of one of the controls that has this strange issue(menubar&view menu Item): ;~ *** Standard code maintainable *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=XXX;controltype:=UIA_WindowControlTypeId;class:=WindowsForms10.Window.8.app") ;main app form xxx _UIA_setVar("oP2","Title:=menuStrip1;controltype:=UIA_MenuBarControlTypeId;class:=WindowsForms10.Window.8.app") ;menuStrip1 ;~ $oUIElement=_UIA_getObjectByFindAll("View.mainwindow", "title:=View;ControlType:=UIA_MenuItemControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=View;controltype:=UIA_MenuItemControlTypeId;class:=") ;ControlType:=UIA_MenuItemControlTypeId;classname:=") ;~ Actions split away from logical/technical definition above can come from configfiles ;~_UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") ;~_UIA_Action("oP2","highlight") _UIA_Action("oP2","setfocus") _UIA_action("oUIElement","highlight") ;~_UIA_action("oUIElement","click")
- 7 replies
-
- uiawrappers.au3
- simplespy
-
(and 3 more)
Tagged with:
-
I am using autoIt to automate some test cases. I need to right-click which opens a context menu and then select the 6th item in the context menu. I tried to use Send("{}"), but it doesn't choose the 6th item and chooses randomly. AutoIt Window Info shows only [CLASS:#32768] about the context menu. I found another solution in a forum - Local $putMsgHandle = WinGetHandle ( "[CLASS:#32768]" ) Local $putMsgMenu = _SendMessage ( $putMsgHandle , $MN_GETHMENU , 0 , 0 ) Local $putMsgRect = _GUICtrlMenu_GetItemRect ($putMsgHandle, $putMsgMenu, 6) ControlClick("[CLASS:#32768]", "", "", "left", 1, $putMsgRect[0], $putMsgRect[1]) This code works but sometimes it chooses the wrong option. While executing, there was no mouse movement, keyboard or pop-up etc. The application to be tested was the only one open.
-
This is strange. I wrote this function: Func _AU3_RunScript($scriptstring) Local $ReturnValue = 0 Local $ScriptFile = _WinAPI_GetTempFileName(@TempDir, "~") FileWrite($ScriptFile, $scriptstring) Local $ScriptRunning = RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & $ScriptFile & '"', @TempDir, @SW_HIDE) If $ScriptRunning = 0 Then FileDelete($ScriptFile) $ReturnValue = 1 Else ConsoleWrite("ScriptRunning:" & $ScriptRunning) EndIf Return $ReturnValue EndFunc And to test it: _AU3_RunScript('MsgBox(0, "this", "message")') When I run it from SCITE it runs just fine. No errors, shows the message box. When I compile it into an exe (using SCITE) and run the EXE file, I get an an error at `If $ScriptRunning = 0 Then` - - I'm getting $ScriptRunning = -1 What am I missing?
-
We have here a working script (Found on this forum - someone said its best way to set timers) I want to set timers in my program cause AdLibRegister crashes, infinite loops etc. Its a working small program to test these timers below. #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> Global $iMemo _Main() Func _Main() Global $hGUI Global $timerID1 = 1, $timerID2 = 2 Global $callBackFunc1, $callBackFunc2 Global $timerName1, $timerName2 $hGUI = GUICreate("My Timers", 400, 296) $iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, BitOR($WS_HSCROLL, $WS_VSCROLL)) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() setTimer($callBackFunc1, $timerName1, $timerID1, 1000, 'hello') setTimer($callBackFunc2, $timerName2, $timerID2, 2000, 'hello2') While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd killTimer($timerName1, $callBackFunc1) killTimer($timerName2, $callBackFunc2) EndFunc ;==>_Main ; ================= MY FUNCS ============================ Func setTimer(ByRef $callBackFunc, ByRef $timerName, $timerID = 1, $time = 1000, $funcName = 'hello') $callBackFunc = DllCallbackRegister($funcName, "none", "hwnd;int;int;dword") $timerName = _WinAPI_SetTimer($hGUI, $timerID, $time, DllCallbackGetPtr($callBackFunc)) EndFunc Func killTimer($timerName, $callBackFunc) _WinAPI_KillTimer($hGUI, $timerName) DllCallbackFree($callBackFunc) EndFunc ; ============================================= ; Write a line to the memo control Func MemoWrite($sMessage) GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Func _WinAPI_KillTimer($hWnd, $iIDEvent) Local $iResult = DllCall("user32.dll", "int", "KillTimer", "hwnd", $hWnd, "int", $iIDEvent) If @error Then Return SetError(-1, -1, 0) Return $iResult[0] <> 0 EndFunc ;==>_WinAPI_KillTimer Func _WinAPI_SetTimer($hWnd, $iIDEvent, $iElapse, $pTimerFunc = 0) Local $iResult = DllCall("user32.dll", "int", "SetTimer", "hwnd", $hWnd, "int", $iIDEvent, "int", $iElapse, "ptr", $pTimerFunc) If @error Then Return SetError(-1, -1, 0) Return $iResult[0] EndFunc ;==>_WinAPI_SetTimer Func _TimerCallBackFunc($hWnd, $Msg, $iIDTimer, $dwTime) MemoWrite("Timer " & $iIDTimer & " Fired") For $i = 999 To 1 Step -1 ConsoleWrite($i & @CRLF) Next EndFunc ;==>_TimerCallBackFunc ; ============== Funs to call =============================== Func hello($hWnd, $nMsg, $iIDTimer, $dwTime) MemoWrite("Timer " & $iIDTimer & " Fired") For $i = 999 To 1 Step -1 ConsoleWrite($i & @CRLF) Next EndFunc ;==>_TimerCallBackFunc Func hello2($hWnd, $nMsg, $iIDTimer, $dwTime) MemoWrite("Timer " & $iIDTimer & " Fired") For $i = 999 To 1 Step -1 ConsoleWrite($i & @CRLF) Next EndFunc ;==>_TimerCallBackFunc And i wanted to apply these timers to my final program. I get error: error: doingThings() called by a previous line with 0 arg(s). Min = 4. First previous line calling this Func is 31. Func doingThings($hWnd, $nMsg, $iIDTimer, $dwTime) There are pieces of code below: There I replaced AdlibRegister by setTimer and calling it like in previous working program (just doingThings in last param in setTimer function) Func r_offOn_doingThings() If _Metro_CheckboxIsChecked($r_offOn_doingThings) Then _Metro_CheckboxUnCheck($r_offOn_doingThings) ;AdlibUnRegister("doingThings") killTimer($timerName1, $callBackFunc1) Else If _checkDeclared(True,False) == False Then ; check if is declared to run func (HP,TITLE,REGION)- core_funcs Else _Metro_CheckboxCheck($r_offOn_doingThings) setTimer($callBackFunc1, $timerName1, 1, 1600, "doingThings") ;AdlibRegister("doingsThings", 1800) EndIf EndIf EndFunc And function name with params looks like this Func doingThings($hWnd, $nMsg, $iIDTimer, $dwTime) EndFunc #include Timers.au3 #CS THere are globals vars: globalVariables/timers ByRef $callBackFunc: var ByRef $timerName: var $timerID = 1: var ID $time = 1000: how often call func $funcName: function to call #CE Global $timerID1 = 1, $timerID2 = 2 Global $callBackFunc1, $callBackFunc2 Global $timerName1, $timerName2 Func setTimer(ByRef $callBackFunc, ByRef $timerName, $timerID = 1, $time = 1000, $funcName = "doingThings") $callBackFunc = DllCallbackRegister($funcName, "none", "hwnd;int;int;dword") $timerName = _WinAPI_SetTimer($GUI, $timerID, $time, DllCallbackGetPtr($callBackFunc)) EndFunc Func killTimer($timerName, $callBackFunc) _WinAPI_KillTimer($GUI, $timerName) DllCallbackFree($callBackFunc) EndFunc Func _WinAPI_KillTimer($hWnd, $iIDEvent) Local $iResult = DllCall("user32.dll", "int", "KillTimer", "hwnd", $hWnd, "int", $iIDEvent) If @error Then Return SetError(-1, -1, 0) Return $iResult[0] <> 0 EndFunc ;==>_WinAPI_KillTimer Func _WinAPI_SetTimer($hWnd, $iIDEvent, $iElapse, $pTimerFunc = 0) Local $iResult = DllCall("user32.dll", "int", "SetTimer", "hwnd", $hWnd, "int", $iIDEvent, "int", $iElapse, "ptr", $pTimerFunc) If @error Then Return SetError(-1, -1, 0) Return $iResult[0] EndFunc ;==>_WinAPI_SetTimer Thats it. And why in first working program it does not say this function below is calling with 0 args but Min is 4? setTimer($callBackFunc1, $timerName1, 1, 1600, "doingThings") When I applied this code to my final program it wants 4 arguments in function call. I rode i cant pass parameters to the callback func . What I have to do. I tried something like this: Func doingThings($hWnd = Default, $nMsg = Default, $iIDTimer = Default, $dwTime = Default) but then function is not working dont know whats going on
-
Does anyone wrote a small editor? I want to make a small Editor where I can write in TEXT-based information. Since 3 years I used Notepad, but there are to much functions what makes me after a problem. What I do want with that: - Open automatically with a given filename (cmdline). If this is given, it has to save automatically after closing. NO "SAVE AT". - In there just small functions: 1. Text Text Text...... 2. Marking text and can do : 2.1. 3 color choose (fixed) 2.2. Bold/kursiv/underline (not more) 2.3. Position left or center Why this: After writing/saving the file I want to read it and create a html-file for Email. Therefore the "Functions" have to be givinen readable in the saved file. In the GUI just do the function FINISH. A plus function (not important): - Choose a PDF-File from local system and put the filename in, so i can read it in my html-creation application to append to the email. It will be so helpfull. Thx's
-
Hi Fellow Automators, Long time listener, first time caller. I've resisted posting on the forums as long as possible for fear of public lynching, but I'm stuck and could really use some help. Note: If this is the wrong side of the forum for this topic, I apologize. I've built a GUI and script to make our lab data collection easier. The app has a number of input boxes and a 'record' button. The user fills out the input boxes with various notes and then presses 'record', which in turn presses 'record' on two other, separate apps simultaneously, pulls those recordings together into one folder, and then takes the text from the input boxes and adds it in a new row at the bottom of an existing .xlsx spreadsheet. Everything works great, except that every time I open the app to start collecting data for the day, the 'headers' for the $aArray are added to a new row and then the text is added below it. Now, if I don't close the app between collections, subsequent 'recordings' are added to the spreadsheet as expected. If I close the app and open it, the 'first' recording of the day adds the headers to a new row. I don't need new 'header' info because I've already got that in row 1 of the spreadsheet. If someone could tell me where I'm !#$%ing up, I would greatly appreciate it. #RequireAdmin #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <String.au3> #include <Process.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <DirConstants.au3> #include <Array.au3> #include <AutoItConstants.au3> #include <File.au3> #include <WinAPIShPath.au3> #include <Excel.au3> ;Declaring the $aArray and location of the speadsheet at the top of the script Local $aArray[1][9] = [["TestID","DateTimeStamp","Tamb_C","BGTemp_C", "GasType", "TrueFlow_slm", "Lens-BGDist_in", "Lens-LeakDist_In", "AddNotes"]] Local $sDataFilePath = @ScriptDir & "\Notes\DualCaptureNotes.xlsx" Func CaptureVideo() Global $TestID = GuiCtrlRead($TestIDInput) Global $timestamp = @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & "-" & @SEC Global $Cam1Dir = "C:\Archive" Global $Cam2Dir = "C:\ALD" ;Capture Cam1 Data WinActivate("Cam1 App") ControlFocus("Cam1 App", "Save",'WindowsForms10.Window.8.app.0.2099316_r7_ad114') ControlSend("Cam1 App", "Save", 'WindowsForms10.Window.8.app.0.2099316_r7_ad114', "{SPACE}") ;Capture Cam2 Data WinActivate("Cam2 App") ControlClick("Cam2 App", "", 'WindowsForms10.Window.8.app.0.1b0ed41_r7_ad122', '', 1, 10, 10) ;Wait to ensure data files have been fully written to their default locations Sleep(2000) ;Self-explanatorily named functions MoveData() RecordNotesToArray() RecordArraytoExcel() WinActivate("DualCapture") EndFunc ;==>CaptureVideo ;Skipping ahead to the .xlsx part.... Func RecordNotesToArray() _ArrayAdd($aArray, GUICtrlRead($TestIDInput) & "|" & $timestamp & "|" & GUICtrlRead($Tamb_CInput) & "|" & GUICtrlRead($BGTemp_CInput) & "|" & GUICtrlRead($GasTypeInput) & "|" & GUICtrlRead($TrueFlow_slmInput) & "|" & GUICtrlRead($Dist_BG_inInput) & "|" & GUICtrlRead($Dist_Leak_inInput) & "|" & GUICtrlRead($AddNotesInput)) EndFunc ;==>RecordNotesToArray() Func RecordArraytoExcel() Local $oExcel = _Excel_Open() Local $oWorkBook If Not FileExists($sDataFilePath) Then $oWorkBook = _Excel_BookNew($oExcel) Else $oWorkBook = _Excel_BookOpen($oExcel, $sDataFilePath) EndIf $oWorkBook.Worksheets("DataTable").Columns("A:I").AutoFit $LastRow = $oWorkbook.ActiveSheet.Range("A1").SpecialCells($xlCellTypeLastCell).Row $Rowrange = "A"&$LastRow+1 Consolewrite($Rowrange & @crlf) _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aArray, $Rowrange) If FileExists($sDataFilePath) Then _Excel_BookSave($oWorkBook) Else _Excel_BookSaveAs($oWorkBook, $sDataFilePath) EndIf _Excel_BookClose($oWorkBook) _Excel_Close($oExcel) EndFunc ;==>RecordArrayToExcel() I appreciate your time and any help you can provide. Best, Johnny
-
(If translated with a translator, it may be written a little awkwardly. I would be grateful if you could understand my situation) As mentioned in the title, the icon file, which was applied well when compiled with exe, does not apply when compiled with a3x, and is displayed as the default autoit icon. #AutoIt3Wrapper_Icon=icon.ico I specified the icon file at the top, but why can't it be applied? Is there any way to compile with a3x including icons?
-
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.
-
Hello Team, Greetings! Is there any way to run any 3rd party application silently in background without the GUI getting in the front ? I was implementing angry-ip scanner with autoit & wanted the angry-ip application to run in background quietly as I am copying its output to other file on completion. is there any way to achieve my query? Below is code I tried: $range = "192.168.0.1 192.168.0.255" ShellExecuteWait("C:\Windows\DDM\ipscan.exe","-f:range "&$iprange&" -q -o C:\temp\ScanResults.csv","","open",@SW_HIDE) Thanks!
- 8 replies
-
- shellexecute
- ip
-
(and 1 more)
Tagged with:
-
This is the function that returns the result from cmd, initially i connect to the network wait then i make a call to the above _GetDOSOutput($sCommand) function i want to wait 1 period of time netsh wlan connect name="name" actually but after starting to execute the netsh wlan show interfaces command i tried adding a timeout command it seems to have ignored the timeout command? #include <WindowsConstants.au3> #include <Constants.au3> Func _GetDOSOutput($sCommand) Run('"' & @ComSpec & '" /c ' & $sCommand, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $sOutput = '' Local $iPID = Run('"' & @ComSpec & '" /c ' & $sCommand, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $sOutput &= StdoutRead($iPID, False, False) If @error Then ExitLoop EndIf Sleep(10) WEnd Return $sOutput EndFunc Local $sCommand= 'netsh wlan delete profile name="wait" & netsh wlan connect name="name" interface="Wi-fi" & netsh wlan show interfaces' MsgBox(0,0,_GetDOSOutput($sCommand))
-
I'm trying to make one tray item delete another, but when I do this, all tray items that were created after the deleted item don't work as intended, as if their controlID's were all shifted down one value, and their corresponding tray items now (after deletion) run the code of the tray item before it. Am I missing something? Is there a better way to accomplish what I'm trying to do? #include <TrayConstants.au3> #include <Array.au3> HotKeySet ( "{ESC}", "Abort" ) Opt ( "TrayMenuMode", 3 ) TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. Global $aTray[8] ; Defines array to hold tray items. $aTray[0] = TrayCreateItem ( "Test 1 (Name Test 5)" ) $aTray[1] = TrayCreateItem ( "Test 2 (Delete Test 5)" ) $aTray[2] = TrayCreateItem ( "Test 3 (Restore Test 5)" ) $aTray[3] = TrayCreateItem ( "Test 4 (Check if Test 5 is blank or space)" ) $aTray[4] = TrayCreateItem ( "Test 5 Delete Me" ) $aTray[5] = TrayCreateItem ( "Test 6 (Check Test 5 Text)" ) $aTray[6] = TrayCreateItem ( "Test 7 (Read Values)" ) $aTray[7] = TrayCreateItem ( "Test 8 (Count Blanks)" ) While 1 Switch TrayGetMsg() Case $aTray[0] ; "Test 1" Change Test 5 Text. If TrayItemGetText ( $aTray[0] ) <> "" Then Global $TrayText = InputBox ( "Test", "Choose text for Test 5", "Test 5 Delete Me" ) TrayItemSetText ( $aTray[4], $TrayText) EndIf Case $aTray[1] ; "Test 2" Deletes "Test 5". If TrayItemGetText ( $aTray[1] ) <> "" Then Global $TrayDeletedName = TrayItemGetText ( $aTray[4] ) TrayItemDelete ( $aTray[4] ) _ArrayInsert ( $aTray, 4 ) EndIf Case $aTray[2] ; "Test 3" Restores "Test 5". If TrayItemGetText ( $aTray[2] ) <> "" Then $aTray[4] = TrayCreateItem ( $TrayDeletedName ) EndIf Case $aTray[3] ; "Test 4" Check if Test 5 value is blank, space, or filled. If TrayItemGetText ( $aTray[3] ) <> "" Then If TrayItemGetText ( $aTray[4] ) = "" Then MsgBox ( 0, "Test", "Test 5 is blank" ) ElseIf TrayItemGetText ( $aTray[4] ) = " " Then MsgBox ( 0, "Test", "Test 5 is not blank (space)" ) Else MsgBox ( 0, "Test", "Test 5 is assigned a value" ) EndIf EndIf Case $aTray[4] ; "Test 5" (Item to test for, during, and after deletion). If TrayItemGetText ( $aTray[4] ) <> "" Then MsgBox ( 0, "Test", "I'm here!" ) EndIf Case $aTray[5] ; "Test 6" Displays Text from Test 5 item. If TrayItemGetText ( $aTray[5] ) <> "" Then $Test5Text = TrayItemGetText ( $aTray[4] ) MsgBox ( 0, "Test", "Test 5 Text: " & $Test5Text ) EndIf Case $aTray[6] ; "Test 7" Displays all item values. If TrayItemGetText ( $aTray[6] ) <> "" Then MsgBox ( 0, "Test", "$aTray[0]: " & $aTray[0] & @CRLF & _ "$aTray[1]: " & $aTray[1] & @CRLF & _ "$aTray[2]: " & $aTray[2] & @CRLF & _ "$aTray[3]: " & $aTray[3] & @CRLF & _ "$aTray[4]: " & $aTray[4] & @CRLF & _ "$aTray[5]: " & $aTray[5] & @CRLF & _ "$aTray[6]: " & $aTray[6] & @CRLF & _ "$aTray[7]: " & $aTray[7] & @CRLF ) EndIf Case $aTray[7] ; "Test 8" Counts all blanks in tray values. If TrayItemGetText ( $aTray[7] ) <> "" Then Global $blankCount = _ArrayFindAll ( $aTray, "" ) If $blankCount = -1 Then If @error = 6 Then MsgBox ( 0, "Test", "Error, No blanks present") EndIf Else MsgBox ( 0, "Test", "# of blanks: " & $blankCount ) EndIf EndIf EndSwitch WEnd Func Abort() Exit EndFunc Here is a test script I created to try to troubleshoot the problem on my own, with no luck. pay specific attention to "Test 2" ($aTray[1]), "Test 5" ($aTray[4]), and how every tray item after "Test 5" ($aTray[4]) behaves after deletion. Clicking "Test 2" will delete tray item "Test 5", after deletion every item runs the code of the tray item that was established before it (ex. "Test 3" and "Test 4" run their respective code, "Test 5" no longer exists, "Test 6" runs "Test 7", "Test 7" runs "Test 8"), and the last item ("Test 8" $aTray[7]) has no effect when the tray item is clicked. I understand that deleting the tray item changes the controlID, but I don't know in what way it does, and therefore how I can fix it to be able to achieve what I want it to. I appreciate any help or guidance with this problem. To clarify, what I'm ultimately trying to do is create a 'while' loop with switch case functions that can exist without necessarily being linked to a tray item, so that I can add and delete them at liberty using the script's functions, without having to differentiate switch case functions with if functions (if $aTray[x] exists, then use this set of switch case functions, etc.). Please, I am in pain. Water come school me again pls
-
This topic give you access to an AutoIt functions library I maintain which is called PAL, Peter's AutoIt Library. The latest version 1.29 contains 231 functions divided into these topics: window, desktop and monitor GUI, mouse and color GUI controls including graphical buttons (jpg, png) GUI numberbox controls for integer, real, binary and hexadecimal input logics and mathematics include constants string, xml string and file string dialogues and progress bars data lists: lists, stacks, shift registers and key maps (a.ka. dictionaries) miscellaneous: logging/debugging, process and system info Change log and files section on the PAL website (SourceForge). A lot of these functions were created in the development of Peace, Peter's Equalizer APO Configuration Extension which is a user interface for the system-wide audio driver called Equalizer APO.
-
Have downloaded and installed AutoIt as well as ScITE and can run scripts with no issue in ScITE. Have also installed VSC (Visual Studio Code) and have installed Damien's extension for AutoIT. When trying to do various operations in VSC, I see: F5 = command 'extension.runScript' not found CTRL+F5 = command 'extension.check' not found CTRL+F6 = command 'extension.launchInfo' not found ALT+M = command 'extension.LaunchKoda' not found Thanks!
-
Hi everyone! I'm using AutoIt for several years now and I really get the hang of it! I'm quite the curious OCD perfectionist kind of guy, so I can't help wondering.. what would be the best way to program stuff for the compiler / interpreter / scripting engine? We're talking about the inner workings of the AutoIt's core here, and how to give it as less friction as possible but also take care of the machine running the script. For example, Imagine a script where we would constantly have to assign a Boolean value to a variable: ; A: local $bool = false $bool = true $bool = true $bool = false ; B: local $bool = false check(true) check(true) check(false) func check($b) if $bool = $b then return $bool = $b endfunc In this case, would it be better to just overwrite (A) the variable or first check if we really need to (B)? What would be best for the computers memory if it had to do this for a year non stop? Another example, imagine you're writing a function with an if statement. If you would look under the hood of AutoIt, what would be the best way to give your computer as less work / code nesting stack filling as possible: ; A: func decide($b_Input) if $b_Input then ;do something else ;do something else endif endfunc ; B: func decide($b_Input) if $b_Input then ;do something return endif ;do something else endfunc Last one for now: ; A: while 1 ; do stuff wend ; B: while true ; do stuff wend Isn't AutoIt taking an extra step in converting 1 to a Boolean in example (A)? Or is it the other way around and does the (B) way make AutoIt first convert a keyword (true or false) to a numerical value (0 or 1). I think this kinda detail stuff is quite interesting, makes me wonder how AutoIt converts and runs our code. What are your opinions on this topic? Any coders who know more about the inner workings of AutoIt? Any people like me who ask themselves similar questions (with examples)? Let me know! 😉
- 41 replies
-
- programminglanguage
- programming
-
(and 1 more)
Tagged with:
-
HI, for couple of years I'm using Jos script for sending reports, email with excel attachment. But from last week i'm getting this error when sending excel or word attachment message has lines too long for transport jpeg, pdf works with no problems, any sugestion ?
-
I'm using the following: Autoit 3.3.14.5 newly installed Beta 3.3.15.5 SQlite version 3380000 aka 3.38.0 I put sqlite3.dll and sqlite3_x64.dll in C:\Windows\System32 since many scripts depend on them. I extended the output of _SQLite_Startup() with: ConsoleWrite("@AutoItX64 " & @AutoItX64 & @CRLF) ConsoleWrite("$sDll_Filename " & $sDll_Filename & @CRLF) ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF) Also using the script from https://www.autoitscript.com/autoit3/docs/libfunctions/_SQLite_Startup.htm for testing. >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "R:\Download\aasdf.au3" @AutoItX64 0 $sDll_Filename sqlite3.dll _SQLite_LibVersion=0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "R:\Download\aasdf.au3" @AutoItX64 1 $sDll_Filename sqlite3_x64.dll _SQLite_LibVersion=3.38.0 >Running:(3.3.15.5):C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe "R:\Download\aasdf.au3" @AutoItX64 0 $sDll_Filename sqlite3.dll _SQLite_LibVersion=0 >Running:(3.3.15.5):C:\Program Files (x86)\AutoIt3\Beta\autoit3_x64.exe "R:\Download\aasdf.au3" @AutoItX64 1 $sDll_Filename sqlite3_x64.dll _SQLite_LibVersion=3.38.0 Why doesn't it work in 32bit, despite me having the 32bit sqlite.dll? Autoit urges running scripts in 32bit mode and Scite starts scripts just in 32bit mode without the flag? With #AutoIt3Wrapper_UseX64=Y it just works, both normal Autoit and beta! sqlite3.dll sqlite3_x64.dll
-
Hi, I am struggling in setting the value of a textarea based on the value of clipboard (that contains a long web page source codes). If I use _WD_SetElementValue, it freezes after some time, or appears to be pressing tab and goes out of focus. I can also use send keys but i need the script to run in the background. Here is the full script: #Include "Chrome.au3" #Include "wd_core.au3" #Include "wd_helper.au3" #Include "WinHttp.au3" #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <AutoItConstants.au3> #include <WinAPIFiles.au3> #include <GDIPlus.au3> #include <Excel.au3> Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_LoadWait($sSession) _WD_Navigate($sSession, "http://demo.borland.com/testsite/stadyn_largepagewithimages.html") _WD_LoadWait($sSession) Global $sSource = _WD_GetSource($sSession) Local $Paste = ClipPut($sSource) Local $sData = ClipGet() Local $aArray = 0, _ $iOffset = 1 While 1 $aArray = StringRegExp($sData, '(?s)<p>.*</p>', $STR_REGEXPARRAYMATCH, $iOffset) If @error Then ExitLoop $iOffset = @extended For $i = 0 To UBound($aArray) - 1 Local $Paste = ClipPut($aArray[$i]) Local $sRegExData = ClipGet() ;MsgBox(0, "", "$sRegExData = " & $sRegExData) Next WEnd _WD_Navigate($sSession, "https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_textarea_placeholder") _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "iframe#iframeResult") Local $sElement1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "iframe#iframeResult") _WD_FrameEnter($sSession, $sElement1) _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//html/body/textarea") $textarea = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//html/body/textarea") _WD_ElementAction($sSession, $textarea, 'click') ;WD SetElementValue(SsSession, Stextarea, $sRegExData) <-- I can do this but the focus goes out, or the browser freezes _WD_FrameLeave($sSession) sleep(2000) Send("^v") _WD_LoadWait($sSession) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}' EndFunc ;==>SetupChrome Can someone help me please, or re-direct me to the right path? TIA!
- 8 replies
-
- chrome udf
- chrome.au3
-
(and 2 more)
Tagged with:
-
Hi friends, I have a question, please. I have created a window containing a edit box I need to know how to change the keyboard language, e.g : if a user open the script it will be change the keyBord language in window automatically into English I found more examples but didn't work with me . Note: I use the windows 10 os Please help me . thanks in advance to all with my Greetings and my appreciation for all users and admins
-
I have a autoit exe file which is used in upload/browse file functionality. This has been integrated with selenium framework and I am invoking the autoit exe using Java process and runtime. Now the issue is when I run the scripts and invoke the autoit exe in local it works perfectly. But when I use selenium grid or jenkins to run the scripts in another windows server it is not working. Can anyone please suggest any solution for this?
-
Hello , I am trying to use Websockets in AutoIt. It is to fetch live stock market prices , API is provided and documentation available for python language. The link for the code snippet is : https://symphonyfintech.com/xts-market-data-front-end-api-v2/#tag/Introduction https://symphonyfintech.com/xts-market-data-front-end-api-v2/#tag/Instruments/paths/~1instruments~1subscription/post https://github.com/symphonyfintech/xts-pythonclient-api-sdk Second Link is to subscribe to a list of ExchangeInstruments. Now I would like to get live stock ltp (LastTradedPrice) for a few stocks whose "ExchangeInstrumentID" I know. I am able to use the WinHttp object to perform actions using simple codes like below : I have the secretKey and appkey and can generate the needed token. And get the unique ExchangeInstrumentID. Below code is just for example of how I am using WinHttp. Unrelated to socket part. Global $InteractiveAPItoken = IniRead(@ScriptDir & "\Config.ini", "token", "InteractiveAPItoken", "NA") $baseurl = "https://brokerlink.com/interactive/" $functionurl = "orders" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", $baseurl & $functionurl, False) $oHTTP.SetRequestHeader("Content-Type", "application/json;charset=UTF-8") $oHTTP.SetRequestHeader("authorization", $InteractiveAPItoken) $pD = '{ "exchangeSegment": "NSEFO", "exchangeInstrumentID": ' & $exchangeInstrumentID & ', "productType": "' & $producttype & '", "orderType": "MARKET", "orderSide": "' & $orderside & '", "timeInForce": "DAY", "disclosedQuantity": 0, "orderQuantity": ' & $qty & ', "limitPrice": 0, "stopPrice": 0, "orderUniqueIdentifier": "' & $orderidentifier & '"}' $oHTTP.Send($pD) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status But am struggling to understand and use socket. Would be of great help if you can have a look at the link mentioned above and help with the code sample for AutoIt. To connect and listen to a socket. Thanks a lot
- 2 replies
-
- websockets
- winhttprequest
-
(and 2 more)
Tagged with:
-
Hello, the script below will read column A from an excel file - and if a value matches in the browser, it will click the corresponding link and click on a specific button to paste the data, then writes "Completed" in Column B. It will continue to read from the excel file and do the same thing for all the remaining rows. #Include "Chrome.au3" #Include "wd_core.au3" #Include "wd_helper.au3" #Include "WinHttp.au3" #include <MsgBoxConstants.au3> #include <File.au3> #include <IE.au3> #include <Array.au3> #include <INet.au3> #include <AutoItConstants.au3> #include <WinAPIFiles.au3> #include <GDIPlus.au3> #include <Excel.au3> #Include "WinHttp.au3" #Include "_HtmlTable2Array.au3" Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_LoadWait($sSession) _WD_Navigate($sSession, "table1.html") _WD_LoadWait($sSession) _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//table[@class='main']") Local $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//table[@class='main']") ;ConsoleWrite ("mat-table " & $sElement & @CRLF) Local $aArray1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, ".//td[contains(@class,'data')]", $sElement, True) sleep(1000) For $i = 0 to UBound($aArray1) - 1 $aArray1[$i] = _WD_ElementAction($sSession, $aArray1[$i], 'text') Next ;_ArrayDisplay($aArray1) ;Email variables $SmtpServer = "" ; address for the smtp-server to use - REQUIRED $FromName = "Hermes" ; name from who the email was sent $FromAddress = "sender@gmail.com" ; address from where the mail should come $ToAddress = "recipient@gmail.com" ; destination address of the email - REQUIRED, use commas (,) to add more email addresses $Subject = "File not found" ; subject from the email - can be anything you want it to be $Body = "File not found!" ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "" ; address for cc - leave blank if not needed $BccAddress = "" ; address for bcc - leave blank if not needed $Importance = "High" ; Send message priority: "High", "Normal", "Low" $Username = "" ; username for the account used from where the mail gets sent - REQUIRED $Password = "" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 25 ; port used for sending the mail $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS $tls = 0 ; enables/disables TLS when required Local $oAppl = _Excel_Open() Local $sWorkbook = "c:\test.xlsx" Local $oWorkbook = _Excel_BookOpen($oAppl, $sWorkbook) ;open excel and pass both parameters If FileExists($sWorkbook) Then ;Check if the file exist. Local $oAppl = _Excel_Open() Local $sWorkbook = "c:\test.xlsx" Local $oWorkbook = _Excel_BookOpen($oAppl, $sWorkbook) ;open excel and pass both parameters Local $aArray2 = _Excel_RangeRead($oWorkbook,Default,$oWorkbook.ActiveSheet.Usedrange.Columns("A:A")) Local $iIdx Local $Skipline = 0 ;0==> first line Do Local $temprf For $i = 0 To UBound($aArray2) - 1 $temprf &= $aArray2[$i] _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, ".//a[contains(@class,'edit') and contains(text(),'Edit')]") Local $aElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, ".//a[contains(@class,'edit') and contains(text(),'Edit')]", $sElement, True) $iIdx = _ArraySearch($aArray1, $aArray2[$i]) If @error Then ContinueLoop _WD_ElementAction($sSession, $aElement[$iIdx], 'click') If $i < $Skipline Then ContinueLoop $oRange = $oWorkbook.ActiveSheet.Range("B" & $i + 1 & ":XFD" & $i + 1) _Excel_RangeCopyPaste($oWorkbook.Activesheet, $oRange) ;Paste Local $oTest4 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "pastebutton") _WD_ElementAction($sSession, $oTest4, 'click') Sleep(1000) ;Save Button Local $save3 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "button.button") _WD_ElementAction($sSession, $save3, 'click') _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Completed", "B" & $i+1) sleep(1000) Next Until (Not @error) _Excel_Close($oWorkbook) Else _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl, $tls) Exit EndIf _WD_LoadWait($sSession) ;Attaching files to emails Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0, $tls = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 then $IPPort = 25 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf ; Set security params If $ssl Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True If $tls Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendtls") = True ;Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send $objEmail="" EndFunc ;==>_INetSmtpMailCom Local $aDir = _FileListToArrayRec(@TempDir, "scoped_dir*;chrome_*", $FLTAR_FOLDERS, $FLTAR_NORECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) Sleep(2000) For $i = 1 To $aDir[0] DirRemove($aDir[$i], $DIR_REMOVE) Next _WD_LoadWait($sSession) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}' EndFunc ;==>SetupChrome If the excel file doesn't exists in the folder, it will send an email to a specific recipient. What i am trying figure out now is if the excel crashes while the script/loop is running, I want to relaunch the excel file continue to the last row before the excel crashed. So if the value of column B is not marked as "completed", it should continue from that row Appreciate any help that I can get to achieve this. table1.html test.xlsx
-
My au3 script program needs administrator privileges on win10 to be executed correctly, because it needs to be added to the boot---Script code:RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", @ScriptFullPath) I need to let the program automatically get administrator privileges, so I use a function of #RequireAdmin. Although the program can be added to the boot, but does not execute after system boot up? why is that? What should I do? -------------------------------------------------------------------- Update: I found that after using the #RequireAdmin function, the program cannot be executed after system boot up. An example is given below. after it is compiled, it will not be executed after system boot up in the following two ways. 1. C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\ 2. RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", @ScriptFullPath) why is that? example #include <MsgBoxConstants.au3> #RequireAdmin Func test() MsgBox(0, "", "this is test message") EndFunc ;==>test test()
-
Hi, I have a site that has the following elements below: <div>More element here</div> <div>More element here</div> <div>More element here</div> When I do this in Auto It: Local $oSelectDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "div") _WD_HighlightElement($sSession, $oSelectDiv, 1) I also tried to add [3], but it doesnt seems to work: Local $oSelectDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "div[3]") _WD_HighlightElement($sSession, $oSelectDiv, 1) It always highlight the first one, but I am trying to highlight the 3rd in the list. Is there anyway to select the 3rd div without having to add any class/id in the divs, and without using XPATH? The structure of the elements in that site were built that way.
-
I have a macro that works well on 95% of computers. However, I am running into an issue on a couple computers where the _GUICtrlTreeView_ClickItem clicks the wrong item (an item or two below the correct one). Both the ExpandItem and SelectItem command work fine, just the click item is off on these computers (and only their user names). I'm not sure if some temp file somewhere is causing an issue or what. Note, using ONLY selectitem results in inconsistent focusing (item appears focused but the next command won't always work correctly). Hence my need to use the clickitem command. Any help would be appreciated. _GUICtrlTreeView_Expand($hWnd, $Array2[$i]) ;Expand $model Sleep(250) _GUICtrlTreeView_SelectItem($hWnd, $Array2[$i]) ;Select $model Sleep(150) _GUICtrlTreeView_ClickItem($hWnd, $Array2[$i]) ;Click $model Sleep(150) EndIf