Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/26/2015 in all areas

  1. This example will select an individual character out of a text field when that character is clicked on. This example will not select characters from an image, where OCR is needed. #include <Misc.au3> #include <Clipboard.au3> ;Opt("MouseCoordMode", 1) ;1=absolute(default), 0=relative, 2=client Local $aMPos, $sMsg MsgBox(0, "Instructions", '"Left mouse click" on a character,' & @LF & ' or,' & @LF & 'Press "Esc" to Exit.' & @LF & @LF & 'Press "Ok" to continue') While 1 Select Case _IsPressed("1B") ; Esc button ExitLoop Case _IsPressed("01") ; Left mouse button $aMPos = MouseGetPos() MouseMove($aMPos[0] + 5, $aMPos[1], 1) Do ; Prevents multiple mouse clicks - ensures one click only. Sleep(10) Until Not _IsPressed("01") ; Left mouse button is released ControlSend("", "", "", "^c") ; "" specifies the currently active control. Copies the highlighted text in that control. If _ClipBoard_GetData() = "" Then $sMsg = "Cursor not over a specific character when clicked" Else $sMsg = 'Clicked on"' & StringLeft(ClipGet(), 1) & '" at absolute coordinates (' & $aMPos[0] & ", " & $aMPos[1] & ")" & @LF & @LF & _ 'Note:' & @LF & 'Press "Esc" to Exit.' EndIf MsgBox(0, "Result", $sMsg, 3) _ClipBoard_SetData("") ; Could not get the script to work properly using ClipPut("") ; EndSelect WEnd When working with strings, using the PixelSearch function would be way down on the list of possible functions to use. See String functions in AutoIt help file.
    1 point
  2. I have my own way to do this: #include <File.au3> #include <Array.au3> #NoTrayIcon while 1 runwait(@ComSpec & ' /c for /F "tokens=1-10" %A in (''"netsh interface show interface | find /i "local""'') DO (echo %B %C %D %E %F %G) >> c:\temp\network.txt',"",@SW_HIDE) runwait(@ComSpec & ' /c for /F "tokens=1-10" %A in (''"netsh interface show interface | find /i "wireless""'') DO (echo %B %C %D %E %F %G) >> c:\temp\network.txt',"",@SW_HIDE) local $Network[10] _FileReadToArray("c:\temp\network.txt",$Network) $x = 1 $y = 1 Do if StringInStr($Network[$x],"Local") > 0 and StringInStr($Network[$x],"Connected",1) > 0 then ;if LAN is connected disable all wifi Do if StringInStr($Network[$y],"Wireless") > 0 and StringInStr($Network[$y],"Connected",1) > 0 Then ; if wireless and connected $Wireless_Name = StringReplace($Network[$y],"Connected Dedicated ","") runwait(@ComSpec & ' /c netsh interface set interface name="'&$Wireless_Name&'" disable',"",@SW_HIDE) EndIf $y += 1 Until $y = $Network[0]+1 EndIf if StringInStr($Network[$x],"Local") > 0 and StringInStr($Network[$x],"Disconnected",1) > 0 then Do if StringInStr($Network[$y],"Wireless") > 0 and StringInStr($Network[$y],"Disconnected",1) > 0 Then ; if wireless and disconnected $Wireless_Name = StringReplace($Network[$y],"Disconnected Dedicated ","") runwait(@ComSpec & ' /c netsh interface set interface name="'&$Wireless_Name&'" enable',"",@SW_HIDE) EndIf $y += 1 Until $y = $Network[0]+1 EndIf $x +=1 Until $x = $Network[0]+1 runwait(@ComSpec & ' /c del c:\temp\network.txt /f',"",@SW_HIDE) sleep(2000) WEnd
    1 point
×
×
  • Create New...