Sign in to follow this  
Followers 0
tedesco

Dumb as a button!

4 posts in this topic

Pleasae help me. I can not figure out for the life of me why my buttons wont work. if i take the scroll bar away they work? whenIi put it back they don't?

-----------------------------

code:

#region

#include <windowsconstants.au3>

#include <GUIConstants.au3>

#include <EzSkin.au3>

#include "Scroller.au3"

$file = FileOpen("Important_Contacts.txt", 0)

$sText = FileRead("C:\Users\tedescoj.USMMA\Dropbox\Bushkill Rentals\Guestname.txt")

$chars = FileRead($file)

$iW = 640

$iH = Int($iW * 9 / 16)

$hGUI = GUICreate("Bushkill Rentals", $iW, $iH, -1, -1, Default, $WS_EX_COMPOSITED)

GuiCtrlSetState(-1,$GUI_DISABLE)

$Label1 = GUICtrlCreateLabel("Welcome To Bushkill Rentals.", 260, 50, 180, 17)

$Label2 = GUICtrlCreateLabel("Enjoy Your Vacation!", 290, 70, 140, 17)

$Label3 = GUICtrlCreateLabel("Copyright © Bushkillrentals.com!", 460, 530, 200, 17)

$Button1 = GUICtrlCreateButton("Things To Do", 150, 150, 110, 30) ;, $font_color)

$Button2 = GUICtrlCreateButton("Important Contact Info.", 390, 150, 169, 30) ;, $font_color)

$Button3 = GUICtrlCreateButton("Internet", 770, 150, 110, 30) ;, $font_color)

$Button4 = GUICtrlCreateButton("Google Maps", 150, 250, 110, 30) ;, $font_color)

$Button5 = GUICtrlCreateButton("Local Weather", 420, 250, 110, 30) ;, $font_color)

GUISetState()

$aHScroller2= Scroller_Init($hGUI, $iH - 64, $sText, "Comic Sans MS", 24, 0, 0, True, True)

If @error Then Exit MsgBox(16, "ERROR", "Unable to initiate scroller", 10)

AdlibRegister("Scroll_It", 30)

Do

Until GUIGetMsg()= -3

_Exit()

Func Scroll_It()

Scroller_Move($aHScroller2, 1)

EndFunc

Func _Exit()

AdlibUnRegister("Scroll_It")

Exit

EndFunc

While 1

$msg = GUIGetMsg()

Select

If $msg = $EzIcon[1] Then Exit

If $msg = $EzIcon[2] Then GuiSetstate(@SW_MINIMIZE, $hGUI)

If $msg = $Button1 Then ShellExecuteWait("http://bushkillrentals.com/things-to-do.html")

If $msg = $Button2 Then MsgBox(0, "Important Contacts:", $chars)

FileClose($file)

If $msg = $Button3 Then ShellExecuteWait("http://www.google.com/search?hl=en&q=bushkillrentals.com&gl=us")

If $msg = $Button4 Then ShellExecuteWait("http://maps.google.com/maps?saddr=5728+Decker+Road,+Bushkill,+PA+18324+(Saw+Creek+Estates+Community+Association)&daddr=bushkill,+PA&hl=en&ll=41.098629,-75.02718&spn=0.065844,0.143337&sll=41.140916,-75.052242&sspn=0.065802,0.143337&geocode=FVVucwIddcuG-yHKQXVyHJ6vkyknEfNVpZzEiTHKQXVyHJ6vkw%3BFXctcwIdF4uH-yndql5scmLDiTHPw7PPaxNM7A&mra=prev&t=m&z=13")

If $msg = $Button5 Then ShellExecuteWait("http://www.weather.com/weather/right-now/Bushkill+PA+18324")

EndSelect

WEnd

#endregion

Share this post


Link to post
Share on other sites



Your script is completely goobered. Look in the help file for how select works.

What is the point of:?

Do

Until GUIGetMsg() = -3

Also when posting there is a button on the edit bar to nicely drop in autoit script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Your Do...Until Loop is blocking the buttons from being activated, get rid of it because it isn't necessary because you already have a While loop in there.

Your Select isn't doing anything because you used it wrong, you need to use Case with Select, not If. Something like this:

Select
         Case $msg = $EzIcon[1]
             Exit
         Case $msg = $EzIcon[2]
             GUISetState(@SW_MINIMIZE, $hGUI)
         Case $msg = $Button1
             ShellExecuteWait("[url="http://bushkillrentals.com/things-to-do.html"]http://bushkillrentals.com/things-to-do.html[/url]")
         Case $msg = $Button2
             MsgBox(0, "Important Contacts:", $chars)
         Case $msg = $Button3
             ShellExecuteWait("[url="http://www.google.com/search?hl=en&q=bushkillrentals.com&gl=us"]http://www.google.com/search?hl=en&q=bushkillrentals.com&gl=us[/url]")
         Case $msg = $Button4
             ShellExecuteWait("[url="http://maps.google.com/maps?saddr=5728+Decker+Road,+Bushkill,+PA+18324+(Saw+Creek+Estates+Community+Association)&daddr=bushkill,+PA&hl=en&ll=41.098629,-75.02718&spn=0.065844,0.143337&sll=41.140916,-75.052242&sspn=0.065802,0.143337&geocode=FVVucwIddcuG-yHKQXVyHJ6vkyknEfNVpZzEiTHKQXVyHJ6vkw%3BFXctcwIdF4uH-yndql5scmLDiTHPw7PPaxNM7A&mra=prev&t=m&z=13"]http://maps.google.com/maps?saddr=5728+Decker+Road,+Bushkill,+PA+18324+(Saw+Creek+Estates+Community+Association)&daddr=bushkill,+PA&hl=en&ll=41.098629,-75.02718&spn=0.065844,0.143337&sll=41.140916,-75.052242&sspn=0.065802,0.143337&geocode=FVVucwIddcuG-yHKQXVyHJ6vkyknEfNVpZzEiTHKQXVyHJ6vkw%3BFXctcwIdF4uH-yndql5scmLDiTHPw7PPaxNM7A&mra=prev&t=m&z=13[/url]")
         Case $msg = $Button5
             ShellExecuteWait("[url="http://www.weather.com/weather/right-now/Bushkill+PA+18324"]http://www.weather.com/weather/right-now/Bushkill+PA+18324[/url]")
     EndSelect

EDIT:Almost forgot, get rid of the _Exit() call before the While loop when you delete the Do loop, otherwise it will run your script and then close because of it.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thank you! sorry for posting wrong :thumbsdown:

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