Jump to content
Sign in to follow this  
Guest bornloser

msgbox return value?

Recommended Posts

Guest bornloser

k lets say my msgbox is set to 4100 which is yes no, how do i do an if statment that checks if yes or no was pressed? like what i'm suppose to compare to 6(Yes)??

also another thing, lets say i do something like: put your mouse over the object

so the user puts their cursor over the object and then after like 10 seconds it will get the coordinates and the pixle, how do i do that?

Edited by bornloser

Share this post


Link to post
Share on other sites

Example 1

$MsgBox_Yes = 6
$MsgBox_No = 7
If MsgBox(4100, "Test", "Press Yes or No, please.") = $MsgBox_Yes Then
  ;User pressed Yes
Else
  ;User pressed No
EndIf

Example 2

$MsgBox_Yes = 6
$MsgBox_No = 7
$MsgBox_val = MsgBox(4100, "Test", "Press Yes or No, please.")
If $MsgBox_val = $MsgBox_Yes Then
  ;User pressed Yes
Else
  ;User pressed No
EndIf

Share this post


Link to post
Share on other sites
Guest bornloser

thx, i got another question.

If i have a window minimized how do i open it without moving the mouse there and clickin on the button?

Share this post


Link to post
Share on other sites
Guest bornloser

k thx,

got another question lets say i got some variables and then i write them into an ini file.

when i close the program and run it agian how do check if the variables are in the ini file.

what i mean is that

lets say i got some values in the ini file i run the program and i dont want ot input the values agian, but the first time i run it i want to input the values. something like that lol

Share this post


Link to post
Share on other sites

lets say i do something like: put your mouse over the object

so the user puts their cursor over the object and then after like 10 seconds it will get the coordinates and the pixle, how do i do that?

Here's one way to get the screen coordinates and pixel color after a period of mouse inactivity. Move the mouse over the desired location, and keep it steady for the specified period (adjust period as needed).

; Example:
opt ("MouseCoordMode", 0)
$aPos2 = _DelayedMouseGetPosNColor(1000); change the delay as needed (milliseconds)
MsgBox(4096, "Mouse Coords", "The Mouse Coordinates are: " & $aPos2[0] & "," & $aPos2[1] & ", color is " & $aPos2[2])
Exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func _DelayedMouseGetPosNColor($iDelay)
  ; Return the x & y screen coordinates of the mouse after it paused for a period of time.
  ; The returned value is a 1D array consisting of two elements (x in indices 0, and y in indices 1)
  ;
  ; $iDelay = The time, in milliseconds, that the mouse must be kept still
  ;        before the mouse position is returned to the caller.
  ;
  ; Author: Phillip123Adams, 2005/01/30
  ;
   Local $aLastPos = MouseGetPos(), $aPos[2]
   Local $iStart = TimerInit()
   While 1
      ToolTip("Keep mouse steady over an" & @LF & "object for " & $iDelay & " milliseconds")
      $aPos = MouseGetPos()
      If $aPos[0] = $aLastPos[0] And $aPos[1] = $aLastPos[1] Then
         If TimerDiff($iStart) >= $iDelay Then
            ToolTip("")
            ReDim $aPos[3]
            $aPos[2] = PixelGetColor($aPos[0], $aPos[2])
            Return $aPos
         EndIf
      Else
        ; Restart the timer
         $iStart = TimerInit()
      EndIf
      $aLastPos = $aPos
   WEnd
EndFunc  ;==>_DelayedMouseGetPosNColor

Phillip

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...