Leaderboard
Popular Content
Showing content with the highest reputation on 03/26/2016 in all areas
-
As a member of both forums, I will offer my opinion on this: AHK is mainly geared toward gaming. In most business IT groups they see this and AHK is dismissed as a inferior product. Right on their forum you see how gaming is promoted even by staff members. Many games do not have actual controls to click on (that follow some sort of standard) so image searching is extremely common in solving an automation issue. Thus the big push on their site showing how to solve image searching - which is really to solve game automation issues. AutoIt is geared toward being a language that can be used for businesses and hobbyist alike. It also is managed in a manner that discourages game automation. Most applications can be automated without resorting to image searching. Thus no big push for image searching. If anything when we see image search many will ask what is being automated so a more stable method can be used. If anything - using image search to automate is the worst way to go for it is inherently unstable. I've been here for 10 years and I can only count on one hand the number of times when image search or pixel search was the only solution to a problem. Usually when it is seen here - it is a good bet it is usually for a game one is trying to automate. Not always, but the odds are very likely. Now saying that, we do try to not assume it is right off the bat. It may be ignorance on the coder, it may be a legit need. We will ask anyway for we want to educate and show easier ways to do things in the AutoIt language.3 points
-
If $sFileread[0] retrieves exactly this "838,752" you have both cords, and all you need is to split the string. To do that you can use the function StringSplit (this will give you another array), like this: Local $aArray = StringSplit($sFileread[0], ",", 2) _ArrayDisplay($aArray) You can keep the same write method you were using in the first post. This will work.2 points
-
WRMF - Windows Registry Monitor Call Function
falcontechnics reacted to Luigi for a topic
I need improve the use of _WinAPI_RegNotifyChangeKeyValue and build this UDF to tracking many windows's registry keys. It allows you add a function to change's of windows registry. You can add many windows registry key's with function's associate. If the function is not exist, they block function 'function.status' and not execute it more. It is possible define a time's delay to prevent a function's re-execution. You can help-me, rating about: -UDF is write in AutoIt UDF standards; -suggest best practices to improve code; -alert bugs or errors. -more... if you want... BR, Luigi. Example #include <RegistryMonitor.au3> Opt("MustDeclareVars", 1) HotKeySet('^+{END}', '_quit') ; Ctrl + Shift + {END} Local $reg1 = reg_monitor_add($HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', BitOR($KEY_NOTIFY, $KEY_WOW64_64KEY), Default, 'ExampleFunctionA') ConsoleWrite('reg1[ ' & $reg1 & ' ]' & @LF) Local $reg2 = reg_monitor_add($HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', $KEY_NOTIFY, Default, 'ExampleFunctionB') ConsoleWrite('reg2[ ' & $reg2 & ' ]' & @LF) Func ExampleFunctionA() ConsoleWrite('ExampleFunction[ SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall ]' & @LF) EndFunc ;==>ExampleFunctionA Func ExampleFunctionB() ConsoleWrite('ExampleFunction[ SOFTWARE\Microsoft\Windows\CurrentVersion\Run ]' & @LF) EndFunc ;==>ExampleFunctionB AdlibRegister('teste_one', 1000) AdlibRegister('teste_two', 5000) AdlibRegister('_quit', 8000) While Sleep(100) WEnd Func teste_one() Local $hWrite = RegWrite('HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', 'TEST_KEY', 'REG_SZ', 'Hello this is a test') ConsoleWrite('$hWrite[ ' & $hWrite & ' ]' & @LF) Sleep(1000) Local $hRemove = RegDelete('HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', 'TEST_KEY') ConsoleWrite('$hRemove[ ' & $hRemove & ' ]' & @LF) AdlibUnRegister('teste_one') EndFunc ;==>teste_one Func teste_two() Local $hWrite = RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'TEST_KEY', 'REG_SZ', 'Hello this is a test') ConsoleWrite('$hWrite[ ' & $hWrite & ' ]' & @LF) Sleep(1000) Local $hRemove = RegDelete('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run', 'TEST_KEY') ConsoleWrite('$hRemove[ ' & $hRemove & ' ]' & @LF) AdlibUnRegister('teste_two') EndFunc ;==>teste_two Func _quit() Beep(1400, 200) Exit EndFunc ;==>_quit RegistryMonitor.au3 #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_AU3Check_Parameters= -q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #Tidy_Parameters=/sf #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include-once #include <APIRegConstants.au3> #include <WinAPIDiag.au3> #include <WinAPIReg.au3> Opt('MustDeclareVars', 1) ; #INDEX# ======================================================================================================================= ; Title .........: registry_monitor ; AutoIt Version : 3.3.12.0 ; Description ...: Monitoring key's windows registry and associates a function this event ; Author(s) .....: HelpFile http://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_RegNotifyChangeKeyValue.htm ; Modified ......: Detefon ; =============================================================================================================================== ; #VARIABLES# =================================================================================================================== Global $oEvents_RegistryMonitor = ObjCreate('Scripting.Dictionary') $oEvents_RegistryMonitor.Comparemode = 1 ; =============================================================================================================================== ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name...........: __reg_monitor_eval_key ; Description ...: Check if $iKey is a valid windows key ; Syntax.........: __reg_monitor_eval_key($iKey) ; Parameters ....: $iKey - Integer. The value must be/represent a registry windows key ; Return values .: Boolean ; Author ........: Detefon ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __reg_monitor_eval_key($iKey) If ($iKey == $HKEY_CLASSES_ROOT) Or ($iKey == $HKEY_CURRENT_CONFIG) Or ($iKey == $HKEY_CURRENT_USER) Or ($iKey == $HKEY_LOCAL_MACHINE) Or ($iKey == $HKEY_USERS) Then Return 1 Return 0 EndFunc ;==>__reg_monitor_eval_key ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name...........: __reg_monitor_eval_subkey ; Description ...: Check if $sSubkey contains less of 32 terms ; Syntax.........: __reg_monitor_eval_subkey($sSubkey) ; Parameters ....: $sSubkey - String. The value is a path's registry windows ; Return values .: Boolean ; Author ........: Detefon ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __reg_monitor_eval_subkey($sSubkey) Local $aSubkey = StringSplit($sSubkey, '\') If $aSubkey[0] >= 32 Then Return 0 Return 1 EndFunc ;==>__reg_monitor_eval_subkey ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name...........: __reg_monitor_eval_stop ; Description ...: Used when script is terminated, to close the opened handles (_WinAPI_RegCloseKey, _WinAPI_CloseHandle) ; Syntax.........: __reg_monitor_eval_stop() ; Parameters ....: none ; Return values .: none ; Author ........: Detefon ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __reg_monitor_eval_stop() AdlibUnRegister('registry_monitor') For $each In $oEvents_RegistryMonitor ConsoleWrite('close key[ ' & $each & ' ] value[ ' & $oEvents_RegistryMonitor.Item($each).Item('handle') & ' ]' & @LF) If Not _WinAPI_RegCloseKey($oEvents_RegistryMonitor.Item($each).Item('handle')) Then ConsoleWrite('@error._WinAPI_RegCloseKey..........[ ' & _WinAPI_GetErrorMessage(@extended) & ' ]' & @LF) If Not _WinAPI_CloseHandle($oEvents_RegistryMonitor.Item($each).Item('main')) Then ConsoleWrite('@error._WinAPI_CloseHandle..........[ ' & _WinAPI_GetErrorMessage(@extended) & ' ]' & @LF) Next EndFunc ;==>__reg_monitor_eval_stop ; #FUNCTION# ==================================================================================================================== ; Name...........: reg_monitor_add ; Description ...: Add a key's registro to monitoring and associate this to the function ; Syntax.........: reg_monitor_add($iKey = 0, $sSubkey = '', $iOpt = 0, $iDelay = 5000, $sFunction = '') ; Parameters ....: $iKey - Integer. The value must be/represent a registry windows key ; $sSubkey - String. The value is a path's registry windows ; $iOpt - Integer. Positive. The value define a time in mileseconds to prevent function's re-execution. ; Default value is 5.000 msec or 5 seconds ; $sFunction - String. The name of function is called when event is happend ; Return values .: Handle's _WinAPI_RegOpenKey ; Author ........: Detefon ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func reg_monitor_add($iKey = 0, $sSubkey = '', $iOpt = 0, $iDelay = 5000, $sFunction = '') If $oEvents_RegistryMonitor.Exists($iKey & $sSubkey) Then Return SetError(1, 0, 1) ; prevent add function for same key Local $oTemp = ObjCreate('Scripting.Dictionary') $oTemp.Comparemode = 1 If Not __reg_monitor_eval_key($iKey) Then Return SetError(1, 0, 2) ; check if $iKey is valid If Not __reg_monitor_eval_subkey($sSubkey) Or ($sSubkey == '') Then Return SetError(1, 0, 3) ; check if $sSubkey is valid $iOpt = Number($iOpt) If $iOpt < 0 Then $iOpt = Abs($iOpt) Local $hKey = _WinAPI_RegOpenKey($iKey, $sSubkey, $iOpt) If @error Then Return SetError(1, 0, _WinAPI_GetErrorMessage(@extended)) If Not _WinAPI_RegQueryReflectionKey($hKey) Then Return SetError(1, 0, _WinAPI_GetErrorMessage(@extended)) $oTemp.Add('main', _WinAPI_CreateEvent()) If Not $oTemp.Item('main') Then Return SetError(1, 0, _WinAPI_GetErrorMessage(@extended)) If Not _WinAPI_RegNotifyChangeKeyValue($hKey, $REG_NOTIFY_CHANGE_LAST_SET, 1, 1, $oTemp.Item('main')) Then If @error Then Return SetError(1, 0, _WinAPI_GetErrorMessage(@extended)) EndIf If Not $sFunction Then Return SetError(1, 0, 4) $oTemp.Add('handle', $hKey) $oTemp.Add('function', $sFunction) $oTemp.Add('function.status', 1) $oTemp.Add('lasthit', 0) $oTemp.Add('delay', $iDelay) $oEvents_RegistryMonitor.Add($iKey & $sSubkey, $oTemp) AdlibRegister('registry_monitor', 100) OnAutoItExitRegister('__reg_monitor_eval_stop') Return $hKey EndFunc ;==>reg_monitor_add ; #FUNCTION# ==================================================================================================================== ; Name...........: registry_monitor ; Description ...: Verify if happened a notify's windows registry ; Syntax.........: Called by reg_monitor_add ; Parameters ....: none ; Return values .: none ; Author ........: Detefon ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func registry_monitor() For $each In $oEvents_RegistryMonitor If Not _WinAPI_WaitForSingleObject($oEvents_RegistryMonitor.Item($each).Item('main'), 0) Then If _ $oEvents_RegistryMonitor.Item($each).Item('function.status') And _ ; if 'function.status' is valid, continue or not execute invalid function (($oEvents_RegistryMonitor.Item($each).Item('lasthit') == 0) Or _ ; if 'lasthit' is 0, continue ('function' is never hited) (TimerDiff($oEvents_RegistryMonitor.Item($each).Item('lasthit')) > ($oEvents_RegistryMonitor.Item($each).Item('delay')))) _ ; prevent reuse function in time less than delay time Then $oEvents_RegistryMonitor.Item($each).Item('lasthit') = TimerInit() ; mark the last use time's function Call($oEvents_RegistryMonitor.Item($each).Item('function')) ; call the function If @error == 0xDEAD And @extended == 0xBEEF Then $oEvents_RegistryMonitor.Item($each).Item('function.status') = 0 ; if error, set 'function.status' equal 0 EndIf If Not _WinAPI_RegNotifyChangeKeyValue($oEvents_RegistryMonitor.Item($each).Item('handle'), $REG_NOTIFY_CHANGE_LAST_SET, 0, 1, $oEvents_RegistryMonitor.Item($each).Item('main')) Then ExitLoop EndIf Next EndFunc ;==>registry_monitor1 point -
GUIListViewEx - Deprecated Version
argumentum reacted to Melba23 for a topic
argumentum, Remember that you can drag/drop between ListViews as well. I promise that I will not..... M231 point -
Look if this helps. #include <WinAPIFiles.au3> #include <Array.au3> Example() Func Example() ; Create a constant variable in Local scope of the filepath that will be read/written to. Local Const $sFilePath = "test.txt" ;******put the full path of the test.txt****** ; Open the file for reading and store the handle to a variable. Local $hFileOpen = FileOpen($sFilePath, $FO_READ) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.") Return False EndIf ; Read the current script file into an array using the FileOpen. Local $sFileRead = FileReadToArray($hFileOpen) If @error Then MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error) ; An error occurred reading the current script file. Return False EndIf ; Close the handle returned by FileOpen. FileClose($hFileOpen) ; Display the contents of the file. _ArrayDisplay($sFileRead) EndFunc ;==>Example This way the data will be put in the array.1 point
-
Try this: #include <GDIPlus.au3> #include <GUIConstantsEx.au3> AutoItSetOption("MouseCoordMode", 2) AutoItSetOption("GUIOnEventMode", 1) Global Const $iW = 400, $iH = 400, $iBgColor = 0xF0F0F0 Global Const $hGUI = GUICreate("", $iW, $iH) GUISetBkColor($iBgColor, $hGUI) GUISetState() _GDIPlus_Startup() Global Const $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hPen1 = _GDIPlus_PenCreate(0xFF0000FF) Global Const $hPen2 = _GDIPlus_PenCreate(0xFFFF0000) Global Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Global Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 5) _GDIPlus_GraphicsSetPixelOffsetMode($hCtxt, 4) Global Const $iPosX = 50, $iPosY = 50, $iWidth = 300, $iHeight = 300 Global Const $fDeg = ACos(-1) / 180, $fRad = 180 / ACos(-1), $iWh = $iW / 2, $iHh = $iH / 2 Global $fDiameter1 = 30, $fRadius1 = $fDiameter1 / 2, _ ;circle 1 $fDiameter2 = 135, $fRadius2 = $fDiameter2 / 2, _ ;circle 2 $mpos, $mwx, $mwy, $pd GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Do _GDIPlus_GraphicsClear($hCtxt, 0xFF000000 + $iBgColor) _GDIPlus_GraphicsDrawRect($hCtxt, $iPosX, $iPosY, $iWidth, $iHeight, $hPen1) ; circle1 _GDIPlus_GraphicsDrawEllipse($hCtxt , $iWh - $fRadius1, $iHh - $fRadius1, $fDiameter1 , $fDiameter1 , $hPen1) ; circle2 $mpos = MouseGetPos() ;get the mouse position $mwx = $mpos[0] - $iWh ;get the x coordinate $mwy = $iHh - $mpos[1] ;get the y coordinate $pd = Sqrt($iWh * $iHh + $mpos[0] * $mpos[1]) ;calculate the distance between mouse position and center $fAngle = 2 * -ATan($mwy / ($mwx + Sqrt($mwx * $mwx + $mwy * $mwy))) * $fRad ; calculate the angle between center and mouse position -> trigonometry ;-) $fDistance = $fRadius2 + $fRadius1 ;calculate the distance between both circles so that they always touch each other ;calculate x/y position of 2nd circle with a little adjustment $X1 = $iWh - $fRadius2 + Cos($fAngle * $fDeg) * ($fDistance + 0.5) $Y1 = $iHh - $fRadius2 + Sin($fAngle * $fDeg) * ($fDistance + 0.5) _GDIPlus_GraphicsDrawEllipse($hCtxt , $X1 + $fRadius2, $Y1 + $fRadius2, 1, 1, $hPen2) ;center of circle 2 _GDIPlus_GraphicsDrawEllipse($hCtxt , $X1 , $Y1 , $fDiameter2 , $fDiameter2 , $hPen2) ;circle 2 _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iW, $iH) Until Not Sleep(30) Func _Exit() _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_PenDispose($hPen1) _GDIPlus_PenDispose($hPen2) _GDIPlus_Shutdown() GUIDelete() Exit EndFunc1 point
-
I belive that FileRead is what you need, from the help file: #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> Example() Func Example() ; Create a constant variable in Local scope of the filepath that will be read/written to. Local Const $sFilePath = _WinAPI_GetTempFileName(@TempDir) ; Create a temporary file to read data from. If Not FileWrite($sFilePath, "This is an example of using FileRead.") Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.") Return False EndIf ; Open the file for reading and store the handle to a variable. Local $hFileOpen = FileOpen($sFilePath, $FO_READ) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.") Return False EndIf ; Read the contents of the file using the handle returned by FileOpen. Local $sFileRead = FileRead($hFileOpen) ; Close the handle returned by FileOpen. FileClose($hFileOpen) ; Display the contents of the file. MsgBox($MB_SYSTEMMODAL, "", "Contents of the file:" & @CRLF & $sFileRead) ; Delete the temporary file. FileDelete($sFilePath) EndFunc ;==>Example The first steps (store the data) you already did. Then you need to open the file and read it. To see how the content is being store, the above exemple shows it using MsgBox. All you need is to adapt the example.1 point
-
Zeotrope, The easiest way to do this is to use my GUIExtender UDF (the link is in my sig) - that way you can create several sections in your GUI and decide which will appear when the menu is used. Here is a very simple example: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GUIExtender.au3" $hGUI = GUICreate("Test", 500, 900) $mFileMenu = GUICtrlCreateMenu("File") $mItem_1 = GUICtrlCreateMenuItem("Item 1", $mFileMenu) $mItem_2 = GUICtrlCreateMenuItem("Item 2", $mFileMenu) $mItem_3 = GUICtrlCreateMenuItem("Item 3", $mFileMenu) GUICtrlCreateMenuItem("", $mFileMenu) $mExit = GUICtrlCreateMenuItem("Exit", $mFileMenu) _GUIExtender_Init($hGUI) $iSection_1 = _GUIExtender_Section_Start($hGUI, 0, 300) _GUIExtender_Section_Action($hGUI, $iSection_1) ; Create a disabled coloured background - different colour for each selection GUICtrlCreateLabel("", 0, 0, 500, 300) GUICtrlSetBkColor(-1, 0xFFCCCC) GUICtrlSetState(-1, $GUI_DISABLE) ; Add some controls $cButton_1 = GUICtrlCreateButton("Button 1", 100, 30, 100, 30) _GUIExtender_Section_End($hGUI) $iSection_2 = _GUIExtender_Section_Start($hGUI, 300, 300) _GUIExtender_Section_Action($hGUI, $iSection_2) GUICtrlCreateLabel("", 0, 300, 500, 300) GUICtrlSetBkColor(-1, 0xCCFFCC) GUICtrlSetState(-1, $GUI_DISABLE) $cButton_2 = GUICtrlCreateButton("Button 2", 200, 430, 100, 30) _GUIExtender_Section_End($hGUI) $iSection_3 = _GUIExtender_Section_Start($hGUI, 600, 300) _GUIExtender_Section_Action($hGUI, $iSection_3) GUICtrlCreateLabel("", 0, 600, 500, 300) GUICtrlSetBkColor(-1, 0xCCCCFF) GUICtrlSetState(-1, $GUI_DISABLE) $cButton_3 = GUICtrlCreateButton("Button 3", 300, 830, 100, 30) _GUIExtender_Section_End($hGUI) ; Leave first section open _GUIExtender_Section_Extend($hGUI, $iSection_2, False) _GUIExtender_Section_Extend($hGUI, $iSection_3, False) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $mExit Exit ; Open/close sections depending on menu selection Case $mItem_1 ; Close all sections _GUIExtender_Section_Extend($hGUI, 0, False) ; Open required section _GUIExtender_Section_Extend($hGUI, $iSection_1) Case $mItem_2 _GUIExtender_Section_Extend($hGUI, 0, False) _GUIExtender_Section_Extend($hGUI, $iSection_2) Case $mItem_3 _GUIExtender_Section_Extend($hGUI, 0, False) _GUIExtender_Section_Extend($hGUI, $iSection_3) ; look for the controls being actioned Case $cButton_1 MsgBox($MB_SYSTEMMODAL, "Pressed", "Button 1") Case $cButton_2 MsgBox($MB_SYSTEMMODAL, "Pressed", "Button 2") Case $cButton_3 MsgBox($MB_SYSTEMMODAL, "Pressed", "Button 3") EndSwitch WEnd The UDF can look quite daunting at first, so please do ask if you have any questions about how to use it. M231 point
-
panda_k3, You were straying into keylogger territory with that last post - please read this announcement to see what is and what is not permitted here. M231 point
-
GUIListViewEx - Deprecated Version
argumentum reacted to Melba23 for a topic
Hi, Following the absolutely underwhelming response to my request for testers of the new Alpha version I posted at #465 above I have revisited the code and now propose this slightly modified UDF. As before, the user sets the editable columns using a separate function rather than as a parameter when initialising - but I have combined the various modes (edit/combo/date) into a single function (_GUIListViewEx_SetEditStatus ) which sets the editing mode to be used for a column. I have amended the examples to reflect this change and here are the 3 files: <snip> As before, any comments on the amended fashion in which the columns are now set as editable and how these edits respond to user key inputs (see earlier post for details on how these have changed) would be much appreciated. Thanks in advance to any testers. M231 point -
"/c" stands for "close". Means: Run( @comspec & ' /c starts the DOS environment and executes the command. When finished it closes the window and exits. Try "/k" to "keep" the window. Useful when you need to debug your code. "|" is the DOS pipe character. Means: It grabs the output of the command left of the pipe character and passes it as input to the command right of the character.1 point
-
I make a mistake/error in my example (post #31) There should be: Func CloseAlert() Sleep(3000) ControlClick("[CLASS:#32770]", "Someone clicked the document!", "[CLASS:Button; INSTANCE:1]") EndFunc ;==>CloseAlert But even that fix is not able to properly close the window. but ...... Yesterday @Chimp @Jos an me discused here: and here is working solution for HOW TO CLICK IN JAVA ALLERT WINDOW ;~ https://www.autoitscript.com/forum/topic/181278-why-isnt-autoit-able-to-click-a-javascript-dialog/ ;~ https://www.autoitscript.com/forum/topic/181491-question-about-autoit3executeline/ #include <IE.au3> #include <MsgBoxConstants.au3> _Example() Func _Example() ; Open a browser with the basic example page, Local $oIE = _IE_Example("basic") ; Insert an event script into the head of the document that creates a JavaScript alert when someone clicks on the document _IEHeadInsertEventScript($oIE, "document", "onclick", "alert('Someone clicked the document!');") ; Run second AutoIt instance to click in the backround _ExecuteInBackground() ; Click first link on the page $oIE.document.links.item(0).click() ; Testing MsgBox($MB_ICONINFORMATION, 'Test', 'Was clicked') _IEQuit($oIE) EndFunc ;==>_Example Func _ExecuteInBackground() Local $sCommand = _ 'Local ' & _ '$Dummy1 = WinWaitActive("[CLASS:#32770]", "Someone clicked the document!"), ' & _ '$Dummy2 = Sleep(1000), ' & _ '$Dummy3 = ControlClick("[CLASS:#32770]", "Someone clicked the document!", "[CLASS:Button; INSTANCE:1]") ' & _ '' $sCommand = '"' & StringReplace($sCommand, '"', '""') & '"' ConsoleWrite($sCommand & @CRLF) Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand) EndFunc ;==>_ExecuteInBackground1 point
-
#include <Misc.au3> HotKeySet("{ESC}" , "_Exit") while 1 If _IsPressed("31") Then $text = InputBox("InputBox" , "Type something : " , "") sleep(100) Do $statKey = _IsPressed("31") Until $statKey = 1 MSgBox(0,0,$text) EndIf WEnd Func _Exit() Exit EndFunc1 point
-
Try this : #include <Misc.au3> HotKeySet("{ESC}" , "_Exit") while 1 If _IsPressed("31") Then MSgBox(0,0,"Msg 1") sleep(100) Do $statKey = _IsPressed("31") Until $statKey = 1 MSgBox(0,0,"Msg 2") EndIf WEnd Func _Exit() Exit EndFunc1 point
-
#include <Misc.au3> $i = "" while 1 If _IsPressed("31") Then ConsoleWrite("I am" & $i & " Here" & @LF) $i = $i = "" ? " Not" : "" sleep(500) EndIf sleep(50) WEnd That's not a terrible first post, thanks for the pseudo code. When you use a new UDF like you may be now with Misc, i suggest hitting alt-i on the include line and browsing it. Lots of fun things inside.1 point
-
HotkeySet is what you are searching. The example in helpfile shows how to toggle a boolean variable. If ... Then ... Else ... EndIf is also needed.1 point
-
1 point
-
Autoit & Batch
Fade91 reacted to argumentum for a topic
this "|" you have there, is a pipe, use Run( @comspec & ' /c "' & the rest . That should do it.1 point -
linco.exe is in @ScriptDir? No, then try: $sLincoPath="Path to Linco Exe" ;with ending backslash ShellExecute($sLincoPath&"Linco.exe", "-B 8 -C 1 -R 8000 -D 00:00:10 | oggenc - -r -B 8 -C 1 -R 8000 -o Audio.ogg")1 point
-
Why doesn't autoit have imagesearch built in but autohotkey does?
DocBrown reacted to MilesAhead for a topic
Autoit and AHK have different strengths and features. In some utilities I find it very useful to combine them. For example AHK can make working with mouse hotkeys easy. OTOH it has no means of compiling a true console application. Autoit compiles for console just by setting an option. Using both together can speed up utility creation by taking advantage of the strengths of each. For some reason Windows users get paranoid if a program consists of more than one exe file running no mater how small and efficient they are. I guess it's a holdover from Dos days or something.1 point -
DocBrown, Different development strategies, perhaps? M231 point
-
You don't what to reduce the size and simply make it readable. Use Tidy to make it readable again. You could use au3stripper to strip your script back to the essentials and the aut2exe compiler takes the whitespace out anyways so there is nothing to worry about. Jos1 point
-
It is a setting in Gmail you can tweak. I use 2 factor authentication with a separate password for sending emails via this UDF. That is working fine. Jos1 point