Hi,
I have the need to control via sendkeys a software that its running in a VPS.
I spoke with the coder and there is no API, just send keys and mouse clicks.
I already found some sendkeys function (SendKeys procedure by PB) in the forum but do not include sending mouse left/right clicks and to find the buttons/controls handle on the window, mouse x,y clicks.
If possible i want to read the value of one cell in the listicon control.
Any help will be welcome.
*Im trying to control GSA SER, so just need to find and click the start/stop button, right click on one listview (or something similar) and use the mouse arrows to navigate in the menu options.
As i said, i only nee to find the button and fiund how to send mouse clicks.
Best Regards
Best Way to sendkeys and mouse click, rightclick, etc ?
Best Way to sendkeys and mouse click, rightclick, etc ?
ARGENTINA WORLD CHAMPION
Re: Best Way to sendkeys and mouse click, rightclick, etc ?
Ok, i am on my way in most part.
Im just need to resolve something:
With the messageboxes that the software i am controlling are showing.
I can easily find the title, but i need to be able to read the text, does anybody know how to achieve it?
#WM_GETTEXT?
Im just need to resolve something:
With the messageboxes that the software i am controlling are showing.
I can easily find the title, but i need to be able to read the text, does anybody know how to achieve it?
#WM_GETTEXT?
ARGENTINA WORLD CHAMPION
Re: Best Way to sendkeys and mouse click, rightclick, etc ?
Its not the best way i guess, but until now i found that simulating CTRL+C i get the text in the MsgBox
Code: Select all
keybd_event_(#VK_CONTROL,0,0,0)
keybd_event_ (#VK_C, 0, 0, 0)
keybd_event_(#VK_CONTROL,0,#KEYEVENTF_KEYUP,0)
Text$ = GetClipboardText()
ARGENTINA WORLD CHAMPION
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Best Way to sendkeys and mouse click, rightclick, etc ?
Code: Select all
Procedure enummer(hwnd, lParam)
cn$=Space(100)
wt$ = Space(512)
GetClassName_(hwnd, @cn$, 98)
If cn$ = "Static"
GetWindowText_(hwnd, @wt$, 510)
Debug wt$
ProcedureReturn 0
Else
ProcedureReturn 1
EndIf
EndProcedure
Procedure gettext(void)
Delay(50)
Repeat
hwnd = FindWindow_("#32770", "Title")
Delay(1)
Until hwnd<>0
EnumChildWindows_(hwnd, @enummer(), 0)
EndProcedure
CreateThread(@gettext(), 0)
MessageRequester("Title", "I'll take titties for 400 Alex")
BERESHEIT
Re: Best Way to sendkeys and mouse click, rightclick, etc ?
This is what I use to send left mouse click to a window by coordinates.
Code: Select all
Macro MAKELPARAM(x, y)
(y<<16) | x
EndMacro
Procedure Click(x, y, times = 1, speed = 0)
If times > 1
times - 1
For i = 0 To times
If hWnd
Debug "click (" + Str(x) + "," + Str(y) + ") : " + Str(i)
PostMessage_(hWnd, #WM_LBUTTONDOWN, 0, MAKELPARAM(x, y))
PostMessage_(hWnd, #WM_LBUTTONUP, 0, MAKELPARAM(x, y))
EndIf
Delay(speed)
Next
Else
If hWnd
Debug "click (" + Str(x) + "," + Str(y) + ")"
PostMessage_(hWnd, #WM_LBUTTONDOWN, 0, MAKELPARAM(x, y))
PostMessage_(hWnd, #WM_LBUTTONUP, 0, MAKELPARAM(x, y))
EndIf
EndIf
EndProcedure
[Registered PB User since 2006]
[PureBasic 6.20][SpiderBasic 2.2]
[RP4 x64][Win 11 x64][Ubuntu x64]