Jump to content

Automating Calculator (No Clicking) -- and other programs


Recommended Posts

I think then that your only recourse is to try the windows API directly

but I'm pretty sure AutoIt3 uses them anyway internally, so I'd not expect

too much success.

Look at SendMessage and or PostMessage, or even those in the standard

WinAPI UDF.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

You could use processcall udf if you want without clicking. But to use it you must find out function address, call mathod and parameters. But it's very difficult and probably only code author knows how to help you.

I'll take a look at that... I've done a little bit of assembly with AutoIt using NomadMemory, maybe I'll strike it lucky.

I think then that your only recourse is to try the windows API directly

but I'm pretty sure AutoIt3 uses them anyway internally, so I'd not expect

too much success.

Look at SendMessage and or PostMessage, or even those in the standard

WinAPI UDF.

I did actually look at SendMessage once, but I didn't know what to use $iMsg parameter. In the HelpFile, they only give: _SendMessage($hwnd, $WM_SYSCOMMAND, $SC_MONITORPOWER, $OnOff)... Which is fine and dandy that $WM_SYSCOMMAND and $SC-MONITORPOWER happen to be built into AutoIt already... so where would I go to find my values to be plugged into there (or is it not possible as you stated because everything on SendMessage is stuff built into AutoIt?)?

Link to comment
Share on other sites

It's looking somewhat promising JohnOne actually. Some things from what I've seen so far:

1. http://msdn.microsoft.com/en-us/library/windows/desktop/ms632644%28v=vs.85%29.aspx <-- how do I get the lParam? Says I need a pointer to the window text? I was successful in sending the text to that Control though, but it's only sending a blank text. Code:

Edit: Ptr("hey") didn't work either

Local $hwnd = ControlGetHandle("Import", "", "[CLASS:Edit; INSTANCE:1]")
_ToggleMonitor($hwnd)
;Local Const $WM_SETTEXT = 12


Func _ToggleMonitor($hwnd)
Local Const $WM_SETTEXT = 12
Local Const $text = "hey"
_SendMessage($hwnd, $WM_SETTEXT, 0, $text)
If @error Then
     MsgBox(0, "_ToggleMonitor", "_SendMessage Error: " & @error)
     Exit
EndIf
EndFunc ;==>_ToggleMonitor

2. Is there anyway to click an option that doesn't have a ControlID/handle? There are certain drop down options in the program that I can't get the controlID of (such as Toolbar options - but it's not in the Toolbar)... Any ideas on how I could go about doing that? (that's the one downside of doing it this way versus actual Hooking -- in hooking we could just TELL the program to run the function that simulates clicking on that drop down option)

3. To click "Ok" on the MessageBoxes that come up during the program, I've been doing ControlClick (which has been giving those funny results as talked about earlier). I did find this:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb775985%28v=vs.85%29.aspx

However, AutoIt says that we need a 'number' for the $iMsg parameter - and msdn isn't giving us a number for it. Any idea on what to use for the number? (I suppose I could just try doing the LBUTTONDOWN and LBUTTONUP messages, but this seems a bit more efficient)

Edit: As a side note: Been doing a lot more search on SetWindowsHookEx. This seems to be the more appropriate thing for what I want to accomplish. Although the SendMessage is doing what I asked for in the thread, it seems to be doing exactly what ControlClick/ControlSend does (maybe they are exactly the same thing too). Some useful functions I did find were:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms644987%28v=vs.85%29.aspx (monitor IF a message box comes up... then do another action)

http://msdn.microsoft.com/en-us/library/windows/desktop/ms644981%28v=vs.85%29.aspx

and especially:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms644975%28v=vs.85%29.aspx

I'm just pretty illiterate on how DLLs work though, so I don't think I could be able to do this :(.

Edited by UnknownWarrior
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...