Jump to content

Mind to convert this to GUI new Syntax ?


friends
 Share

Recommended Posts

sorry guys... need your help on the New GUI Syntax conversion !

I know there is GUIConvert program written by CS, but it does not

work after converted.

Your help is very much appreciated. Thank you.

Note : The coding below is not a fully workable one, pending due

to problem of converting it to New GUI Syntax. :">

#include <GUIconstants.au3>


Opt("GUINotifyMode", 1)
Opt("ExpandEnvStrings", 1)
Opt("WinTitleMatchMode", 4)


# -----------------------------------------------
# Checking for application, only one be executed
# -----------------------------------------------

$version = ":: PandaTools :: MIS Utilities v1.0"
IF WinExists ($version) THEN
   MsgBox (48, ":: PandaTools :: MIS Utilities v1.0", "Application is already running.....  ", 3)
   exit
ENDIF

AutoItWinSetTitle($version)



$handle = GuiCreate(":: PandaTools :: MIS Utilities v1.0", 380, 570)

# --------------------
#  Drop-down Calendar
# --------------------

GUISetControl( "group", "Date / Time", 20, 10, 340, 55)
GUISetControl( "date", "", 34, 31, 200, 22)


; start creation of a tab control
GUISetControl("tab", "", 20, 80, 340, 460)
GuiSetControlFont(-1,10,700)        ; to display tab names in bold


# --------------
#  EJournal Tab 
# --------------

; define first tab name
GUISetControl("tabitem", "E-Journal", 1, 60)
   GUISetControlEx(-1,0,0,"",0xff)

   GUISetControl ("Label", ":: EJournal Viewer v1.2 ::", 74, 140, 228, 25, 0x1000)
   GUISetControlFont (-1, 14, 800, "Arial")

   GUISetControl("label", "Select one of the options below :", 80, 200, 210, 15)
   GUISetControlFont (-1, 10, 800, "Arial")
   GUISetControlEx(-1,0,0,"",0)

   GUISetControl( "group", "Options", 70, 230, 240, 130)
   GUISetControlFont (-1, 10, 800, "Arial")
   GUISetGroup()


   # ------------------
   #  EJournal Options
   # ------------------

  ; Create Radio Buttons
   $CurrentRadio = GUISetControl ("radio", " &Current Date EJournal", 90, 260, 165, 20)
   GUISetControlFont (-1, 10, 800, "Arial")

  ; Create Radio Buttons
   $PreviousRadio = GUISetControl ("radio", " &Previous Date EJournal", 90, 290, 170, 20)
   GUISetControlFont (-1, 10, 800, "Arial")

  ; Create Radio Buttons
   $PreviousMonthRadio = GUISetControl ("radio", " Previous &Month EJournal", 90, 320, 180, 20)
   GUISetControlFont (-1, 10, 800, "Arial")


   # ---------------------------------
   #  EJournal - Current Input Fields
   # ---------------------------------

   $POSlabel = GUISetControl ("label", "POS Counter", 70, 385, 85, 16)
   GUISetControlFont (-1, 10, 800, "Arial")
   GUISetControlEx ($POSlabel, $GUI_HIDE)

   $POSInput = GUISetControl ("input", "", 160, 380, 70, 25)
   GUISetControlFont (-1, 12, 800, "Arial")
   GUISetControlEx ($POSInput, $GUI_HIDE)


   # ---------------------------------
   #  EJournal - Previous Input Fields
   # ---------------------------------

   $Daylabel = GUISetControl ("label", "Day To View", 70, 435, 85, 16)
   GUISetControlFont (-1, 10, 800, "Arial")
   GUISetControlEx ($Daylabel, $GUI_HIDE)

   $DayInput = GUISetControl ("input", "", 160, 430, 70, 25)
   GUISetControlFont (-1, 12, 800, "Arial")
   GUISetControlEx ($DayInput, $GUI_HIDE)


# -----------------
#  Downloadlog Tab 
# -----------------

