Sign in to follow this  
Followers 0
dragonheard

if, else, msgbox help please

17 posts in this topic

well i am trying to make a script that does the following: starts when you boot up my/the users computer

asks you if you are allowed to use it

if you click yes you can proceed and the script stops(sometime ill make you put a password in hehehe)

if you click no it will just shutdown your pc

i got the msgbox and startup working

but i dont know what the values of yes or no are

so when i type if yes then shutdown

it doesnt do anything

and when i type

else

msgbox (1,"so you don't","so your not allowed to use it? GOODBYE")

it doesnt show up either when you click anything else then yes.

can anyone please tell me what to type at the IF *value*

thanks,

dragonheurt

Share this post


Link to post
Share on other sites



set the msgbox to a variable. the variable will tell you which button was pressed. check the help file under msgbox for the return values.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

how to put yes and no into different variables?

because i do know how to make one

but is there a command wich does the same as if returnvalue or something since that doesnt exist?

Edited by dragonheard

Share this post


Link to post
Share on other sites

how to put yes and no into different variables?

$var = MsgBox(1, "", "Click OK if you have permission to enter...")
If $var = 1 Then
MsgBox(0, "", "You're in!")
ElseIf $var = 2 Then
MsgBox(0, "", "Get Lost!")
Shutdown(1)
EndIf

Something like this..

Share this post


Link to post
Share on other sites

ohh thanks i'm gonna try that

Share this post


Link to post
Share on other sites

$msg = MsgBox(4, "Title", "Text") ;this is a message box that displays a 'Yes' and 'No'
If $msg = 6 Then MsgBox(0, "Return", "You pressed 'Yes'")
If $msg = 7 Then MsgBox(0, "Return", "You pressed 'No'")

Share this post


Link to post
Share on other sites

thanks a lot both of you works like a charm hehehe

i got one last question (for now lool)

is there any way to keep it on top so when you try to click outside it you'll get the well known DUNG sound?

Share this post


Link to post
Share on other sites

Dunno, beyond my limited knowledge.. muttley

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

One of the options for MsgBox is setting the top-most attribute (look at the second to the last option in the help file). Regarding playing the sound, you would have to script that yourself. At that point, it may be better to create your own "msgbox" GUI that you can better control.

Edit 1,000 posts, yay me :)

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

how to put yes and no into different variables?

because i do know how to make one

but is there a command wich does the same as if returnvalue or something since that doesnt exist?

Dragonheard,

based on the questions you ask I would suggest that you start reading some AutoIt tutorials (click on Wiki at the top of each page). This will teach you the basics of the language.

The questions you will ask then will show us that you have put some effort in learning the language and we will be happy to help you.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Dunno, beyond my limited knowledge.. muttley

hahaha lol

One of the options for MsgBox is setting the top-most attribute (look at the second to the last option in the help file). Regarding playing the sound, you would have to script that yourself. At that point, it may be better to create your own "msgbox" GUI that you can better control.

Edit 1,000 posts, yay me :)

hmm thanks ima try that and with the DUNG sound i mean the windows sound xD windows does it when you get an error lol

Dragonheard,

based on the questions you ask I would suggest that you start reading some AutoIt tutorials (click on Wiki at the top of each page). This will teach you the basics of the language.

The questions you will ask then will show us that you have put some effort in learning the language and we will be happy to help you.

i did and ill allways do but i like learning from doing it myself its how i learned vars and color clicking i also read the help files from scite i was just asking since i couldnt find it...

thanks for the reply and tip though =)

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Are you using the scite editor ? I really suggest using it. Also get really used to using the built in help files. They are fantastic and almost everything has a great example at the bottom.

Just saw your other thread, I hope you aren't working on childish scripts to annoy people. Sigh.

Edited by Attckdog

A true renaissance man

Share this post


Link to post
Share on other sites

Are you using the scite editor ? I really suggest using it. Also get really used to using the built in help files. They are fantastic and almost everything has a great example at the bottom.

Just saw your other thread, I hope you aren't working on childish scripts to annoy people. Sigh.

yepp i am using the scite editor because it really helps its much easier

and the help files r awesome too i read em almost everyday lol

and about the spam script it wasnt really to annoy anyone i wanted to learn how to make a gui and seems a spammer can use one..

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

and about the spam script it wasnt really to annoy anyone i wanted to learn how to make a gui and seems a spammer can use one..

Even an intelligent app developer can too :mellow: If you're using SciTe and you utilize the help file... there shouldn't be a need to ask all of these silly questions as both features (yes&no buttons + the set on top attribute) are documented in the msgbox() function and is easily understandable. Edited by mechaflash213

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

i got it working allready,

yes i did ask about the $var thingy because i didnt know about that

im not a pro doing this as a job ima newb trying to learn it

and even u mecha forgot to declare your variables....

Share this post


Link to post
Share on other sites

and even u mecha forgot to declare your variables....

Whutchu talkin' 'bout Willis?


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

as long as you understand the concept. this concept of return values is a constant thing in many languages so its good to learn it as soon as you can. if there isnt anymore questions we can mark this as resolved instead of attacking each other :)

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