Jump to content

How to MouseMove using _FindBMP?


gracea
 Share

Recommended Posts

Hello there..
 

Question 1:
How can i MouseMove using _FindBMP? I wanted to MouseClick to IPMSG system tray icon (but using _FindBMP).

 
Question 2:
Can "_ScreenCapture_Capture" saving-bmp-files (from the sample below) can be omitted? If not bmp file can be save from Memory-only not on disk? Hoping it will not require additional files and lots of code.

 
I was pointed by JohnOne

from here

'?do=embed' frameborder='0' data-embedContent>>

to here

'?do=embed' frameborder='0' data-embedContent>>

 

Already read all the _FindBMP page - whenever i does this and having a lots of code with it - makes me dizzy - coffee helped but a bit. Thankfully somehow i understand this sample from _FindBMP Post #86 page-5#entry1091760'>page-5#entry1091760. But cant still figure out how to MouseMove to the image so that i could MouseClick later. The code already edited by me - not tested. Just giving you idea what i wanted to do..
 

#RequireAdmin;win7
#include <GDIPlus.au3>
#Include <ScreenCapture.au3>
#Include <_FindBMP.au3>
;hotkey to run function to find image on screen
HotKeySet("{F11}","Fpic")

; If debugging output is wanted to understand and analyse the algorithm put this on true/false
Const $bDebug=False
Const $cMatchLinePercentage=0.99 ;Minimum matching, put on 1 if exact matching is needed on all lines

;Constants for type of picture matching
const $c24RGBFullMatch=1 ;Load as 24 bits and full match
const $c24RGBPartialMatch=2 ;Load as 24 bits and partial match
const $c16RGBFullMatch=3 ;Load as 16 bits and full match
const $c16RGBPartialMatch=4 ;Load as 16 bits and partial match

$fscreen = @scriptDir & "\fscreen.bmp"

$find1 = @scriptDir & "\IPMSG24BIT.BMP"
$find2 = @scriptDir & "\item2.bmp"
$find3 = @scriptDir & "\item3.bmp"
$find4 = @scriptDir & "\item4.bmp"
$find5 = @scriptDir & "\item5.bmp"

while 1
    sleep(1000)
wend

Func Fpic()
    _GDIPlus_Startup()
    _ScreenCapture_Capture($fscreen, 0, 0, -1, -1, False)      ; FALSE = DONT CAPTURE MOUSE , $FSCREEN = WHERE TO SAVE CAPTURED SCREEN
    $tResult = findBMP($fscreen, $find1, $c24RGBFullMatch)     ; $FSCREEN = WHERE TO LOOK , $FIND1 = WHAT TO LOOK, 
    $Leftt = 
    $Topp = 
    $Rightt = 
    $Bottom = 
    MouseMove($Topp,$Rightt)                                   ; ----- NOT DONE. ----------
    ;MsgBox(4096, "Test", "result: "&$tResult)                 ; result: True;16;74;96;15;16;-1;-1
    _GDIPlus_Shutdown()
EndFunc

Thanks.

Edited by gracea

:P " Loved It ! " :wub:

Link to comment
Share on other sites

  • Moderators

Sorry.. cant do anything

 

So you're saying the topic can be closed, as you're unwilling to put forth the effort? You said you understood the snippet you posted. And you show in your comments that you are getting a result. If you can understand that, why is it such a big leap to learn StringSplit?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

JLogan3o313..

Im still hoping wont be closed - instead a working result. For "cant do anything" - i said that because i meant it. What is holding me to answer or replied to the post is because i do not know how to do it. If i am programmer even for other language atleast a would have a meaningful-partial-result ideas to present for every post i make. I know this one is somewhat advanced. Could you just please make result or just recommend this to someone to solve.

:P " Loved It ! " :wub:

Link to comment
Share on other sites

  • Moderators

Yes, I can recommend how to solve:

  • Open the help file
  • Find the StringSplit page
  • Read the StringSplit page
  • Run the StringSplit example
  • Look at your code
  • Try to insert a StringSplit as was suggested

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

JLogan3o13..

Just edited and cleaned up the code for easy reading.

Cant add which and where stringsplit should apply - should be messy - then i'll be confused again.

I think my target are logically correct on very first attempt.

Try my luck again later.. might catch a headache. :wub:

.

#RequireAdmin;win7
#include <GDIPlus.au3>
#Include <ScreenCapture.au3>
#Include <_FindBMP.au3>
HotKeySet("{F11}","Fpic")                    ; hotkey to run function to find image on screen
                                             ; If debugging output is wanted to understand and analyse the algorithm put this on true/false