; define second tab name
$test = GUISetControl("tabitem", "Downloadlog", 1, 60)

GUISetControl ("Label", ":: Downloadlog Viewer v1.0 ::", 56, 140, 265, 25, 0x1000)
GUISetControlFont (-1, 14, 800, "Arial")


# ---------------
#  CommAgent Tab 
# ---------------

; define third tab name
GUISetControl("tabitem", "CommAgent", 1, 60)

GUISetControl ("Label", ":: Commagnt Viewer v1.0 ::", 65, 140, 245, 25, 0x1000)
GUISetControlFont (-1, 14, 800, "Arial")


# -----------
#  Server Tab 
# -----------

; define fourth tab name
    GUISetControl("tabitem", "Server", 1, 60)

; end tab definition
GUISetControl("tabitem", "",0,0)


# --------------
#  Main Process
# --------------

GuiShow()



     $Time = @HOUR & ":" & @MIN & ":" & @SEC
     $PrevTime = $Time
     $time_control = GUISetControl("label", $Time, 250, 31, 95, 25)
     GUISetControlFont(-1, 16, 600, "Arial")

     $x = 0


WHILE 1

     # -------------
     #  System Time 
     # -------------

       sleep(1000)

       $x = $x + 1
       $Time = @HOUR & ":" & @MIN & ":" & @SEC
       If $x = 10 OR $PrevTime <> $Time Then
          GUIWrite($time_control, 0, $Time)
          $PrevTime = $Time
          $x = 0
       EndIf

     # ----- [ End of System Time ] -----


       $msg = GUIMsg(0)

       SELECT
          CASE $msg = -3 ;dialog box being closed
               TrayTip(":: PandaTools ::", "Closing program...", 3, 1)
               Sleep (1500)               
               Exit
  
          CASE $msg = $CurrentRadio
               IF GUIRead($CurrentRadio) = 1 THEN
                  CurrentEJournal()
               ENDIF

          CASE $msg = $PreviousRadio
               PreviousEJournal()

          CASE $msg = $PreviousMonthRadio
               PreviousMonthEJournal()
       ENDSELECT
WEND
GUIDelete()
GuiWaitClose()


# ---------------------------
#  User Function Declaration
# ---------------------------


Func CurrentEJournal()
     GUISetControlEx ($PreviousRadio, $GUI_DISABLE)
     GUISetControlEx ($PreviousMonthRadio, $GUI_DISABLE) 

     GUISetControlEx ($POSlabel, $GUI_SHOW)
     GUISetControlEx ($POSInput, $GUI_SHOW)
     GuiSetControlEx (-1, 256, "", "Eg. 1001", 4)  ; Get Focus at input box


     



     IF WinActive("handle=" & $handle) THEN
        HotKeySet("{ESC}", "CancelInput")
     ELSE
         HotKeySet("{ESC}")
     ENDIF

EndFunc


Func PreviousEJournal()
     GUISetControlEx ($CurrentRadio, $GUI_DISABLE)
     GUISetControlEx ($PreviousMonthRadio, $GUI_DISABLE) 

     GUISetControlEx ($POSlabel, $GUI_SHOW)
     GUISetControlEx ($POSInput, $GUI_SHOW)
     GuiSetControlEx (-1, 256, "", "Eg. 1001", 4)  ; Get Focus at input box

     GUISetControlEx ($Daylabel, $GUI_SHOW)
     GUISetControlEx ($DayInput, $GUI_SHOW) 
     GuiSetControlEx (-1, -1, "", "Eg. 05", 2)
EndFunc


Func PreviousMonthEJournal()
     GUISetControlEx ($CurrentRadio, $GUI_DISABLE)
     GUISetControlEx ($PreviousRadio, $GUI_DISABLE) 

     GUISetControlEx ($POSlabel, $GUI_SHOW)
     GUISetControlEx ($POSInput, $GUI_SHOW)
     GuiSetControlEx (-1, 256, "", "Eg. 1001", 4)  ; Get Focus at input box

     GUISetControlEx ($Daylabel, $GUI_SHOW)
     GUISetControlEx ($DayInput, $GUI_SHOW) 
     GuiSetControlEx (-1, -1, "", "Eg. 05", 2)
