Jump to content
Sign in to follow this  
aphesia

msgbox yes/no 10 sec then no?

Recommended Posts

aphesia

how can i make a msgbox which asks for yes & no and if i click no , it does smth.. if nothing happens after 10 secs it will automatically press yes

or just a ok button .. if i click it smth happens, if i dont cklick it , after 10 seconds smth other will happen :D

thx :o

Share this post


Link to post
Share on other sites
Paulie

how can i make a msgbox which asks for yes & no and if i click no , it does smth.. if nothing happens after 10 secs it will automatically press yes

or just a ok button .. if i click it smth happens, if i dont cklick it , after 10 seconds smth other will happen :D

thx :o

Switch MsgBox(4, "Title!", "Question?", 10)
Case 6
;Yes was pressed
Case 7
;No was pressed
Case -1
;Timed out
EndSwitch

Share this post


Link to post
Share on other sites
aphesia

doesnt rly work:

Switch MsgBox(4, "Title!", "Question?", 10)

if Case 6 then

exit

endif

;Yes was pressed

if Case = 7 then

exit

endif

;No was pressed

Case -1

;Timed out

EndSwitch

doesnt matter which button i press , it wont quit

Share this post


Link to post
Share on other sites
Kip

Why do you change the script? The only thing you had to do is replace the comments.

Anyway,

"if Case = 7 then"

'Case' isn't some kind of variable, it's a statement (like If and While).

"Case 7" does the job perfectly.

Share this post


Link to post
Share on other sites
aphesia

it doesnt matter if i do it with case = 7 then exit or not

it closes when trying only this little script.. but somehow it doesnt work with my whole program

so is this what u meant:

Switch MsgBox(4, "Title!", "Question?", 10)

Case 6

;Yes was pressed

Case 7

exit

;No was pressed

Case -1

exit

;Timed out

EndSwitch

Share this post


Link to post
Share on other sites
trancexx

it doesnt matter if i do it with case = 7 then exit or not

it closes when trying only this little script.. but somehow it doesnt work with my whole program

so is this what u meant:

Switch MsgBox(4, "Title!", "Question?", 10)

Case 6

;Yes was pressed

Case 7

exit

;No was pressed

Case -1

exit

;Timed out

EndSwitch

smth is wrong

post some code from the failing script


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
Kip

Works perfectly:

Switch MsgBox(4, "Title!", "Question?", 10)
    Case 6
    ;Yes was pressed
        MsgBox(0,"sdsd","Yes")
    Case 7
        MsgBox(0,"sdsd","Nope")
        exit
    ;No was pressed
    Case -1
        MsgBox(0,"sdsd","Went to the bathroom again?")
        exit
    ;Timed out
EndSwitch

Share this post


Link to post
Share on other sites
yehia

workarounds always have to be stupid take a look here :D

Dim $YN = 0

$Y = MsgBox(4,"Your Title!","cool?",10)

Switch $Y
    Case 6
        $YN = 1
    Case 7
        $YN = 2
EndSwitch

If $YN = 1 Then
    MsgBox(0,"Yes","U clicked Yes")
Else
    MsgBox(0,"No","NO!")
EndIf

Share this post


Link to post
Share on other sites
trancexx

Works perfectly:

Switch MsgBox(4, "Title!", "Question?", 10)
    Case 6
;Yes was pressed
        MsgBox(0,"sdsd","Yes")
    Case 7
        MsgBox(0,"sdsd","Nope")
        exit
;No was pressed
    Case -1
        MsgBox(0,"sdsd","Went to the bathroom again?")
        exit
;Timed out
EndSwitch
Yes, works for you, but apparently it's not working for aphesia.

Btw, you need to create a designer UDF.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
aphesia

this is my program.. i know its a bit difficult coded :D

#include <FF.au3>

#include <reducemem.au3>

Switch MsgBox(4, "Title!", "Run it?", 10)

if Case 6 Then

Exit

EndIf

;Yes was pressed

if Case 7 Then

Exit

EndIf

;No was pressed

Case -1

;Timed out

EndSwitch

Opt("WinTitleMatchMode", -2)

$loaded = 0

$loaded2 = 0

$loaded3 = 0

$loaded4 = 0

$loaded5 = 0

$loaded6 = 0

$loaded7 = 0

$1 = 0

$2 = 0

$3 = 0

$4 = 0

$5 = 0

$6 = 0

$7 = 0

$8 = 0

$9 = 0

$10 = 0

$name = 0

$url1 = "0"

$url2 = "0"

$sURL = "0"

$ende = 0

_FFStart("http://somelinkhere.com",default,2)

If _FFIsConnected() Then

_FFClickImage("/gohome.png","src")

If _FFLoadWait() Then $loaded = 1

WinSetState ( "firefox" , "", @SW_MAXIMIZE )

sleep(10000)

EndIf

while 1

_ReduceMemory()

if $loaded = 1 Then

MouseClick("left", 441, 395, 1)

sleep (3000)

$Letter = Chr(Random(Asc("a"), Asc("z"), 1))

send($Letter)

$1 = $Letter

sleep(1000)

$Letter = Chr(Random(Asc("a"), Asc("z"), 1))

send($Letter)

$2 = $Letter

sleep(1000)

$Letter = Chr(Random(Asc("a"), Asc("z"), 1))

send($Letter)

$3 = $Letter

sleep(1000)

$Letter = Chr(Random(Asc("a"), Asc("z"), 1))

send($Letter)

$4 = $Letter

sleep(1000)

$Letter = Chr(Random(Asc("a"), Asc("z"), 1))

send($Letter)

$5 = $Letter

sleep(1000)

$Letter = Chr(Random(Asc("a"), Asc("z"), 1))

send($Letter)

$6 = $Letter

