Sign in to follow this  
Followers 0
HardHackz

GUI Buttons

9 posts in this topic

I'm using this function along with a couple others to make a media player type thing. The problem I'm having is this:

The hotkeys work fine but the buttons don't do anything, if I don't have the

While 1
     Sleep(1000)
WEnd
oÝ÷ Ú+±«­¢f­Æ¥!Þ­è¬'îW(u殶­s`¢6æ6ÇVFRfÇCµ6÷VæBæS2fwC° ¢b33c·6÷VæBÒgV÷C¶æ6ÇVFRb3#¶×W62æ×2gV÷C°¢b33c·6÷VæBÒõ6÷VæD÷Vâb33c·6÷VæBÂgV÷Cµ6÷VæBgV÷C²¤uT7&VFRgV÷C´uT3gV÷C²ÃSÃS¤uT6WE7FFR5uõ4õr¢b33c¶'WGFöãÔuT7G&Ä7&VFT'WGFöâgV÷CµÆgV÷C²ÂÓÂÓ¢b33c¶'WGFöã#ÔuT7G&Ä7&VFT'WGFöâgV÷CµW6RgV÷C²ÂÓÂÓ¢b33c¶'WGFöã3ÔuT7G&Ä7&VFT'WGFöâgV÷Cµ7F÷gV÷C²ÂÓÂÓ¢b33c¶'WGFöãCÔuT7G&Ä7&VFT'WGFöâgV÷Cµ&W7VÖRgV÷C²ÂÓÂÓ¤÷D¶W6WBgV÷Cµâµ2gV÷C²ÂgV÷Cµ÷ÆgV÷C²¤÷D¶W6WBgV÷C·´U47ÒgV÷C²ÂgV÷Cµ÷FW&ÖæFRgV÷C²¤÷D¶W6WBgV÷C·´cwÒgV÷C²ÂgV÷Cµ÷W6RgV÷C²¤÷D¶W6WBgV÷C·´cÒgV÷C²ÂgV÷Cµ÷7F÷gV÷C²¤÷D¶W6WBgV÷C·´cÒgV÷C²ÂgV÷Cµ÷&W7VÖRgV÷C²¥vÆR 6ÆVW¥tVæ@¥vÆR¢b33c¶×6sÔuTvWD×6r¢6VÆV7@¢66Rb33c¶×6sÒb33c´uTôUdTåEô4Äõ4P¢WDÆö÷¢66Rb33c¶×6sÒb33c¶'WGFöã õ6÷VæEÆgV÷Cµ6÷VæBgV÷C²¢66Rb33c¶×6sÒb33c¶'WGFöã ¢õ6÷VæEW6RgV÷Cµ6÷VæBgV÷C² 66Rb33c¶×6sÒb33c¶'WGFöã0 õ6÷VæE7F÷gV÷Cµ6÷VæBgV÷C² 66Rb33c¶×6sÒb33c¶'WGFöã@ õ6÷VæE&W7VÖRgV÷Cµ6÷VæBgV÷C² ¢VæE6VÆV7@¥tVæ@¤gVæ2÷FW&ÖæFR W@¤VæDgVæ0¤gVæ2÷Æ õ6÷VæEÆgV÷Cµ6÷VæBgV÷C²¤VæDgVæ0¤gVæ2÷W6R õ6÷VæEW6RgV÷Cµ6÷VæBgV÷C²¤VæDgVæ0¤gVæ2÷7F÷ õ6÷VæE7F÷gV÷Cµ6÷VæBgV÷C²¤VæDgVæ0¤gVæ2÷&W7VÖR õ6÷VæE&W7VÖRgV÷Cµ6÷VæBgV÷C²¤VæDgVæ0

[center]My BlogOldSock Programs (AutoIT Apps)A Message to Hackers! (NOT SKIDDIES!)OldSock Programs is my little "company."[/center]

Share this post


Link to post
Share on other sites



Thought about getting rid of the loop your stuck in?

While 1
    Sleep(1000)
WEnd


[center]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.[/center]

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

and replace GUISetState(@SW_SHOW) avant while 1

...

GUISetState(@SW_SHOW)

while 1

....


Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

Share this post


Link to post
Share on other sites

example

#include <GUIConstants.au3>
#include <Sound.au3>

Opt("GUIOnEventMode", 1)

HotKeySet("^+S","_play")
HotKeySet("{ESC}","_terminate")
HotKeySet("{F7}","_pause")
HotKeySet("{F8}","_stop")
HotKeySet("{F9}","_resume")

$sound = "include\music.mp3"
$sound = _SoundOpen($sound,"Sound")


$GUI = GUICreate("GUI#", 500, 500, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE,"_terminate")