EndFunc


Func CancelInput()
     GUISetControlEx ($CurrentRadio, $GUI_ENABLE)     
     GUISetControlEx ($CurrentRadio, $GUI_UNCHECKED)     
     GUISetControlEx ($PreviousRadio, $GUI_ENABLE)
     GUISetControlEx ($PreviousRadio, $GUI_UNCHECKED)
     GUISetControlEx ($PreviousMonthRadio, $GUI_ENABLE) 
     GUISetControlEx ($PreviousMonthRadio, $GUI_UNCHECKED) 

     GUIWrite ($POSInput, 0, "")
     GUIWrite ($DayInput, 0, "")
     GUISetControlEx ($POSlabel, $GUI_HIDE)
     GUISetControlEx ($POSInput, $GUI_HIDE)
     GUISetControlEx ($Daylabel, $GUI_HIDE)
     GUISetControlEx ($DayInput, $GUI_HIDE)
EndFunc
Link to comment
Share on other sites

After running it through my conversion script you need to remove any remaining GuiWrite lines and remove Opt("GuiNotifyMode", 1)

There might be other issues, but the script should at least run without crashing on startup...

#include <GUIconstants.au3>

;;;;;Opt("GUINotifyMode",1)
Opt ("ExpandEnvStrings", 1)
Opt ("WinTitleMatchMode", 4)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Checking For application, only one be executed
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

$VERSION = "::PandaTools::MIS Utilities v1.0"
If WinExists($VERSION) Then
   MsgBox(48, "::PandaTools::MIS Utilities v1.0", "Application is already running.....", 3)
   Exit
EndIf

AutoItWinSetTitle($VERSION)



$HANDLE = GUICreate("::PandaTools::MIS Utilities v1.0", 380, 570)

# - - - - - - - - - - - - - - - - - - - -
# Drop - down Calendar
# - - - - - - - - - - - - - - - - - - - -

GUICtrlCreateGroup ("Date/Time", 20, 10, 340, 55)
GUICtrlCreatedate ("", 34, 31, 200, 22)


; start creation of a tab control
GUICtrlCreatetab (20, 80, 340)
GuiCtrlSetFont (-1, 10, 0, 700); to display tab names in bold


# - - - - - - - - - - - - - -
# EJournal Tab
# - - - - - - - - - - - - - -

; define first tab name
GUICtrlCreatetabitem ("E-Journal")
GuiCtrlSetTip (-1, "")
GuiCtrlSetLimit (-1, 0xff)

GUICtrlCreateLabel ("::EJournal Viewer v1.2::", 74, 140, 228, 25, 0x1000)
GuiCtrlSetFont (-1, 14, "Arial", 800)

GUICtrlCreatelabel ("Select one of the options below:", 80, 200, 210, 15)
GuiCtrlSetFont (-1, 10, "Arial", 800)
GuiCtrlSetTip (-1, "")
GuiCtrlSetLimit (-1, 0)

GUICtrlCreategroup ("Options", 70, 230, 240, 130)
GuiCtrlSetFont (-1, 10, "Arial", 800)
GuiStartGroup ()


# - - - - - - - - - - - - - - - - - -
# EJournal Options
# - - - - - - - - - - - - - - - - - -

; Create Radio Buttons
$CURRENTRADIO = GUICtrlCreateradio ("&Current Date EJournal", 90, 260, 165, 20)
GuiCtrlSetFont (-1, 10, "Arial", 800)

; Create Radio Buttons
$PREVIOUSRADIO = GUICtrlCreateradio ("&Previous Date EJournal", 90, 290, 170, 20)
GuiCtrlSetFont (-1, 10, "Arial", 800)

