Jump to content

Stop Error pop up's


Go to solution Solved by SmOke_N,

Recommended Posts

Hi I have written this script

Global $Version="2014-12-2 - Beta"

#include <misc.au3>
; --BUTTONS --
Global $pg1_all_button_bkcolor=0x66ff ;page 1 for all the buttons (sing in/up & exit)
Global $pg1_main_button_hight=@DesktopHeight/2-50 ;page 1 for the 2 main buttons (sing in/up)
Global $pg1_all_button_color=0xffffff
Global $pg1_all_button_color2=0x99

; -- COLOR VARS --
Global $exit_color_var=0
Global $sign_in_color_var=0
Global $sign_up_color_var=0
Global $back_color_var=0

Global $pg1_page_bkcolor=0x33ff ;page 1 background color
login_screen()

Func login_screen()
    GUIDelete()
    GUICreate("MY OS",@DesktopWidth,@DesktopHeight,0,0,0x80000000)
    guictrlcreatelabel("Welcome to, My OS",@DesktopWidth/2-170,10,400,50)
        GUICtrlSetFont(-1,30,10000)
        GUISetBkColor($pg1_page_bkcolor)

    $sign_in=GUICtrlCreateButton("Sign In",30,$pg1_main_button_hight,@DesktopWidth/2-100,@DesktopHeight/4,0x8000)
        GUICtrlSetFont(-1,100,100)
        GUICtrlSetColor(-1,$pg1_all_button_color)
        GUICtrlSetBkColor(-1,$pg1_all_button_bkcolor)

    $sign_up=GUICtrlCreateButton("Sign Up",@DesktopWidth-@DesktopWidth/2+70,$pg1_main_button_hight,@DesktopWidth/2-100,@DesktopHeight/4,0x8000)
        GUICtrlSetFont(-1,100,100)
        GUICtrlSetColor(-1,$pg1_all_button_color)
        GUICtrlSetBkColor(-1,$pg1_all_button_bkcolor)

    $exit=GUICtrlCreateButton("Exit",@DesktopWidth-205,@DesktopHeight-75,180,65,0x8000)
        GUICtrlSetFont(-1,25,100)
        GUICtrlSetColor(-1,$pg1_all_button_color)
        GUICtrlSetBkColor(-1,$pg1_all_button_bkcolor)

    GUICtrlCreateLabel("Version - "&$Version,10,@DesktopHeight-35,200,15)
    GUICtrlCreateLabel("Programed By Jacob Stewart",10,@DesktopHeight-20,200,15)

    GUISetState()
    While 1
        $gui_msg=GUIGetMsg()
        $mouse_msg=GUIGetCursorInfo()
        If $gui_msg=$exit or _IsPressed("1B") then exit

        If $gui_msg=$sign_in Then
            sign_in()
        ElseIf $gui_msg=$sign_up Then
            sign_up()
        EndIf

        ;$exit
        If $mouse_msg[4]=$exit and $exit_color_var=0 Then
            $exit_color_var=1
            GUICtrlSetColor($exit,$pg1_all_button_color2)
        ElseIf  $exit_color_var=1 and $mouse_msg[4]<>$exit Then
            $exit_color_var=0
            GUICtrlSetColor($exit,$pg1_all_button_color)
        EndIf

        ;$sign_in
        If $mouse_msg[4]=$sign_in and $sign_in_color_var=0 Then
            $sign_in_color_var=1
            GUICtrlSetColor($sign_in,$pg1_all_button_color2)
        ElseIf  $sign_in_color_var=1 and $mouse_msg[4]<>$sign_in Then
            $sign_in_color_var=0
            GUICtrlSetColor($sign_in,$pg1_all_button_color)
        EndIf

        ;$sign_up
        If $mouse_msg[4]=$sign_up and $sign_up_color_var=0 Then
            $sign_up_color_var=1
            GUICtrlSetColor($sign_up,$pg1_all_button_color2)
        ElseIf  $sign_up_color_var=1 and $mouse_msg[4]<>$sign_up Then
            $sign_up_color_var=0
            GUICtrlSetColor($sign_up,$pg1_all_button_color)
        EndIf

    Wend
EndFunc
















