Jump to content

Search the Community

Showing results for tags 'winselectmenuitem'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

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

Categories

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I have a script that opens an editor (Notepad) and inserts text into its window, but the text insertion fails. The WinActivate() does not always give focus to the newly loaded Notepad and the WinMenuSelectItem() fails. Here is my test file: #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=THTracker.ico #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_UseX64=N #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** Opt('MustDeclareVars', 1) Opt("WinTitleMatchMode", -2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase _Main() Func _Main() add2editor("Line1" & @CRLF & "Line2" & @CRLF & "Line3" & @CRLF) EndFunc ;==>_Main Func add2editor($sOutput) Local $cmd, $hWnd, $ret, $title, $loopcnt, $maxcnt = 10 $cmd = "C:\windows\system32\notepad.exe" ConsoleWrite("Start the editor" & @CRLF) Run($cmd) $title = "Notepad" ConsoleWrite("Wait til the editor gui exists" & @CRLF) $loopcnt = 0 While (1) $ret = WinWait($title, "", 3) ConsoleWrite("+++:" & @ScriptLineNumber & ":[" & $loopcnt & "] $ret = " & $ret & @CRLF) $hWnd = $ret If ($ret <> 0) Then ExitLoop $loopcnt += 1 If ($loopcnt > $maxcnt) Then Exit Sleep(125) WEnd MsgBox(0, "A-" & @ScriptLineNumber, Hex($hWnd)) ConsoleWrite("Give focus to the editor" & @CRLF) $loopcnt = 0 While (1) $ret = WinActivate($hWnd) ConsoleWrite("+++:" & @ScriptLineNumber & ":[" & $loopcnt & "] @error = " & @error & ", $ret = " & $ret & @CRLF) $hWnd = $ret If ($ret <> 0) Then ExitLoop $loopcnt += 1 If ($loopcnt > $maxcnt) Then Exit Sleep(125) WEnd MsgBox(0, "B-" & @ScriptLineNumber, Hex($hWnd)) ConsoleWrite("Do a File -> New" & @CRLF) $loopcnt = 0 While (1) ; $ret = WinMenuSelectItem($hWnd, "", "&File", "New") ConsoleWrite("+++:" & @ScriptLineNumber & ":[" & $loopcnt & "] @error = " & @error & ", $ret = " & $ret & @CRLF) If ($ret = 1) Then ExitLoop $loopcnt += 1 If ($loopcnt > $maxcnt) Then Exit Sleep(125) WEnd MsgBox(0, "C-" & @ScriptLineNumber, Hex($hWnd)) ;Local $str = ClipGet() ; save whatever is in the clipboard Send("^a") ; select all existing text in the editor's window ConsoleWrite("put the new text into the clipboard" & @CRLF) ClipPut($sOutput) Send("^v") ; paste it into the editor's window ;;;ClipPut($str) ; restore the previous contents of the clipboard EndFunc ;==>add2editor
×
×
  • Create New...