; Create Radio Buttons
$PREVIOUSMONTHRADIO = GUICtrlCreateradio ("Previous&Month EJournal", 90, 320, 180, 20)
GuiCtrlSetFont (-1, 10, "Arial", 800)


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# EJournal - Current Input Fields
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

$POSLABEL = GUICtrlCreatelabel ("POS Counter", 70, 385, 85, 16)
GuiCtrlSetFont (-1, 10, "Arial", 800)
GuiCtrlSetState ($POSLABEL, $GUI_HIDE)

$POSINPUT = GUICtrlCreateinput ("", 160, 380, 70, 25)
GuiCtrlSetFont (-1, 12, "Arial", 800)
GuiCtrlSetState ($POSINPUT, $GUI_HIDE)


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# EJournal - Previous Input Fields
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

$DAYLABEL = GUICtrlCreatelabel ("Day To View", 70, 435, 85, 16)
GuiCtrlSetFont (-1, 10, "Arial", 800)
GuiCtrlSetState ($DAYLABEL, $GUI_HIDE)

$DAYINPUT = GUICtrlCreateinput ("", 160, 430, 70, 25)
GuiCtrlSetFont (-1, 12, "Arial", 800)
GuiCtrlSetState ($DAYINPUT, $GUI_HIDE)


# - - - - - - - - - - - - - - - - -
# Downloadlog Tab
# - - - - - - - - - - - - - - - - -

; define second tab name
$TEST = GUICtrlCreatetabitem ("Downloadlog")

GUICtrlCreateLabel ("::Downloadlog Viewer v1.0::", 56, 140, 265, 25, 0x1000)
GuiCtrlSetFont (-1, 14, "Arial", 800)


# - - - - - - - - - - - - - - -
# CommAgent Tab
# - - - - - - - - - - - - - - -

; define third tab name
GUICtrlCreatetabitem ("CommAgent")

GUICtrlCreateLabel ("::Commagnt Viewer v1.0::", 65, 140, 245, 25, 0x1000)
GuiCtrlSetFont (-1, 14, "Arial", 800)


# - - - - - - - - - - -
# Server Tab
# - - - - - - - - - - -

; define fourth tab name
GUICtrlCreatetabitem ("Server")

; end tab definition
GUICtrlCreatetabitem ("")


# - - - - - - - - - - - - - -
# Main Process
# - - - - - - - - - - - - - -

GuiSetState (@SW_SHOW)



$TIME = @HOUR & ":" & @MIN & ":" & @SEC
$PREVTIME = $TIME
$TIME_CONTROL = GUICtrlCreatelabel ($TIME, 250, 31, 95, 25)
GuiCtrlSetFont (-1, 16, "Arial", 600)

$X = 0


While 1
   
   # - - - - - - - - - - - - -
   # System Time
   # - - - - - - - - - - - - -
   
   Sleep(1000)
   
   $X = $X + 1
   $TIME = @HOUR & ":" & @MIN & ":" & @SEC
   If $X = 10 Or $PREVTIME <> $TIME Then
     ;;;;;GUIWrite($time_control,0,$Time)
      GuiCtrlSetData ($TIME_CONTROL, $TIME)
      $PREVTIME = $TIME
      $X = 0
   EndIf
   
   # - - - - - [ End of System Time ] - - - - -
   
   
   $MSG = GuiGetMsg ()
   
   Select
      Case $MSG = -3;dialog box being closed
         TrayTip("::PandaTools::", "Closing program...", 3, 1)
         Sleep(1500)
         Exit
         
      Case $MSG = $CURRENTRADIO
         If GUIRead($CURRENTRADIO) = 1 Then
            CurrentEJournal()
         EndIf
         
      Case $MSG = $PREVIOUSRADIO
         PreviousEJournal()
         
      Case $MSG = $PREVIOUSMONTHRADIO
         PreviousMonthEJournal()
   EndSelect
Wend
GUIDelete()
GuiSetState (@SW_SHOW)


# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# User Function Declaration
# - - - - - - - - - - - - - - - - - - - - - - - - - - -