sleep(1000)

$Letter = Chr(Random(Asc("a"), Asc("z"), 1))

send($Letter)

$7 = $Letter

sleep(1000)

$Letter = Chr(Random(Asc("a"), Asc("z"), 1))

send($Letter)

$8 = $Letter

sleep(1000)

$Letter = Chr(Random(Asc("a"), Asc("z"), 1))

send($Letter)

$9 = $Letter

sleep(1000)

$Letter = Chr(Random(Asc("a"), Asc("z"), 1))

send($Letter)

$10 = $Letter

sleep(1000)

$name = $1 & $2 & $3 & $4 & $5 & $6 & $7 & $8 & $9 & $10

MouseClick("left", 439, 653, 1)

$loaded = 0

EndIf

If _FFIsConnected() Then

_FFClickImage("/gohome.png","src")

If _FFLoadWait() Then $loaded2 = 1

EndIf

If $loaded2 = 1 Then

sleep(5000)

$url1 = "http://"

$url2 = ".lala"

$sURL = $url1 & $name & $url2

_FFStart("" & $sURL,default,2)

$loaded3 = 1

EndIf

if $loaded3 = 1 Then

MouseClick("left", 748, 748, 1)

If _FFLoadWait() Then

$loaded4 = 1

$loaded3 = 0

EndIf

EndIf

if $loaded4 = 1 Then

MouseClick("left", 648, 390, 1)

If _FFLoadWait() Then

$loaded5 = 1

$loaded4 = 0

EndIf

EndIf

if $loaded5 = 1 Then

MouseClick("left", 736, 736, 1)

If _FFLoadWait() Then

$loaded6 = 1

$loaded5 = 0

EndIf

EndIf

if $loaded6 = 1 Then

MouseClick("left", 609, 596, 1)

if _FFLoadWait() = 0 then

Sleep(3000)

Else

$loaded6 = 0

If _FFLoadWait() Then $loaded7 = 1

EndIf

EndIf

if $loaded7 = 1 Then

$ende1 = $ende + 1

$ende = $ende1

if $ende1 = 4 Then

_FFquit()

Filemove("C:\hello.txt", "Z:\mybrute\hello.txt" )

exit

Else

sleep(5000)

$loaded3 = 1

EndIf

EndIf

wend

Edited by aphesia

Share this post


Link to post
Share on other sites
Jos

... did you try to implement the posted Switch/Case example?

What you posted now if not even close to being valid syntax. Use au3check to help you with that.

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
aphesia

this one is the only one i havent tried yet:

Dim $YN = 0

$Y = MsgBox(4,"Your Title!","cool?",10)

Switch $Y

Case 6

$YN = 1

Case 7

$YN = 2

EndSwitch

If $YN = 1 Then

MsgBox(0,"Yes","U clicked Yes")

Else

MsgBox(0,"No","NO!")

EndIf

and i will do it as soon as possible but i dont have firefox on my main laptop :D

Share this post


Link to post
Share on other sites
Jos

this one is the only one i havent tried yet:

Dim $YN = 0

$Y = MsgBox(4,"Your Title!","cool?",10)

Switch $Y

Case 6

$YN = 1

Case 7

$YN = 2

EndSwitch

If $YN = 1 Then

MsgBox(0,"Yes","U clicked Yes")

Else

MsgBox(0,"No","NO!")

EndIf

and i will do it as soon as possible but i dont have firefox on my main laptop :D

Did you try the first one posted which looks to me the way to go?

This scriptlet should work to but doesn't make sense to add the additional variable and If's.

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
TheOnlyOne

Switch MsgBox(4, "Title!", "Run it?", 10)
if Case 6 Then
Exit
EndIf
;Yes was pressed
if Case 7 Then
Exit
EndIf
;No was pressed
Case -1
;Timed out
EndSwitch

switch that to this:

Switch MsgBox(4, "Title!", "Run it?", 10)
Case 6 Then
Exit
EndIf
;Yes was pressed
Case 7 Then
Exit
EndIf
;No was pressed
Case -1
;Timed out
EndSwitch
Edited by TheOnlyOne

Share this post


Link to post
Share on other sites
Jos

Switch MsgBox(4, "Title!", "Run it?", 10)
if Case 6 Then
Exit
EndIf
;Yes was pressed
if Case 7 Then
Exit
EndIf
;No was pressed
Case -1
;Timed out
EndSwitch

switch that to this:

Switch MsgBox(4, "Title!", "Run it?", 10)
if Case 6 Then
Exit
EndIf
;Yes was pressed
if Case 7 Then
Exit
EndIf
;No was pressed
Case -1
;Timed out
EndSwitch
Have you even tried this before posting? (or did you paste the wrong code in the second section?)

Would be nice if people refrain from posting these confusing contributions.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
aphesia

ye i tried the first one

Share this post


Link to post
Share on other sites
Jos

ye i tried the first one

. (Jesus, this is like "Pulling teath")

OK. Now help us to help yourself: What was the problem with that ? what went wrong ?


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
aphesia

just try it with my script.. it doesnt work

if i only try the first sctip.. ye np

but try it with my programm.. it wont work.. thats what i wrote already 2 times

Edited by aphesia

Share this post


Link to post
Share on other sites
Kip

I don't get it anymore, you edit your posts after someone responded to it... confusing.

And it also seems that you love putting a Case statement in a If.

The only thing you had to do was replacing the comments. Couldn't be easier, but you still managed to find a way to screw it up.

Edited by Kip

Share this post


Link to post
Share on other sites
aphesia

i havent edited anything after some answer.. the only thing i want to do is to get this yes no timeout thingy working with MY programm

if i only use this script u posted it works.. but if i include it into my script it wont exit

Edited by aphesia

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  

×