$Button1 = GUICtrlCreateButton("Play", 8, 48, 75, 25, 0)
GUICtrlSetOnEvent(-1, "_play")
$Button2 = GUICtrlCreateButton("Pause", 8, 112, 75, 25, 0)
GUICtrlSetOnEvent(-1, "_pause")
$Button3 = GUICtrlCreateButton("Stop", 8, 80, 75, 25, 0)
GUICtrlSetOnEvent(-1, "_stop")
$Button4 = GUICtrlCreateButton("Resume", 8, 16, 75, 25, 0)
GUICtrlSetOnEvent(-1, "_resume")

GUISetState(@SW_SHOW)

While 1
    sleep(100)
WEnd


Func _terminate()
    Exit
EndFunc

Func _play()
    _SoundPlay("Sound")
EndFunc

Func _pause()
    _SoundPause("Sound")
EndFunc

Func _stop()
    _SoundStop("Sound")
EndFunc

Func _resume()
    _SoundResume("Sound")
EndFunc

Me frappe pas !! je débute dans le monde du code :)Un novice avertit en vaut dix sans ennuie ;)AuToiT-FR

Share this post


Link to post
Share on other sites

To make things a bit easier for you, where you don't have to post 40 questions a day, why don't you download SciTe editor, in the output plane at the bottom, you will see 90% of the time what issues your script has.

If you remove what I said and put #include <guiconstants.au3> at the top as anib pointed out (with no need to do OnEventMode) you will see you will not be exited.

Further more, if using SciTe and you don't understand the error you are getting, the easiest way to get a "correct" answer is to post the entire scite plane and the code that it is erroring with.


[center]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.[/center]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

To make things a bit easier for you, where you don't have to post 40 questions a day, why don't you download SciTe editor, in the output plane at the bottom, you will see 90% of the time what issues your script has.

If you remove what I said and put #include <guiconstants.au3> at the top as anib pointed out (with no need to do OnEventMode) you will see you will not be exited.

Further more, if using SciTe and you don't understand the error you are getting, the easiest way to get a "correct" answer is to post the entire scite plane and the code that it is erroring with.

Thanks guys, and I do try that, but I'm a total n00b, trust me, I'm not posting all my questions...

To avoid spamming, I'll use this same post for another question. I now have this:

; Thanks SmOke_N and anib!
#include <GUIConstants.au3>
#include <Sound.au3>

Opt("GUIOnEventMode", 1)


$sound = "C:\Documents and Settings\Compaq_Owner\Desktop\John\John's Music\BassHunter - I'm your basscreator.mp3"
$sound = _SoundOpen($sound, "Sound")

HotKeySet("^+S", "_play")
HotKeySet("{ESC}", "_terminate")
HotKeySet("{F7}", "_pause")
HotKeySet("{F8}", "_stop")

$GUI = GUICreate("Music GUI", 500, 500, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "_terminate")

$Button1 = GUICtrlCreateButton("Play", 8, 48, 75, 25, 0)
GUICtrlSetOnEvent(-1, "_play")
$Button2 = GUICtrlCreateButton("Pause", 8, 112, 75, 25, 0)
GUICtrlSetOnEvent(-1, "_pause")
$Button3 = GUICtrlCreateButton("Stop", 8, 80, 75, 25, 0)
GUICtrlSetOnEvent(-1, "_stop")
GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd


Func _terminate()
    Exit
EndFunc
Func _play()
    _SoundPlay("Sound")
EndFunc
Func _pause()
    _SoundPause("Sound")
EndFunc
Func _stop()
    _SoundStop("Sound")
EndFunc

I now want to setup a list that has all the .mp3s and .wavs in a certain directory. I know I'm going to be using

GUICtrlCreateListView

and

GUICtrlCreateListViewItem

I don't really understand how or what the difference is between these two or how to use them. I DID look in the documentation and didn't really understand it.

Thanks in advance,

.::HardHackz::.

Edited by HardHackz

[center]My BlogOldSock Programs (AutoIT Apps)A Message to Hackers! (NOT SKIDDIES!)OldSock Programs is my little "company."[/center]

Share this post


Link to post
Share on other sites

I now want to setup a list that has all the .mp3s and .wavs in a certain directory. I know I'm going to be using

GUICtrlCreateListView

and

GUICtrlCreateListViewItem

I don't really understand how or what the difference is between these two or how to use them. I DID look in the documentation and didn't really understand it.

Thanks in advance,

.::HardHackz::.

D you understand the differences between a Tab and a TabItem or a Menu and a MenuItem? Apply the same thinking to ListView and ListViewItem.

The Listview is the control and the ListViewItems are items within that control. In other words you need both. First create the listview and then the listviewitems.

BTW: Now that you have the GUISetState i the right place you should be able to get rid of that sleep loop.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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