Func CurrentEJournal()
   GuiCtrlSetState ($PREVIOUSRADIO, $GUI_DISABLE)
   GuiCtrlSetState ($PREVIOUSMONTHRADIO, $GUI_DISABLE)
   
   GuiCtrlSetState ($POSLABEL, $GUI_SHOW)
   GuiCtrlSetState ($POSINPUT, $GUI_SHOW)
   GuiCtrlSetState (-1, 256)
   GuiCtrlSetResizing (-1, "")
   GuiCtrlSetTip (-1, "Eg.1001")
   GuiCtrlSetLimit (-1, 4)
   
   
   
   
   
   
   If WinActive("handle=" & $HANDLE) Then
      HotKeySet("{ESC}", "CancelInput")
   Else
      HotKeySet("{ESC}")
   EndIf
   
EndFunc  ;==>CurrentEJournal


Func PreviousEJournal()
   GuiCtrlSetState ($CURRENTRADIO, $GUI_DISABLE)
   GuiCtrlSetState ($PREVIOUSMONTHRADIO, $GUI_DISABLE)
   
   GuiCtrlSetState ($POSLABEL, $GUI_SHOW)
   GuiCtrlSetState ($POSINPUT, $GUI_SHOW)
   GuiCtrlSetState (-1, 256)
   GuiCtrlSetResizing (-1, "")
   GuiCtrlSetTip (-1, "Eg.1001")
   GuiCtrlSetLimit (-1, 4)
   
   GuiCtrlSetState ($DAYLABEL, $GUI_SHOW)
   GuiCtrlSetState ($DAYINPUT, $GUI_SHOW)
   GuiCtrlSetResizing (-1, "")
   GuiCtrlSetTip (-1, "Eg.05")
   GuiCtrlSetLimit (-1, 2)
EndFunc  ;==>PreviousEJournal


Func PreviousMonthEJournal()
   GuiCtrlSetState ($CURRENTRADIO, $GUI_DISABLE)
   GuiCtrlSetState ($PREVIOUSRADIO, $GUI_DISABLE)
   
   GuiCtrlSetState ($POSLABEL, $GUI_SHOW)
   GuiCtrlSetState ($POSINPUT, $GUI_SHOW)
   GuiCtrlSetState (-1, 256)
   GuiCtrlSetResizing (-1, "")
   GuiCtrlSetTip (-1, "Eg.1001")
   GuiCtrlSetLimit (-1, 4)
   
   GuiCtrlSetState ($DAYLABEL, $GUI_SHOW)
   GuiCtrlSetState ($DAYINPUT, $GUI_SHOW)
   GuiCtrlSetResizing (-1, "")
   GuiCtrlSetTip (-1, "Eg.05")
   GuiCtrlSetLimit (-1, 2)
EndFunc  ;==>PreviousMonthEJournal


Func CancelInput()
   GuiCtrlSetState ($CURRENTRADIO, $GUI_ENABLE)
   GuiCtrlSetState ($CURRENTRADIO, $GUI_UNCHECKED)
   GuiCtrlSetState ($PREVIOUSRADIO, $GUI_ENABLE)
   GuiCtrlSetState ($PREVIOUSRADIO, $GUI_UNCHECKED)
   GuiCtrlSetState ($PREVIOUSMONTHRADIO, $GUI_ENABLE)
   GuiCtrlSetState ($PREVIOUSMONTHRADIO, $GUI_UNCHECKED)
   
  ;;;;;GUIWrite($POSInput,0,"")
   GuiCtrlSetData ($POSINPUT, "")
  ;;;;;GUIWrite($DayInput,0,"")
   GuiCtrlSetData ($DAYINPUT, "")
   GuiCtrlSetState ($POSLABEL, $GUI_HIDE)
   GuiCtrlSetState ($POSINPUT, $GUI_HIDE)
   GuiCtrlSetState ($DAYLABEL, $GUI_HIDE)
   GuiCtrlSetState ($DAYINPUT, $GUI_HIDE)
EndFunc  ;==>CancelInput
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...