godsstigma Posted January 13, 2009 Share Posted January 13, 2009 Hello everyone, I have been using AutoHotKey for a while now and never even thought about checking AutoIt out, but I am glad I did. AHK is great for quick Hotkey and HotString automation, but I feel AutoIt has more functions to offer and is even more reminiscent of BASIC. So of course, I have a question: I work with an emulator (like PKMS or AS/400) @ work and I need to know if there is a way to get certain values off of the AS\400 GUI using its screen coordinates. So say I need to get text from coordinates 08/025 thru 08/030 and assign it to a variable. How would I go about doing this? Thanks so much! Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 13, 2009 Share Posted January 13, 2009 Hello everyone,I have been using AutoHotKey for a while now and never even thought about checking AutoIt out, but I am glad I did. AHK is great for quick Hotkey and HotString automation, but I feel AutoIt has more functions to offer and is even more reminiscent of BASIC.So of course, I have a question:I work with an emulator (like PKMS or AS/400) @ work and I need to know if there is a way to get certain values off of the AS\400 GUI using its screen coordinates.So say I need to get text from coordinates 08/025 thru 08/030 and assign it to a variable.How would I go about doing this?Thanks so much!You may not be able to. Have you checked out the emulated console window with AU3Info.exe? If it is not a standard Win32 API control, and there is no API provided by emulation solftware, then you could be out of luck. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Malkey Posted January 14, 2009 Share Posted January 14, 2009 If you can highlight and copy the text manually, then this script will automate the process. This example accesses the SciTE editor the script is in and should return "Text from Window". expandcollapse popup; Get Text from Window ; To get coordinates using Au3Info.exe ; Click at start of text to be copied. ; Press Ctrl+Alt+F . This freezes the Au3Info.exe window. ; Highlite and Copy the ControlClick Coords: x, y values. ; Paste values into _WinCtrlPtToScreenPt() function in script ; Press Ctrl+Alt+F again. This unfreezes the Au3Info.exe window. ; Click at end of text to be copied. ; and repeat copy and paste into script #include <WinAPI.au3> Opt("WinTitleMatchMode", 4) Opt("MouseCoordMode", 1);1=absolute, 0=relative, 2=client WinActivate("[Class:SciTEWindow]", "") ; <== Change Window Title of window to access here $hWin = WinGetHandle("") ; Handle of active window $CtrlHwnd = ControlGetHandle("","",""); Handle of active control in active window. $aStart = _WinCtrlPtToScreenPt($hWin, $CtrlHwnd, 128, 7) ; <== Change start coordinates here $aEnd = _WinCtrlPtToScreenPt($hWin, $CtrlHwnd, 260, 10) ; <== Change end coordinates here send("^{HOME}"); Use only if needed. Scrolls to top of page. Ctrl + Home MouseClickDrag("left",$aStart[0], $aStart[1], $aEnd[0], $aEnd[1]) ClipPut("");Clear clipboard Send("^c") $var = ClipGet() MsgBox(0, "Copied text in $var variable", $var) Func _WinCtrlPtToScreenPt($WinHwnd, $CtrlHwnd, $iX, $iY) Local $aRet[2], $tpoint ; ControlClick Coords $tpoint = DllStructCreate("int X;int Y") DllStructSetData($tpoint, "X", $iX) DllStructSetData($tpoint, "Y", $iY) _WinAPI_ClientToScreen($CtrlHwnd, $tpoint) ;$aCtrlPos = ControlGetPos($WinHwnd, "", $CtrlHwnd) $aRet[0] = DllStructGetData($tpoint, "X");+ $aCtrlPos[0] $aRet[1] = DllStructGetData($tpoint, "Y"); + $aCtrlPos[1] Return $aRet EndFunc ;==>_WinCtrlPttoScreenPt Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now