Sign in to follow this  
Followers 0
bf2forlife

Imagesearch + Calculator?

3 posts in this topic

Ok I got an calculator script, and images of numbers n stuff(1.bmp, 2.bmp.... +.bmp etc.).

I think this is the easiest way to do it. The calculator is in backround, then i search for the images in another window, when it finds an image, it types it in the input box(GUICtrlSetData) then uses =, then uses CtrlSend and GUICtrlRead to send data in the same window i searched the images.

Here is calculator script:

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

Opt("GUIOnEventMode", 1)

Global $SSB = StringSplit("1|2|3|4|5|6|7|8|9|-|0|+|/|*|.|=", "|"), $bX = 8, $bY = 40

$Form1 = GUICreate("Lc", 108, 233, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close", $Form1)
GUISetBkColor(0xFFFF00)
$som = GUICtrlCreateInput("", 8, 8, 89, 21)
For $i = 1 To $SSB[0]
    GUICtrlCreateButton($SSB[$i], $bX, $bY, 27, 25, $BS_CENTER)
    GUICtrlSetOnEvent(-1, "Event")
    GUICtrlSetFont(-1, 10, 700, 0, "MS Sans Serif")
    If Not Mod($i, 3) Then
        $bX = 8
        $bY += 32
    Else
        $bX += 32
    EndIf
Next
$SSB = 0
GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func Event()
    Switch GUICtrlRead(@GUI_CtrlId)
        Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-", "*", "/", "."
            GUICtrlSetData($som,  GUICtrlRead($som) & GUICtrlRead(@GUI_CtrlId))
        Case "="
            If Execute(GUICtrlRead($som)) Then GUICtrlSetData($som, Execute(GUICtrlRead($som)))
    EndSwitch
EndFunc

Func Close()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

If u dont know how _imagesearch works, its like this:

_ImageSearch(Image,ResultPosition,ByRef x, ByRef y,tolerance)

Example.

$x1=0
$y1=0
$Example = _ImageSearch("!lol.bmp",1,$x1,$y1,0)

Share this post


Link to post
Share on other sites

got something little already

#Include <ImageSearch.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

Opt("GUIOnEventMode", 1)

Global $SSB = StringSplit("1|2|3|4|5|6|7|8|9|-|0|+|kautta|kertaa|.|=", "|"), $bX = 8, $bY = 40

$Form1 = GUICreate("Lc", 108, 233, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close", $Form1)
GUISetBkColor(0xFFFF00)
$som = GUICtrlCreateInput("", 8, 8, 89, 21)
For $i = 1 To $SSB[0]
    GUICtrlCreateButton($SSB[$i], $bX, $bY, 27, 25, $BS_CENTER)
    GUICtrlSetOnEvent(-1, "Event")
    GUICtrlSetFont(-1, 10, 700, 0, "MS Sans Serif")
    If Not Mod($i, 3) Then
        $bX = 8
        $bY += 32
    Else
        $bX += 32
    EndIf
Next
$SSB = 0
GUISetState(@SW_SHOW)
$x1=0
$y1=0
$example = _ImageSearch($SSB & ".bmp",1,$x1,$y1,0)
If Not @error Then
    GUICtrlSetData($som,  GUICtrlRead($som) & GUICtrlRead(@GUI_CtrlId))
    EndIF
While 1
    Sleep(100)
WEnd

Func Event()
    Switch GUICtrlRead(@GUI_CtrlId)
        Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-", "kertaa", "kautta", "."
            GUICtrlSetData($som,  GUICtrlRead($som) & GUICtrlRead(@GUI_CtrlId))
        Case "="
            If Execute(GUICtrlRead($som)) Then GUICtrlSetData($som, Execute(GUICtrlRead($som)))
            ControlSend("Example", "", "Edit1", GUICtrlRead($som))
    EndSwitch
EndFunc

Func Close()
    Exit
EndFunc

but aint working.

Share this post


Link to post
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
Sign in to follow this  
Followers 0