Jump to content

AutoIT and Interactions with 3rd Party Application


Recommended Posts

Hi there, 

I would like to make a script that interacts with a 3rd party application which I downloaded onto my computer. This application has a few sets of interactions. My ultimate goal with the help of you pushing me in the right direction is to interact with this application which has no menu. What I want is when a integrated pop-up appears in this window (near the bottom) I would like to send it a command.

I've attempted to use the picture recognition as discussed here... '?do=embed' frameborder='0' data-embedContent>> but sadly I dont think this custom code fits my needs. 

Maybe I'm going about this wrong, but I would happy to be pointed in the correct direction. If more information is needed, please let me know and I'll try to provide as much detail as possible.

#include <MsgBoxConstants.au3>
#include <Array.au3>
#include <ImageSearchMod.au3>

Global $x = 0
Global $y = 0
$sFldr1 = @DocumentsCommonDir & "\MyScripts\"
$imageArray[4]

;images locations
$imageArray[0] = $sFldr1 & "image1.bmp"
$imageArray[1] = $sFldr1 & "image2.bmp"
$imageArray[2] = $sFldr1 & "image3.bmp"
$imageArray[3] = $sFldr1 & "image4.png"


While 1
    If WinWaitActive("[CLASS:Application Name]") Then
        $pictureResults = _WaitForImagesSearch($imageArray, 1, 1, $x, $y, 10)
        MsgBox($MB_SYSTEMMODAL, "Title", "Picture found = " & $pictureResults)
        WinWaitNotActive("[CLASS:Application Name]")
    EndIf
    Sleep(15000)
WEnd
Edited by kileveryone6
Link to comment
Share on other sites

Be a good idea to explain what exactly is going wrong with your code, post the missing function from your code and explain exactly what "send it a command" means (close it, flash it, turn it upside down).

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

Be a good idea to explain what exactly is going wrong with your code, post the missing function from your code and explain exactly what "send it a command" means (close it, flash it, turn it upside down).

...And the missing include "ImageSearchMod.au3", or at least a url from which it can be downloaded.

Maybe the bug is in those missing things - we'll never know until you post them. 

Shouldn't the definition of $imageArray be "Global $imageArray[4]" and not just "$imageArray[4]"?

Edited by DatMCEyeBall

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Link to comment
Share on other sites

Here's the original download for that included image file...

http://www.autoitscript.com/forum/index.php?app=core&module=attach&section=attach&attach_id=40653

(This file includes the au3 file and a DLL)

As far as my code, it's just not doing anything, and by that I mean for the messagebox to appear.

My array seems to work as I can callout each image just find and see the file size. I attempted with a global attribute to the variable with no luck as well.

Goal of this is to have AutoIT to interact with a 3rd party application.

When this pops up at the bottom, as such:

00uba8j.png?1

I want AutoIT to send a command, which will be...

Send("{ENTER}")

For the include file, the only changes I made in case you get the same error is as follows.

Line 39-40 has been changed from 

; If error exit
if $result[0]="0" then return 0

To 

; If error exit
;if $result[0]="0" then return 0
If IsArray($result) Then
   If $result[0] = "0" Then Return 0
Else
   If $result = "0" Then Return 0
EndIf
Edited by kileveryone6
Link to comment
Share on other sites

Take a look at the UI Automation framework.

Download the two UDFs in bottom of first post, and download and run the code in the "Simple spy demo" codebox in the middle of first post.

To verify that a control/window can be identified place the mouse cursor over the control/window and press Ctrl+w. You can see an example here.

Note that the framework is based on COM interface objects (created with ObjCreateInterface), so it's not just as easy to use as most built-in commands.

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...