Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/18/2017 in all areas

  1. Hi Ernst, I don't have an answer for you, but this little piece of code explains your issue. It shows it does recognizes the window but doesn't move is: run('"c:\windows\system32\msra.exe" /offerra') $Hwd=WinWait("[CLASS:NativeHWNDHost]","") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Hwd = ' & $Hwd & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $rc=WinActivate("[CLASS:NativeHWNDHost]","") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $rc=WinMove("[CLASS:NativeHWNDHost]","",1,1) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console The WinWait and WinActivate work fine, and even the WinMove reports the proper handle back without an Error. Jos
    1 point
  2. They are in AutoIt3Wrapper itself as they were written quite some time ago. SciTE has this great tool Ctrl+j when the carrot is on the Funcname which will jump strait to it. Ctrl+Shift+j will jump back. Jos
    1 point
  3. This is what I do in AutoIt3Wrapper when I understand your question correctly. It shells the program, captures the output constandly and then gets the return/exit code from the process closed. These are the lines I use for all programs I shell: $Pid = Run('"program" /parameter', '', @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD) $Handle = _ProcessExitCode($Pid) $Return_Text = ShowStdOutErr($Pid) $ExitCode = _ProcessExitCode($Pid, $Handle) _ProcessCloseHandle($Handle) StdioClose($Pid) You ofcourse need to get the UDF/Funcs as well from the source. Jos
    1 point
  4. #include <Array.au3> #include <File.au3> Local $aInput $file = "F:\logins.csv" _FileReadToArray($file, $aInput, Default, ",") _ArrayDisplay($aInput) For $i = 1 to UBound($aInput) -1 MsgBox (0,'',$aInput[$i][0]) MsgBox (0,'',$aInput[$i][1]) MsgBox (0,'',$aInput[$i][2]) MsgBox (0,'',$aInput[$i][3]) Next Better?
    1 point
  5. I'm wondering if the winactivate is activating that application. Can u place a folder on top of the application, run the script and see if it's pushing the folder behind it?   Local $hWnd = WinWait("CLASS:wxWindowNR", "", 5)   ;Activate Window   WinActivate ($hWnd)
    1 point
  6. Have you put in some error checking to confirm $hWnd is getting to set and is the window you think it is? e.g. msgbox yourself the title of that window from the handle.
    1 point
  7. I just tried this on the file open dialogue from Notepad++ to cancel the dialogue, and it worked test() Func test() ControlClick("Open","","[CLASS:Button; INSTANCE:2]") EndFunc So it seems if you have the window name correct, you just need the class and instance. Have you tried swapping your code around to read: #RequireAdmin adw () Func adw () Run("C:\adwcleaner_7.0.5.0.exe","" ,@SW_MAXIMIZE ) ; Wait 5 seconds for the window to appear. Local $hWnd = WinWait("CLASS:wxWindowNR", "", 5) ;Activate Window WinActivate ($hWnd) ControlClick($hWnd,"","CLASS:Button; TEXT:Scan; INSTANCE:4","","","","") EndFunc
    1 point
  8. I dunno if this will help but here's an example I used to help someone last year with clicking a btn ^^ Posted December 21, 2016 (edited) · Report post Here you go buddy. Works on win7 Edit: The ID changes when the application is opened.. does someone know why the ID changes? #RequireAdmin ; must include when installing Example() Func Example()     Local $hWnd = WinWait("[CLASS:TWizardForm]", "", 10) ; use AutoIt v3 Window Info tool     ; located in the AutoIt folder.     WinActivate($hWnd) ; WinActivate sets Setup - FreeOCR as an active screen     ;Notes:     ;ControlClick("title", "text", controlID[, button = "left"[, clicks = 1[, x[, y]]]])             ;  title =>> $hWnd = WinWait("[CLASS:TWizardForm]             ; "text" =>> "&Next >"             ; controlID =>> 329210     ControlClick($hWnd, "&Next >", 329210) ; EndFunc   ;==>Example Edited December 21, 2016 by aa2zz6 One last final thought :|
    1 point
  9. Sorry, this isn't really something I know much about, but I'll keep stabbing in the dark until someone more knowledgeable turns up... I see in your inspector window Text: Actions, but you have TEXT: Scan....
    1 point
  10. careca

    I got a question

    so.. no answer, just more of the same
    1 point
  11. ControlClick("Malwarebytes AdwCleaner 7","","[CLASS:Button; TEXT:Scan; INSTANCE:4]") Any better?
    1 point
  12. Floops

    Run Command

    You passed "" as the third argument which is equal to @SW_HIDE Try this instead: Run("C:\adwcleaner_7.0.5.0.exe","" ,@SW_MAXIMIZE )
    1 point
  13. SlackerAl

    Run Command

    I'm not sure I can claim divine status for that one, but you are welcome.
    1 point
  14. SlackerAl

    Run Command

    You also need to lose the single quotes ' ' you have around everything, This will work: test() Func test() Run("C:\Program Files (x86)\Notepad++\notepad++.exe", "C:\Program Files (x86)\Notepad++" ,@SW_MAXIMIZE ,"" ) EndFunc
    1 point
  15. Jos

    Run Command

    Correct, why would it run notepad++ with that code as the Func is never called. Jos
    1 point
  16. JLogan3o13

    I got a question

    @alexk345 welcome to the forum. You will find you receive a lot more help if you include a detailed description of what you are trying to do. What site are you trying to automate? What is the id of the button? How about a screenshot of what you're trying to click on? Help us help you
    1 point
  17. middle is always @desktopwidth/2 and @desktopheight/2, so is there a reason you cant do everything as a percentage of those two macros rather than absolutes?
    1 point
  18. @czardas @jdelaney thanks guys, that was what i was looking for. I'm pretty good with AutoIT but totally not on web related part of it. Thanks god AutoIT has a great community. Have a nice day guys and thanks again
    1 point
  19. Here are two functions to provide pixel-accurate height and width dimensions for a given string. The more commonly-used _GDIPlus_GraphicsMeasureString built-in UDF is problematic because it returns the width padded by roughly one en-space (for reasons related to the various ways Windows produces anti-aliased fonts). These are AutoIt translations of Pierre Arnaud's C# functions, described in his CodeProject article "Bypass Graphics.MeasureString limitations" The first is an all-purpose version that takes a window handle, string, font family, font size (in points), style, and (optionally) width of the layout column (in pixels) as parameters. The second, more efficient version is intended for applications where GDI+ fonts are already in use, and takes handles to the existing graphics context, string, font, layout and format as parameters. Both functions return a two-row array with the exact width [0] and height [1] of the string (in pixels). EDIT: (Note that some of the same anti-aliasing measurement issues still apply. I did my best to work around them, but the output of the function may still be off by a pixel or two. Buyer beware.) #include <GDIPlus.au3> #include <GUIConstantsEx.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StringInPixels ; Description ...: Returns a pixel-accurate height and width for a given string using a given font, style and size. ; Syntax ........: _StringInPixels($hGUI, $sString, $sFontFamily, $fSize, $iStyle[, $iColWidth = 0]) ; Parameters ....: $hGUI - Handle to the window. ; $sString - The string to be measured. ; $sFontFamily - Full name of the font to use. ; $fSize - Font size in points (half-point increments). ; $iStyle - Combination of 0-normal, 1-bold, 2-italic, 4-underline, 8-strikethrough ; $iColWidth - [optional] If word-wrap is desired, column width in pixels ; Return values .: 2-row array. [0] is width in pixels; [1] is height in pixels. ; Author ........: Tim Curran; adapted from Pierre Arnaud's C# function ; Modified ......: ; Remarks .......: This version is longer and less efficient but works for all purposes. ; Related .......: <https://www.codeproject.com/Articles/2118/Bypass-Graphics-MeasureString-limitations> ; Link ..........: ; Example .......: Example-StringInPixels.au3 ; =============================================================================================================================== #include <GDIPlus.au3> #include <GUIConstantsEx.au3> Func _StringInPixels($hGUI, $sString, $sFontFamily, $fSize, $iStyle, $iColWidth = 0) _GDIPlus_Startup() Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Create a graphics object from a window handle Local $aRanges[2][2] = [[1]] $aRanges[1][0] = 0 ;Measure first char (0-based) $aRanges[1][1] = StringLen($sString) ;Region = String length Local $hFormat = _GDIPlus_StringFormatCreate() Local $hFamily = _GDIPlus_FontFamilyCreate($sFontFamily) Local $hFont = _GDIPlus_FontCreate($hFamily, $fSize, $iStyle) _GDIPlus_GraphicsSetTextRenderingHint($hGraphic, $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT) _GDIPlus_StringFormatSetMeasurableCharacterRanges($hFormat, $aRanges) ;Set ranges Local $aWinClient = WinGetClientSize($hGUI) If $iColWidth = 0 Then $iColWidth = $aWinClient[0] Local $tLayout = _GDIPlus_RectFCreate(10, 10, $iColWidth, $aWinClient[1]) Local $aRegions = _GDIPlus_GraphicsMeasureCharacterRanges($hGraphic, $sString, $hFont, $tLayout, $hFormat) ;get array of regions Local $aBounds = _GDIPlus_RegionGetBounds($aRegions[1], $hGraphic) Local $aWidthHeight[2] = [$aBounds[2], $aBounds[3]] ; Clean up resources _GDIPlus_FontDispose($hFont) _GDIPlus_RegionDispose($aRegions[1]) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Return $aWidthHeight EndFunc ;==>_StringInPixels ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StringInPixels_gdip ; Description ...: Returns a pixel-accurate height and width for a given string using a GDI+ font, layout and format ; Syntax ........: _StringInPixels_gdip($hGraphic, $sString, $hFont, $tLayout, $hFormat) ; Parameters ....: $hGraphic - Handle to a GDI+ graphics object. ; $sString - The string to be measured. ; $hFont - Handle to a GDI+ font. ; $tLayout - A $tagGDIPRECTF structure that bounds the string. ; $hFormat - Handle to a GDI+ string format. ; Return values .: 2-row array. [0] is width in pixels; [1] is height in pixels. ; Author ........: Tim Curran; adapted from Pierre Arnaud's C# function ; Modified ......: ; Remarks .......: This much more efficient version is for use with GDI+ fonts ; Related .......: ; Link ..........: <https://www.codeproject.com/Articles/2118/Bypass-Graphics-MeasureString-limitations> ; Example .......: Example-StringInPixels.au3 ; =============================================================================================================================== #include <GDIPlus.au3> #include <GUIConstantsEx.au3> Func _StringInPixels_gdip($hGraphic, $sString, $hFont, $tLayout, $hFormat) Local $aRanges[2][2] = [[1]] $aRanges[1][0] = 0 ;Measure first char (0-based) $aRanges[1][1] = StringLen($sString) ;Region = String length _GDIPlus_GraphicsSetTextRenderingHint($hGraphic, $GDIP_TEXTRENDERINGHINT_CLEARTYPEGRIDFIT) _GDIPlus_StringFormatSetMeasurableCharacterRanges($hFormat, $aRanges) ;Set ranges Local $aRegions = _GDIPlus_GraphicsMeasureCharacterRanges($hGraphic, $sString, $hFont, $tLayout, $hFormat) ;get array of regions Local $aBounds = _GDIPlus_RegionGetBounds($aRegions[1], $hGraphic) Local $aWidthHeight[2] = [$aBounds[2], $aBounds[3]] _GDIPlus_RegionDispose($aRegions[1]) Return $aWidthHeight EndFunc ;==>_StringInPixels_gdip _StringInPixels.au3 Example-StringInPixels.au3
    1 point
  20. nend

    Regex toolkit

    A small update for the ones that use this program V1.4.0. See the first post in this topic!
    1 point
  21. nend

    Regex toolkit

    I made a new version where this is possible, see the latest version (V1.3.0).
    1 point
  22. nend

    Regex toolkit

    I rebuild this version as a plugin for ISN AutoIt studio, this one can generate code. ISN studio https://www.isnetwork.at/isn-autoit-studio/ Plugin https://www.isnetwork.at/isn-plugins/ ISN studio on AutoIt forum
    1 point
×
×
  • Create New...