Jump to content

Quick Question.


Recommended Posts

Okay, someone please help me. I have tried everything I can think of. I am having trouble with an "If statement". I can't get it to do what I want it to do...

Here is the code:

; Speed
GUICtrlCreateGroup ("Speed", 270, 120, 90, 140)
$radio_1 = GUICtrlCreateRadio ("Faster", 290, 140, 50, 20)
$radio_2 = GUICtrlCreateRadio ("Slower", 290, 160, 60, 20)
GuiCtrlSetState(-1, $GUI_CHECKED)
If $radio_1 = GuiCtrlSetState(-1, $GUI_CHECKED) Then
; Fast Label
    GuiCtrlCreateLabel("   !Fast!", 270, 80, 50, 15)
    GuiCtrlSetBkColor(-1, 0x00FF00)
ElseIf $radio_2 = GuiCtrlSetState(-1, $GUI_CHECKED) Then
; Slow Label
    GuiCtrlCreateLabel("   !Slow!", 330, 80, 50, 15)
    GuiCtrlSetBkColor(-1, 0xFF0000)
EndIf
GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

What I want it to do is if $radio_1 is selected then show the green label elseif $radio_2 is selected then show red label.

Link to comment
Share on other sites

Try using

If GuiCtrlRead($radio_1) = $GUI_CHECKED Then

DO THIS IF IT"S CHECKED

Else

DO THIS IF OTHER IS CHECKED

EndIf

My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

; Speed
GUICtrlCreateGroup ("Speed", 270, 120, 90, 140)
$radio_1 = GUICtrlCreateRadio ("Faster", 290, 140, 50, 20)
$radio_2 = GUICtrlCreateRadio ("Slower", 290, 160, 60, 20)
If GuiCtrlRead($radio_1) = $GUI_CHECKED Then
; Fast Label
    GuiCtrlCreateLabel("   !Fast!", 270, 80, 50, 15)
    GuiCtrlSetBkColor(-1, 0x00FF00)
ElseIf GuiCtrlRead($radio_2) = $GUI_CHECKED Then
; Slow Label
    GuiCtrlCreateLabel("   !Slow!", 330, 80, 50, 15)
    GuiCtrlSetBkColor(-1, 0xFF0000)
EndIf
GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

If that is what you wanted me to do, it didn't work. :(

Link to comment
Share on other sites

Did you include the GUI constants?

(#include <GUIConstants.au3>)

My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

Can I see your whole code? because that should be in a looping statement For example

While 1
If GuiCtrlRead($radio_1) = $GUI_CHECKED Then
; Fast Label
    GuiCtrlCreateLabel("   !Fast!", 270, 80, 50, 15)
    GuiCtrlSetBkColor(-1, 0x00FF00)
ElseIf GuiCtrlRead($radio_2) = $GUI_CHECKED Then
; Slow Label
    GuiCtrlCreateLabel("   !Slow!", 330, 80, 50, 15)
    GuiCtrlSetBkColor(-1, 0xFF0000)
EndIf
WEnd
My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

#include <GuiConstants.au3>

; Speed
GUICtrlCreateGroup ("Speed", 270, 120, 90, 140)
$radio_1 = GUICtrlCreateRadio ("Faster", 290, 140, 50, 20)
$radio_2 = GUICtrlCreateRadio ("Slower", 290, 160, 60, 20)
If GuiCtrlRead($radio_1) = $GUI_CHECKED Then
; Fast Label
    GuiCtrlCreateLabel("   !Fast!", 270, 80, 50, 15)
    GuiCtrlSetBkColor(-1, 0x00FF00)
ElseIf GuiCtrlRead($radio_2) = $GUI_CHECKED Then
; Slow Label
    GuiCtrlCreateLabel("   !Slow!", 330, 80, 50, 15)
    GuiCtrlSetBkColor(-1, 0xFF0000)
EndIf
GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

That is all you need to see.

Link to comment
Share on other sites

did you get my last message?

Put it in your loop statement. If you ahve a Select...Case add these to it

Case GuiCtrlRead($radio_1) = $GUI_CHECKED
; Fast Label
    GuiCtrlCreateLabel("   !Fast!", 270, 80, 50, 15)
    GuiCtrlSetBkColor(-1, 0x00FF00)
Case GuiCtrlRead($radio_2) = $GUI_CHECKED
; Slow Label
    GuiCtrlCreateLabel("   !Slow!", 330, 80, 50, 15)
    GuiCtrlSetBkColor(-1, 0xFF0000)
My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

Nothing would come up as in, no controls or no GUI? Put the While...WEnd statement at the bottom of your script.

My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

What's not showing up when you have the While..Wend statement?

My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

Check out this script, this is what I would do, sorry for the delay, my sister just got home from college

#include <GUIConstants.au3>
GuiCreate("Test GUI")
$faster = GuiCtrlCreateRadio("Faster", 0, 0, 75, 15)
$slower = GuiCtrlCreateRadio("Slower", 0, 20, 75, 15)
$fast = GuiCtrlCreateLabel("FAST", 80, 0, 80, 20)
$slow = GuiCtrlCreateLabel("SLOW", 80, 0, 80, 20)
GUICtrlSetState($slow, $GUI_HIDE)
GUICtrlSetState($fast, $GUI_HIDE)
GuiSetState()
While 1
   Select
   Case GuiCtrlRead($faster) = $GUI_CHECKED
      If GuiCtrlGetState($fast) = 96 Then;If FAST is hidden
         GuiCtrlSetState($slow, $GUI_HIDE)
         GuiCtrlSetState($fast, $GUI_SHOW)
      EndIf
   Case GuiCtrlRead($slower) = $GUI_CHECKED
      If GuiCtrlGetState($slow) = 96 Then;If SLOW is hidden
         GuiCtrlSetState($fast, $GUI_HIDE)
         GuiCtrlSetState($slow, $GUI_SHOW)
      EndIf
   EndSelect
WEnd
My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

Woah the code needs to be organized. Um. Most people arent going to want to help with a Xanga Comment Flooder. Could have left that out :( but at the same time I guess you couldnt have.

If you can organize the code with proper spacing... such as below. Then I will see what I can do to give you pointers. Not too many because if you want this to work you will have to work really hard at it. I have no desire for this project to go through but helping people is what I do. You have the power to do with the information as you please. Do not give AutoIt a bad name. That is our biggest concern. Making something like this in AutoIt will definitely do that. If you could explain why you would want such a program more people may be willing to help.

Do
   ;Code to do something
    If $something = $somethingelse Then
       ;Do something different
    EndIf
Until $YourCrazy = 1

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

The reason I am doing this, is for my own personal use on my friends. I want them to wake up and see that they have 255 comments. Plus this is practice for me. I dont see how this would be making autoit look bad considering I will be the only one using it. :-)

<{POST_SNAPBACK}>

Okay... I have the code above. Remove it so no one else will have access to it.

Next thing. I notice it takes you till the very end of the script to make the GUI actually work and be able to close. What trouble are you having with your code?

It appears to me you need to create some functions and get back to using the While...WEnd.

I will see what I can come up with...

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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...