Const $bDebug=False
Const $cMatchLinePercentage=0.99             ; Minimum matching, put on 1 if exact matching is needed on all lines
                                             ; Constants for type of picture matching
const $c24RGBFullMatch=1                     ; Load as 24 bits and full match
const $c24RGBPartialMatch=2                  ; Load as 24 bits and partial match
const $c16RGBFullMatch=3                     ; Load as 16 bits and full match
const $c16RGBPartialMatch=4                  ; Load as 16 bits and partial match
$fscreen = @scriptDir & "\fscreen.bmp"
$find1 = @scriptDir & "\IPMSG24BIT.BMP"
while 1
    sleep(1000)
wend
;---------------------------------------------------------------------------------------------------------------------------------------------------------
Func Fpic()
    _GDIPlus_Startup()
    _ScreenCapture_Capture($fscreen, 0, 0, -1, -1, False)      ; FALSE = DONT CAPTURE MOUSE , $FSCREEN = WHERE TO SAVE CAPTURED SCREEN
    $tResult = findBMP($fscreen, $find1, $c24RGBFullMatch)     ; $FSCREEN = WHERE TO LOOK , $FIND1 = WHAT TO LOOK, 
    $Topp =                                                    ; ? - PRIORITY 1 - GET VALUE _SCREENCAPTURE_CAPTURE THE 2ND "0" BY USING STRINGSPLIT ----------
    $Rightt =                                                  ; ? - PRIORITY 2 - GET VALUE _SCREENCAPTURE_CAPTURE THE 1ST "-1" BY USING STRINGSPLIT ----------
    MouseMove($Topp,$Rightt)                                   ; ? - PRIORITY 3 ----------
    ;MsgBox(4096, "Test", "result: "&$tResult)                 ; result: True;16;74;96;15;16;-1;-1
    _GDIPlus_Shutdown()
EndFunc
;---------------------------------------------------------------------------------------------------------------------------------------------------------

.

.

Edited by gracea

:P " Loved It ! " :wub:

Link to comment
Share on other sites

junkew.. i'll try again.

#RequireAdmin;win7
#include <GDIPlus.au3>
#Include <ScreenCapture.au3>
#Include <_FindBMP.au3>
HotKeySet("{F11}","Fpic")                    ; hotkey to run function to find image on screen
                                             ; If debugging output is wanted to understand and analyse the algorithm put this on true/false
Const $bDebug=False
Const $cMatchLinePercentage=0.99             ; Minimum matching, put on 1 if exact matching is needed on all lines
                                             ; Constants for type of picture matching
const $c24RGBFullMatch=1                     ; Load as 24 bits and full match
const $c24RGBPartialMatch=2                  ; Load as 24 bits and partial match
const $c16RGBFullMatch=3                     ; Load as 16 bits and full match
const $c16RGBPartialMatch=4                  ; Load as 16 bits and partial match
$fscreen = @scriptDir & "\fscreen.bmp"
$find1 = @scriptDir & "\IPMSG24BIT.BMP"
while 1
    sleep(1000)
wend
;---------------------------------------------------------------------------------------------------------------------------------------------------------
Func Fpic()
     _GDIPlus_Startup()
     _ScreenCapture_Capture($fscreen, 0, 0, -1, -1, False)      ; FALSE = DONT CAPTURE MOUSE , $FSCREEN = WHERE TO SAVE CAPTURED SCREEN
     $tResult = findBMP($fscreen, $find1, $c24RGBFullMatch)     ; $FSCREEN = WHERE TO LOOK , $FIND1 = WHAT TO LOOK,
     ;MsgBox(4096, "Test", "result: "&$tResult)                 ; result: True;16;74;96;15;16;-1;-1
     _GDIPlus_Shutdown()
     Local $Tarr = stringsplit($tResult,",",$STR_ENTIRESPLIT)        ; ? GET $FIND1 THEN ? SPLIT VALUE - EXAMPLE #2 STRINGSPLIT - SIMILARITY 50% ? ----------
     For $i = 1 To $aArray[0]                                        ; Loop through the array returned by StringSplit to display the individual values.
         MouseMove($Topp,$Rightt)                                    ; ?
         ;MsgBox($MB_SYSTEMMODAL, "", "$aArray[" & $i & "] - " & $aArray[$i])
     Next
EndFunc
;---------------------------------------------------------------------------------------------------------------------------------------------------------
;Tarr=stringsplit(tresult;";")                                        ; CLUE

.

"Now I really feel very old.. dying slowly." :mad2: Think! Think! Think!

:P " Loved It ! " :wub:

Link to comment
Share on other sites

  • Moderators

There isn't anything more anyone can do to assist you, short of writing it for you. Until you actually put forth some effort, you're not going to get much more...

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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