Jump to content

Small problem [Solved]


 Share

Recommended Posts

Func calibratex ()

$xadd = 705

Do
$xadd = $xadd + 1
$xscan1 = PixelGetColor ($xadd, 300)
Until $xscan1 = 0x000000 Or $xadd = 750

If $xscan1 = 750 Then
    MsgBox (0, "ERROR!", "winmovex cannot be found.")
    Exit
EndIf

IniWrite("NAMEOFINI.ini","Account","winmovex","" & ($xadd - 730) * -1 & "")
MsgBox (0, "FOUND winmovex!", "winmovex = " & ($xadd - 730) * -1 & "")
checky()
EndFunc

This works exactly as I need it to with the exception of one slight problem. It doesn't stop @ 750 like I thought it would. Maybe "Or" operator doesn't work like I think it should?

Maybe For To Next would be appropriate? =S

Edited by jebus495
Link to comment
Share on other sites

  • Moderators

jebus495,

Do...Until works fine, but perhaps if you changed the line after from If $xscan1 = 750 Then to If $xadd = 750 Then you might see the MsgBox!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hi.

It's working for me:

$xadd=1
Do
    if $xadd = 750 then 
        ConsoleWrite("Missed to exit" & @CRLF)
        Exit
    EndIf
    $xadd +=1
    $xscan1 = PixelGetColor ($xadd, 300)
Until $xscan1 = 0x123456 Or $xadd = 750

ConsoleWrite($xscan1 & ", " & $xadd & @CRLF)

Run the script from SciTE Editor and watch the output in the bottom pane.

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

It'll loop until one of these statements evaluated as true.

That's what I wanted! TY.

I just noticed something silly...

If $xscan1 = 750 Then

MsgBox (0, "ERROR!", "winmovex cannot be found.")

Exit

EndIf

Lol. xscan1 will never be a number lol. Now I feel dumb lol.

Link to comment
Share on other sites

How do you think we feel? none of us noticed it :)

Hah.

It took me so long to work out "& ($xadd - 730) * -1 &" that I guess I didn't have enough brain power to see something that simple.

Just in case anyone was curious this works exactly how I wanted it to.

Func calibratex ()
$xadd = 704

Do
$xadd = $xadd + 1
$xscan1 = PixelGetColor ($xadd, 300)
Until $xadd = 750 Or $xscan1 = 0x000000

If $xadd = 750 Then
    MsgBox (0, "ERROR!", "winmovex cannot be found.")
    Exit
EndIf

IniWrite("NAMEOFINI.ini","Account","winmovex","" & ($xadd - 730) * -1 & "")
MsgBox (0, "FOUND winmovex!", "winmovex = " & ($xadd - 730) * -1 & "")

checky()
EndFunc
Edited by jebus495
Link to comment
Share on other sites

so by switching them does it stop at $xscan1 = 0x000000?

Yes.

I'm guessing it goes like this.

Situation 1

Does xadd = 750? Nope (Checks the next one)

Does xscan1 = 0x000000? Nope (Start loop over)

Situation 2

Does xadd = 750? Yes (Exits loop and doesn't bother checking xscan)

Situation 3

Does xadd = 750? Nope (Checks the next one)

Does xscan1 = 0x000000? Yes (Exits loop)

Unless I have misunderstood this. :)

Edited by jebus495
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...