Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/19/2021 in all areas

  1. It's probably because you want to make sure that $bReset is actually boolean (True) as opposed to non-zero or non-empty string. ConsoleWrite("True = True: " & (True = True) & @CRLF) ConsoleWrite("True == True: " & (True == True) & @CRLF) ConsoleWrite("True = 1: " & (True = 1) & @CRLF) ConsoleWrite("True == 1: " & (True == 1) & @CRLF) If so, that means that the underlying code must be a little sloppy.
    2 points
  2. Nine

    NC wrapper problem

    There is a number of ways to interact with DOS console. In your case, I believe you should enter in a convo mode. Here how you would do it : ;#AutoIt3Wrapper_Change2CUI=y #include <WinAPIConv.au3> #include <Constants.au3> Opt("MustDeclareVars", 1) Const $sPath = "C:\Users\Rob99\Documents\PROGRAMMAZIONE\AUTOIT\GUI_NJ_MT4" Local $iPID = Run(@ComSpec, "", @SW_SHOW, $STDIN_CHILD+$STDERR_MERGED) ProcessWait($iPID) MsgBox ($MB_SYSTEMMODAL,"",ReadStream ($iPID)) StdinWrite ($iPID, "cd " & $sPath & @CRLF) MsgBox ($MB_SYSTEMMODAL,"",ReadStream ($iPID)) StdinWrite ($iPID, "nc64.exe -c 127.0.0.1 23457" & @CRLF) MsgBox ($MB_SYSTEMMODAL,"",ReadStream ($iPID)) Local $sRep While True $sRep = InputBox("Convo with DOS console", "Enter DOS command :", "", "", 500) If @error Then ExitLoop StdinWrite ($iPID, $sRep & @CRLF) MsgBox ($MB_SYSTEMMODAL,"", ReadStream($iPID)) WEnd Func ReadStream ($iPID, $iDelay = 300) Local $vData, $sStream Do Sleep ($iDelay) $vData = StdoutRead($iPID) If @error Then StdioClose($iPID) ProcessClose($iPID) Exit ConsoleWrite("[ERROR] reading child Stream" & @CRLF) EndIf ; ConsoleWrite($vData & @CRLF) $sStream &= $vData Until $vData = "" Return _WinAPI_OemToChar ($sStream) EndFunc I hard coded the first 2 commands, so you understand how this snippet is working...Enjoy !
    2 points
  3. It would've helped if you showed the relevant HTML in order to give you a more accurate answer. So instead, I will show you based on the following: Assuming a web page has a checkbox defined as: (example taken from the "Remember Me" checkbox on https://www.autoitscript.com/forum/login/) <input type="checkbox" name="remember_me" id="remember_me_checkbox" value="1" checked="" aria-checked="true"> In order to see whether the checkbox is checked, you can check its "checked" property by doing something like: $idElement = _WD_FindElement($gsSession, $_WD_LOCATOR_ByXPath, "//input[@id='remember_me_checkbox']") ConsoleWrite("Checkbox Checked = " & _WD_ElementAction($gsSession, $idElement, "property", "checked") & @CRLF) Which in my case displays: Checkbox Checked = True
    2 points
  4. A new quick/small UDF. #include-once #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Global $RUN_WRAPPER_PID Global Enum _ $RUNWRAPPER_ERR_SUCCESS, _ $RUNWRAPPER_ERR_GENERAL, _ $RUNWRAPPER_ERR_COUNTER Global Enum _ $RUNWRAPPER_EXT_DEFAULT, _ $RUNWRAPPER_EXT_NOT_FINISHED_YET, _ $RUNWRAPPER_EXT_COUNTER If Not @Compiled And @ScriptName = 'Run_Wrapper.au3' Then _Example_for_Run_Wrapper() Func _Example_for_Run_Wrapper() _Run_Wrapper('ping 8.8.8.8') If @error then Return SetError(@error, @extended, 0) While $RUN_WRAPPER_PID Sleep(10) _Run_Wrapper_GetStdout() If @error Then _Run_Wrapper_GetStderr() If @error Then ExitLoop EndIf WEnd MsgBox($MB_OK + $MB_TOPMOST + $MB_ICONINFORMATION, 'Information #' & @ScriptLineNumber, _ _Run_Wrapper_GetStdout() & @CRLF & _ _Run_Wrapper_GetStderr() _ ) EndFunc ;==>_Example_for_Run_Wrapper Func _Run_Wrapper($sCommand) _Run_Wrapper_GetStdout(Null) _Run_Wrapper_GetStderr(Null) $RUN_WRAPPER_PID = Run(@ComSpec & " /c " & $sCommand, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) If @error Then Return SetError($RUNWRAPPER_ERR_GENERAL, $RUNWRAPPER_EXT_DEFAULT, 0) Return $RUN_WRAPPER_PID EndFunc ;==>_Run_Wrapper Func _Run_Wrapper_GetStdout($v_Reset = Default) Local Static $s_StdOut = "" If IsKeyword($v_Reset) And $v_Reset = Null Then $s_StdOut = '' $s_StdOut &= StdoutRead($RUN_WRAPPER_PID) If @error Then Return SetError(@error, $RUNWRAPPER_EXT_DEFAULT, $s_StdOut) Return SetExtended($RUNWRAPPER_EXT_NOT_FINISHED_YET, $s_StdOut) EndFunc ;==>_Run_Wrapper_GetStdout Func _Run_Wrapper_GetStderr($v_Reset = Default) Local Static $s_StdErr = '' If IsKeyword($v_Reset) And $v_Reset = Null Then $s_StdErr = '' $s_StdErr &= StderrRead($RUN_WRAPPER_PID) If @error Then Return SetError(@error, $RUNWRAPPER_EXT_DEFAULT, $s_StdErr) Return SetExtended($RUNWRAPPER_EXT_NOT_FINISHED_YET, $s_StdErr) EndFunc ;==>_Run_Wrapper_GetStderr
    1 point
  5. Tested on both Win7 (Chrome and Edge) and Win10 (Edge). In all cases, demo created correct .png files.
    1 point
  6. btw... I would like to propose your example in this form: _Example_Nine() Func _Example_Nine() #REMARK !!! True or true as Boolean is converted internaly to "True" as string ConsoleWrite("( bool vs string true ) = " & (True == "True") & @CRLF) ; Positive result because Boalean True is converted so .... "True" == "True" ConsoleWrite("( bool vs string true ) = " & (true == "true") & @CRLF) ; Negative result because Boalean true is converted so .... "True" <> "true" ConsoleWrite(@CRLF) ConsoleWrite("( string True vs Bool ) = " & ("True" == True) & @CRLF) ; Positive result because Boalean True is converted so .... "True" == "True" ConsoleWrite("( string True vs Bool ) = " & ("True" == true) & @CRLF) ; Positive result because Boalean true is converted so .... "True" == "True" ConsoleWrite(@CRLF) ConsoleWrite("( string true vs Bool ) = " & ("true" == True) & @CRLF) ; Negative result because Boalean True is converted so .... "true" <> "True" ConsoleWrite("( string true vs Bool ) = " & ("true" == true) & @CRLF) ; Negative result because Boalean true is converted so .... "true" <> "True" ConsoleWrite(@CRLF) EndFunc ;==>_Example
    1 point
  7. Hi Tood, what about this ? HotKeySet("{DEL}", "_Start") ... Func _Start() HotKeySet("{DEL}") ; unset so DEL key can be sent during the function _ScreenCapture_Capture(...) Send("{DEL}") HotKeySet("{DEL}", "_Start") ; set before leaving the function EndFunc ;==>_Start
    1 point
  8. This also worked perfectly. Thank you guys so much!
    1 point
  9. This can't be the entire script obviously, cus this would just run and exit. Not sure why you're using DllOpen without using the open handle in anything, perhaps you misunderstand what that function is for? Anyway, I wrote this up: #include <Date.au3> #include <Misc.au3> #include <ScreenCapture.au3> Global $hUser32 = DllOpen('user32.dll') OnAutoItExitRegister(_Exit) While 1 If _IsPressed('2E', $hUser32) Then _ScreenCapture_Capture(@DesktopDir & "\" & StringRegExpReplace(_Now(), '[/ :]', '-') & ".jpg") Sleep(100) EndIf WEnd Func _Exit() DllClose($hUser32) EndFunc
    1 point
  10. This worked for me: #include <Date.au3> #include <ScreenCapture.au3> HotKeySet("1", "one") HotKeySet("{ESC}","leave") While 1 Sleep(50) WEnd Func one() _ScreenCapture_Capture(@DesktopDir & "\" & StringRegExpReplace(_Now(), '[/ :]', '-') & ".jpg") HotKeySet("1") Send("1") Sleep(200) HotKeySet("1", "one") EndFunc Func leave() Exit EndFunc
    1 point
  11. @Siwa You should be able to handle this (see what I did there? 😛) with _WD_Window and its Handles command.
    1 point
  12. hm... maybe HelpFile should be reviewed in this .... part. Check this following code : Global $RUN_WRAPPER_PID Global Enum _ $RUNWRAPPER_ERR_SUCCESS, _ $RUNWRAPPER_ERR_GENERAL, _ $RUNWRAPPER_ERR_COUNTER Global Enum _ $RUNWRAPPER_EXT_DEFAULT, _ $RUNWRAPPER_EXT_NOT_FINISHED_YET, _ $RUNWRAPPER_EXT_COUNTER _Run_Wrapper_GetStdout('by mistake') _Run_Wrapper_GetStderr(1234) ConsoleWrite('! ' & _Run_Wrapper_GetStdout() & @CRLF) ConsoleWrite('! ' & _Run_Wrapper_GetStderr() & @CRLF) Func _Run_Wrapper_GetStdout($bReset = False) Local Static $sOutputRead = "SIMULATION OF NORMAL STDOUT RESULT" If $bReset == True Then $sOutputRead = '' ;~ If $bReset = True Then $sOutputRead = '' ;~ $sOutputRead &= StdoutRead($RUN_WRAPPER_PID) If @error Then Return SetError(@error, $RUNWRAPPER_EXT_DEFAULT, $sOutputRead) Return SetExtended($RUNWRAPPER_EXT_NOT_FINISHED_YET, $sOutputRead) EndFunc ;==>_Run_Wrapper_GetStdout Func _Run_Wrapper_GetStderr($bReset = False) Local Static $sOutputError = 'SIMULATION OF NORMAL STDERR RESULT' If $bReset == True Then $sOutputError = '' ;~ If $bReset = True Then $sOutputError = '' ;~ $sOutputError &= StderrRead($RUN_WRAPPER_PID) If @error Then Return SetError(@error, $RUNWRAPPER_EXT_DEFAULT, $sOutputError) Return SetExtended($RUNWRAPPER_EXT_NOT_FINISHED_YET, $sOutputError) EndFunc ;==>_Run_Wrapper_GetStderr and then change: ;~ If $bReset == True Then $sOutputRead = '' If $bReset = True Then $sOutputRead = '' and check again.
    1 point
  13. @mLipok I know it's because it was a quick one, but just to let you know that this If $bReset == True Then should be converted into this If $bReset = True Then or even into this If $bReset Then
    1 point
  14. @Siwa That's not a standard checkbox element, so you can't use standard code like @TheXman's to automate it. From the information you posted, it appears that the element's class changes whenever it is checked / unchecked. Therefore, you will need to write the code to check the class to determine it's checked state.
    1 point
  15. https://github.com/int0x33/nc.exe
    1 point
  16. Well I figured out a method. Not quite the way I intended, but isn't that usually the way of AutoIt? 😁 So, I created this little script: If $CmdLine[0] Then For $i = 1 to $CmdLine[0] If @UserName = $CmdLine[$i] Then If Not Shutdown(4) Then MsgBox(0x10, @ScriptName & ' - Error', 'There was an error (#' & @error & ') trying to log off this user: ' & @UserName) EndIf Next Else MsgBox(0x40, @ScriptName, 'Will force log off if current user matches any name given as command parameters' &@CRLF&@CRLF& 'ie: ' & @ScriptName & ' "Aaron" "Bob Smith"' &@CRLF&@CRLF& 'Will log off Aaron or Bob Smith') EndIf And then I created a Scheduled Task triggered to run "On workstation lock of any user", gave it parameters of the kids' usernames, and Bob's your uncle. In my brief testing it seems to work alright.
    1 point
  17. junkew

    Opencv UDF

    Started with errors as Geir1983 reported on first page of thread: "When trying your examples i get error messages. Using Autoit v3.3.10.2, Windows 7 32 bit, OpenCV 2.4.5" Partly working with original contours example code and opencv_world451.dll. Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0 Keyboard:00020409 OS:WIN_81/ CPU:X64 OS:X64 Environment(Language:0413) >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "F:\download\OpenCV contour_example.au3" Shows 3 windows but then dies after a while most likely all kinds of definitions for 32/64 bits are incorrect. dies on line Local $pcontours = _cvCreateSeq(0, 64, DllStructGetSize(DllStructCreate($tagCvPoint)), $pstorage); Changes done on original files from post 1 moved global variables to top of file OpenCVFcns.au3 removed $hwnd in function. Unclear where this should have come from changed _OpenCV_Startup() with world dll replace ghGDIPDll with __g_hGDIPDll ;OpenCVFcns.au3 ;=============== ;Moved to top of file Global $_opencv_core, $_opencv_highgui, $_opencv_imgproc, $_opencv_calib3d, $_opencv_features2d ;Openfiledialog remove $hwnd Func _cvLoadImage(ByRef $filename , $iscolor = $CV_LOAD_IMAGE_COLOR ) ; If $filename = "" Then $filename = FileOpenDialog( "Select graphic file", @ScriptDir & "\", "Images (*.jpg;*.bmp;*.png)", 3,"",$hwnd ) If $filename = "" Then $filename = FileOpenDialog( "Select graphic file", @ScriptDir & "\", "Images (*.jpg;*.bmp;*.png)", 3,"" ) ;ConsoleWrite("error2" & $filename ) $_aResult = DllCall($_opencv_highgui, "int:cdecl", "cvLoadImage", "str", $filename, "int", $iscolor ) If @error Then ConsoleWrite("File not loading") Return $_aResult[0] EndFunc ;==>_cvLoadImage Func _OpenCV_Startup() ; $_opencv_core = DllOpen("opencv_core245.dll") ; $_opencv_highgui = DllOpen("opencv_highgui245.dll") ; $_opencv_imgproc = DllOpen("opencv_imgproc245.dll") ; $_opencv_calib3d = DllOpen("opencv_calib3d245.dll") ; $_opencv_features2d = DllOpen("opencv_features2d245.dll") $_opencv_core = DllOpen("F:\download\opencv\build\x64\vc15\bin\opencv_world451.dll") $_opencv_highgui = DllOpen("F:\download\opencv\build\x64\vc15\bin\opencv_world451.dll") $_opencv_imgproc = DllOpen("F:\download\opencv\build\x64\vc15\bin\opencv_world451.dll") $_opencv_calib3d = DllOpen("F:\download\opencv\build\x64\vc15\bin\opencv_world451.dll") $_opencv_features2d = DllOpen("F:\download\opencv\build\x64\vc15\bin\opencv_world451.dll") EndFunc ;==>_OpenCV_Startup ;OpenCV contour_example.au3 ;========================== ;replace ghGDIPDll with __g_hGDIPDll Local $aResult = DllCall($ghGDIPDll, "int", "GdipDrawLines", "handle", $hGraphics, "handle", $hPen, "struct*", $tPoints, "int", $iCount) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipDrawLines", "handle", $hGraphics, "handle", $hPen, "struct*", $tPoints, "int", $iCount)
    1 point
  18. @Earthshine Normally it is not possible to exit an If statement/structure, this is where GOTO is usually needed. Not really sure if this is what you were talking about. I guess we will see how things pan out, there is plenty of time to worry about GOTO once we actually have a working interpreter
    1 point
  19. I don't wanna fight y'all but if I have to I will. Now leave all this GOTO/GOSUB alone. We're using functions !
    1 point
  20. The assigned time range for milliseconds is too narrow (995..999). The function GUIGetMsg already generates a sleep of 10 ms (as far as I know). Because of that, this partial condition is often not fulfilled. BTW : Do you really need to check for milliseconds? Furthermore : Why do you use the function Break ? In addition, the syntax for Break is incorrect ! Here is an example according to your sample including the correction of @Jos : #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "_Quit") ; just to quit the script manually $gui = GUICreate("", 200, 90) $label1 = GUICtrlCreateLabel("", 10, 10, 100, 100) $label2 = GUICtrlCreateLabel("", 40, 10, 100, 100) $label3 = GUICtrlCreateLabel("", 70, 10, 100, 100) $label4 = GUICtrlCreateLabel("", 100, 10, 100, 100) $bClicked = False Func click() MouseClick("left", 230, 468, 1, 1) EndFunc ;==>click GUISetState(@SW_SHOW) While 1 $hour = @HOUR $min = @MIN $sec = @SEC $msec = @MSEC if $hour = 17 And $min = 34 And $sec = 5 And 599 < $msec And $msec < 999 AND NOT $bClicked Then ConsoleWrite($hour & ':' & $min & ':' & $sec & '.' & $msec & @CRLF) ; *** just for test click() $bClicked = True ;~ Break EndIf $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect Sleep(50) GUICtrlSetData($label1, $hour) GUICtrlSetData($label2, $min) GUICtrlSetData($label3, $sec) GUICtrlSetData($label4, $msec) WEnd Func _Quit() Exit EndFunc ;==>_Quit
    1 point
  21. Jos

    click at a specific time

    This is not giving you the result you expect and need to be broken up in 2 parts! if $hour = 10 And $min = 15 And $sec = 20 And 995 < $msec And $msec < 999 Then Jos
    1 point
  22. Excample : #include <Date.au3> HotKeySet("{ESC}", "_Quit") ; just to quit the script manually Local $sTimeToClick = "08:12:00" ; HH:MM:SS While True If _NowTime() = $sTimeToClick Then MsgBox(0, "Clicktime", _NowTime()) ExitLoop EndIf Sleep(10) WEnd Func _Quit() Exit EndFunc ;==>_Quit P.S. : Next time please post the script, not just a graphic of it .
    1 point
  23. v0.4.0.1 has been released with the following updates -- - Added: _WD_PrintToPDF - Fix (_WD_Window): Properly handle 'print' result - Changed (_WD_ElementActionEx): Added 'hide' and 'show' options - Changed (_WD_ElementAction): Added support for Shadow, CompRole & CompLabel actions - Changed (_WD_GetShadowRoot): Use _WD_ElementAction instead of _WD_ExecuteScript - Changed (_WD_NewTab): Use native Webdriver commands when Javascript isn't required - Changed (_WD_FindElement): Support shadow roots - Changed (_WD_Window): Support 'full' option for screenshots Note: The shadow root stuff isn't officially in the specs yet, so YMMV when attempting to use it
    1 point
×
×
  • Create New...