Func sign_up()
    GUIDelete()
    GUICreate("MY OS",@DesktopWidth,@DesktopHeight,0,0,0x80000000)
    guictrlcreatelabel("Sign Up",@DesktopWidth/2-75,10,150,50)
        GUICtrlSetFont(-1,30,10000)
        GUISetBkColor($pg1_page_bkcolor)


    $input_name=GUICtrlCreateInput("",@DesktopWidth/2-250,150,500,30)

    $exit=GUICtrlCreateButton("Exit",@DesktopWidth-205,@DesktopHeight-75,180,65)
        GUICtrlSetFont(-1,25,100)
        GUICtrlSetColor(-1,$pg1_all_button_color)
        GUICtrlSetBkColor(-1,$pg1_all_button_bkcolor)

    $back=GUICtrlCreateButton("Back",10,@DesktopHeight-75,180,65)
        GUICtrlSetFont(-1,25,100)
        GUICtrlSetColor(-1,$pg1_all_button_color)
        GUICtrlSetBkColor(-1,$pg1_all_button_bkcolor)

    GUISetState()
    While 1
        $gui_msg=GUIGetMsg()
        $mouse_msg=GUIGetCursorInfo()
        If $gui_msg=$exit or _IsPressed("1B") then exit

        If $gui_msg=$back Then
            login_screen()
        EndIf

        ;$exit
        If $mouse_msg[4]=$exit and $exit_color_var=0 Then
            $exit_color_var=1
            GUICtrlSetColor($exit,$pg1_all_button_color2)
        ElseIf  $exit_color_var=1 and $mouse_msg[4]<>$exit Then
            $exit_color_var=0
            GUICtrlSetColor($exit,$pg1_all_button_color)
        EndIf

        ;$back
        If $mouse_msg[4]=$back and $back_color_var=0 Then
            $back_color_var=1
            GUICtrlSetColor($back,$pg1_all_button_color2)
        ElseIf  $back_color_var=1 and $mouse_msg[4]<>$back Then
            $back_color_var=0
            GUICtrlSetColor($back,$pg1_all_button_color)
        EndIf
    WEnd
EndFunc

Func sign_in()
    MsgBox(0,"","Signing in...")
    login_screen()
EndFunc

Now if you minimize (go out of) the script $mouse_msg[4] or GUIGetCursorInfo() will play up and give an error because the mouse is not on the gui. How do I stop this? Is there a way to pause the script is the mouse is off the gui?

Thank Jacob

Also fell free to run the code (its safe) and give some tips on how to make it look beater  :thumbsup:

Edited by kingjacob90
Link to comment
Share on other sites

What do you want to do with this? Blue on blue isnt a great combination for color contrast. I cannot minimize the program because it is in full screen mode (I am running windows 7 pro x64 at 1920x1080) but when I ctrl esc the program closes. Without knowing what the program does I would suggest creating it in it's own window.

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Link to comment
Share on other sites

  • Moderators
  • Solution

If IsArray($mouse_msg) Then
            ;$exit
            If $mouse_msg[4]=$exit and $exit_color_var=0 Then
                $exit_color_var=1
                GUICtrlSetColor($exit,$pg1_all_button_color2)
            ElseIf  $exit_color_var=1 and $mouse_msg[4]<>$exit Then
                $exit_color_var=0
                GUICtrlSetColor($exit,$pg1_all_button_color)
            EndIf

            ;$sign_in
            If $mouse_msg[4]=$sign_in and $sign_in_color_var=0 Then
                $sign_in_color_var=1
                GUICtrlSetColor($sign_in,$pg1_all_button_color2)
            ElseIf  $sign_in_color_var=1 and $mouse_msg[4]<>$sign_in Then
                $sign_in_color_var=0
                GUICtrlSetColor($sign_in,$pg1_all_button_color)
            EndIf

            ;$sign_up
            If $mouse_msg[4]=$sign_up and $sign_up_color_var=0 Then
                $sign_up_color_var=1
                GUICtrlSetColor($sign_up,$pg1_all_button_color2)
            ElseIf  $sign_up_color_var=1 and $mouse_msg[4]<>$sign_up Then
                $sign_up_color_var=0
                GUICtrlSetColor($sign_up,$pg1_all_button_color)
            EndIf
    EndIf

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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