Jump to content

Problems....


Roofel
 Share

Recommended Posts

Hello:) While scripting i encountered a small problem with a feature..

Okey, here is the problem, Im currently making a calendar that you can add special dates to and what date its on and then how it can play a pre-chosen soundfile when that date hits:) Ive managed to get make the calendar, make a add item to a list, but then im stuck:) Ive also figured out how i can play that sound file but not if i can time it and such:)

Also, how can i make the "Add button" after youve entered something to the list to work once again?

Sorry if you cant understand it but try:P

Roofel

Edit: Found out the starting thing, added another question:)

Edit: Posted the add button script so you can see whats wrong:)

Func Add()
GUICreate("Add",120,50)

$Input=GUICtrlCreateInput("",0,0,120,20)
$Add3=GUICtrlCreateButton("Legg til", 1, 20,120,30)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Add3
            GUICtrlSetData($liste, GuiCtrlRead($Input))
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
    EndSelect
WEnd
EndFunc
Edited by Roofel

Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D

Link to comment
Share on other sites

Here is the code ive made until now. Just need some help, not finish the whole script:) As I like finding out stuff myself also:P

#include <GUIConstants.au3>
#include <Date.au3>

GUICreate("Kalender",200,250,820,0)

$tab=GUICtrlCreateTab (5,5,190,140)

$tab0=GUICtrlCreateTabItem("Kalender")
$Date = GUICtrlCreateMonthCal("",4,26,189,180)
$tab1=GUICtrlCreateTabItem("Viktige datoer")
$liste = GUICtrlCreateList("",4,26,189,200)
$leggtil = GUICtrlCreateButton("Legg til",4,215,189,30)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $leggtil
            Add()
    EndSelect
    
WEnd

Func Add()
GUICreate("Add",120,50)

$Input=GUICtrlCreateInput("",0,0,120,20)
$Add3=GUICtrlCreateButton("Legg til", 1, 20,120,30)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Add3
            GUICtrlSetData($liste, GuiCtrlRead($Input))
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
    EndSelect
WEnd
EndFunc
Edited by Roofel

Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D

Link to comment
Share on other sites

The problem is that you are not getting out of the sub-loop.

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Add3
            GUICtrlSetData($liste, GuiCtrlRead($Input))
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop;<==========
    EndSelect
WEnd
Link to comment
Share on other sites

Sweet:) Thanks mate, it works good now. Just wondering, got any advice on how to add it to a date in the calendar? Ill make another "popup" after or before button you just fixed:P Just point me in the right direction, couldnt find anything in the help files:O

Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D

Link to comment
Share on other sites

Oh sorry, the things after this function

Func Add()
GUICreate("Add",120,50)

$Input=GUICtrlCreateInput("",0,0,120,20)
$Add3=GUICtrlCreateButton("Legg til", 1, 20,120,30)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Add3
            GUICtrlSetData($liste, GuiCtrlRead($Input))
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
    EndSelect
WEnd
EndFunc

This function adds the thing i write in the inputbox into the list. But how to get the dates to show up in the calendar?(Gonna make a inputbox where you add the date it is supposed to show)

Sorry if you cant understand it, English isnt exactly my motherlanguage:P

Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D

Link to comment
Share on other sites

You mean.. you want the user to enter a date and the calendar to show you that date? If that's so, then study this script:

#include <GUIConstants.au3>
GUICreate( "Get date", 210,190)

$Date = GUICtrlCreateMonthCal ("1953/03/25",10, 10)
GUISetState()

;Sets different dates every second
Sleep(1000)
GUICtrlSetData($Date,"2007/5/12")
Sleep(1000)
GUICtrlSetData($Date,"2025/11/21")

; Run the GUI until the dialog is closed or timeout

Do
   $msg = GUIGetMsg()
   If $msg = $Date Then MsgBox(0,"debug","calendar clicked")
   
Until $msg = $GUI_EVENT_CLOSE

Or even better:

#include <GUIConstants.au3>
GUICreate( "Get date", 210,190)

$Date = GUICtrlCreateMonthCal ("1953/03/25",10, 10)
GUISetState()

Do
   $msg = GUIGetMsg()
   If $msg = $Date Then 
       $DateNew=InputBox("","Enter a date to display in format YY/MM/DD")
       GUICtrlSetData($Date,$DateNew)
    EndIf   
Until $msg = $GUI_EVENT_CLOSE
Edited by Nahuel
Link to comment
Share on other sites

Not really, Im thinking more of having the user put in an date for a important date and when sometime that date hits, it plays of a sound(figured out how to play a sound bit):) hope you understand:P

For example.

User wants to put in a friends birthday, the user puts the date and the name of that event into the calendar, and then when that date hits, it plays off a sound file.

Like a calendar with an alarm with simpler words.

Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D

Link to comment
Share on other sites

And... what exactly can't you do? That sounds simple, all you need to do is check

if SelectedDate=Today then MsgBox('happy birthday!')

Using the functions in Date.au3 will make it easier.

Also, take a look at the macros @MDAY @MON @YEAR

Edited by Nahuel
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...