Jump to content

New ISSUE! Functions cant be called twice? did I miss something?


 Share

Recommended Posts

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

$INFO = ("THIS IS THE INFO")

;####################################################

Func EClose()

MSgBox(1, "PMG's Weekly Trip Reports", "You have closed early, Your progress will not be saved.")

FileDelete ( @DesktopDir & "\PMG's Weekly Trip Reports.txt" )

GUIDelete ()

Exit

EndFunc

;####################################################

Func EClose2()

MSgBox(1, "PMG's Weekly Trip Reports", "You have closed early, Your progress will not be saved.")

FileDelete ( @DesktopDir & "\PMG's Weekly Trip Reports.txt" )

GUIDelete ()

Exit

EndFunc

;####################################################

Func NextButton1()

Global $1=GUICtrlRead($date)

Write1()

GUIDelete ()

gui2()

EndFunc

;####################################################

Func NextButton2()

GUIDelete ()

Exit

EndFunc

;####################################################

Func Write1()

$file = FileOpen("PMG's Weekly Trip Reports.txt", 1)

If $file = -1 Then

MsgBox(0, "PMG's Weekly Trip Reports.txt", "An Error Has Accured, Call PMG to have this issue solved.")

Exit

EndIf

FileWrite ( $file, $1)

FileClose ( $file )

EndFunc

;####################################################

Func gui1()

MsgBox(0, "PMG's Weekly Trip Reports.txt", "Welcome to PMG's Weekly Trip Report, Please ensure that you have ample time to complete your log now, there will be no opertunity to save your progress.")

$gui1 = GUICreate ( "PMG's Weekly Trip Reports" , 250, 100)

;COLOR SET

Global $L1 = GUICtrlCreateLabel ( "Date to Log:", 5, 10)

Global $date = GUICtrlCreateDate ( "2006/08/06", 20, 30, 225, 25)

$next1=GUICtrlCreateButton ( "Next", 105, 65)

;$Esc1=GUICtrlCreateButton ( "Close", 120, 65)

GUICtrlSetOnEvent($next1, "NextButton1")

;GUICtrlSetOnEvent($esc1, "Eclose")

GUISetOnEvent($GUI_EVENT_CLOSE, "EClose")

GUISetState (@SW_SHOW)

While 1

Sleep(1000) ; Just idle around

WEnd

EndFunc

;####################################################

Func gui2()

$gui2 = GUICreate ( "PMG's Weekly Trip Reports" , 250, 210)

Global $L2 = GUICtrlCreateLabel ( "Type of Day?", 5, 10)

$ED = GUICtrlCreateRadio ( "Event Day", 15, 25, 200, 25)

$H = GUICtrlCreateRadio ( "Home Day", 15, 50, 200, 25)

$D = GUICtrlCreateRadio ( "Driving Day", 15, 75, 200, 25)

$ST = GUICtrlCreateRadio ( "Set-up Or Tear-down Day", 15, 100, 200, 25)

$F = GUICtrlCreateRadio ( "Fly Day", 15, 125, 200, 25)

$O = GUICtrlCreateRadio ( "Other", 15, 150, 200, 25)

$next2=GUICtrlCreateButton ( "Next", 105, 175)

;$Esc2=GUICtrlCreateButton ( "Close", 120, 65)

GUICtrlSetOnEvent($next2, "NextButton2")

;GUICtrlSetOnEvent($esc2, "Eclose")

GUISetOnEvent($GUI_EVENT_CLOSE, "EClose")

GUISetState (@SW_SHOW)

While 1

Sleep(1000) ; Just idle around

WEnd

EndFunc

;####################################################

;Script that is run, to clean things upa little :whistle:

gui1()

I figured out the date functions thanks to everyone's help :)

but now im having anougther issue... you will notice that both GUI's call the same funtion, yet it only works for the first function... Am I missing something?

I thought maybe Im just assighning the new funtion to the old buttons but I put in the delet gui() so it should clear the gui before it creates the new one... any help please :)?

Also dont be concered with the missing functions for the radio buttons or the facethat i havnt changed WriteFile to WriteFileLine yet :lmao: all things will come in time,

Edited by cdm_Death
Link to comment
Share on other sites

HI,

I wouldn't do that with OnEvent and then you could send a parameter to the func.

I would go ahead with one gui and MessageLoop.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

HI,

I wouldn't do that with OnEvent and then you could send a parameter to the func.

I would go ahead with one gui and MessageLoop.

So long,

Mega

On event seems more fit for this then loop :whistle: but if you insist ill go home and start reading up on that :)

any help with converting my script? im sure it wouldnt take TOO much

Link to comment
Share on other sites

On event seems more fit for this then loop :whistle: but if you insist ill go home and start reading up on that :)

any help with converting my script? im sure it wouldnt take TOO much

I would really liek anouther opinion on this... Im sure its somehting I did that doesnt clear the entore first procces... Please help...

Link to comment
Share on other sites

I had a look at the code earlier and the 2nd Gui has event issue. It is perhaps because you are still within an event driven function trying yet to call another event and failing. Not sure, but you may have to wait to return from an event driven function before the next called event...can happen.

Link to comment
Share on other sites

I had a look at the code earlier and the 2nd Gui has event issue. It is perhaps because you are still within an event driven function trying yet to call another event and failing. Not sure, but you may have to wait to return from an event driven function before the next called event...can happen.

If you remove the While End at the end of function gui2() then the button works. Maybe best to use GuiDelete($1)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...