Jump to content

Displaying information


Joel
 Share

Recommended Posts

Okay, first, here's the code thus far. You can compile and take a look at it. Pay attention to the second tab ("options").

The info button is going to display information on the autoitsetoptions but my question is in regards to implementations. I have several ways to implement this.

First, I could simply call the help file and point it directly to the information within the help file.

Second, I could pre-write all the information to a notepad and run it to display the information.

Third, I could force a label on the right side area of the second tab and place a destroy function for that label once a clear button or another info button is pressed.

Last, I could display the information in a second gui window and close the window once the information is finished.

Which step would you want to see if you were using this application and needed to see the information? Or, do you see another way of implementing the info areas of this utility. There will be information areas for the autoitsetoptions, for globals, and for functions. So, whichever route I go, it needs to be consistent.

Let me know your thoughts and here's the code thus far:

Opti-Bot

Purpose: To eventually be used to write any autoit script from beginning to end, including basic information, autoitsetoptions, defined globals, defined functions, and other areas. It's basic design will be to help newbies become more familiar with autoit and also to help veterans write some basic scripting events faster.

#include <GUIConstants.au3>
GUICreate("Opti-Bot", 700, 600)

GUISetFont(9, 330)

Global $textcol = "0x253E5D"
Global $opts = 0; Options Default
Global $tab = GUICtrlCreateTab(0, 0, 700, 600)
;******** Tab Zero **************************************************************
Global $tab0 = GUICtrlCreateTabItem("Start")
GUICtrlSetState(-1, $GUI_SHOW)
GUICtrlCreateGroup("Create a new script", 10, 50, 430, 160)
GUICtrlCreateLabel("If this is your first time using this utility, read the help file by pressing (F1) at", 20, 70, 410, 20)
GUICtrlCreateLabel("anytime. Making a new script can be daunting, but with patience and ", 20, 85, 410, 20)
GUICtrlCreateLabel("guidance you will be making new scripts with relative ease. In order to start", 20, 100, 410, 20)
GUICtrlCreateLabel("creating a script, we need to take care of some basics first.", 20, 115, 410, 20)
GUICtrlCreateLabel("With all scripts, you should input basic information that relates version,", 20, 145, 410, 20)
GUICtrlCreateLabel("language, platform, author, and functional descriptions to tell the user", 20, 160, 410, 20)
GUICtrlCreateLabel("what the script is being used for. So, let's do that now.", 20, 175, 410, 20)
;End Intro
GUICtrlCreateLabel("AutoIt Version:", 120, 250, 100, 20)
Global $tab0infoinp = GUICtrlCreateInput("Version Number", 260, 250, 250, 20)
GUICtrlCreateLabel("Language:", 120, 270, 100, 20)
Global $tab0infoinp1 = GUICtrlCreateInput("English", 260, 270, 250, 20)
GUICtrlCreateLabel("Platform:", 120, 290, 100, 20)
Global $tab0infoinp2 = GUICtrlCreateInput("Windows 2000", 260, 290, 250, 20)
GUICtrlCreateLabel("Author:", 120, 310, 100, 20)
Global $tab0infoinp3 = GUICtrlCreateInput("Your Name", 260, 310, 250, 20)
GUICtrlCreateLabel("Email Address:", 120, 330, 100, 20)
Global $tab0infoinp4 = GUICtrlCreateInput("email@address.com", 260, 330, 250, 20)
GUICtrlCreateLabel("Script Function:", 120, 350, 100, 20)
Global $tab0infoinp5 = GUICtrlCreateInput("Place script description here", 260, 350, 250, 70)
Global $tab0fileinp = GUICtrlCreateInput("~filename.au3", 260, 430, 100, 20)
Global $tab0infosub = GUICtrlCreateButton("Submit", 368, 430, 70, 20)
;******* Tab One *****************************************************************
Global $tab1 = GUICtrlCreateTabItem("Options")
GUICtrlCreateGroup("Autoit Default Options", 10, 50, 430, 520)
GUICtrlCreateLabel("Include", 15, 80, 150, 15)
Global $tab1Labels = StringSplit("CaretCoordMode,ColorMode,ExpandEnvStrings,ExpandVarStrings,FtpBinaryMode,GUICoordMode,GUIOnEvent


Mode,GUIResizeMode,MouseClickDelay,MouseClickDownDelay,MouseClickDragDelay,MouseCoordMode,MustDeclar


eVars,OnExitFunc,PixelCoordMode,RunErrorsFatal,SendAttachMode,SendCapslockMode,SendKeyDelay,SendKeyD


ownDelay,TrayIconDebug,TrayIconHide,WinDetectHiddenText,WinSearchChildren,WinTextMatchMode,WinTitleM


atchMode,WinWaitDelay", ",")
Global $tab1Values = StringSplit("1,0,0,0,1,1,0,0,10,10,250,1,0,OnAutoItExit,1,1,0,1,5,1,0,0,0,0,1,1,250", ",")
Global $t1Control[27][4]
For $i = 0 To 26
   $t1Control[$i][0] = GUICtrlCreateRadio($tab1Labels[$i + 1], 27, 100 + $i * 17, 150, 20)
   $t1Control[$i][1] = GUICtrlCreateInput($tab1Values[$i + 1], 200, 100 + $i * 17, 100, 20)
   $t1Control[$i][2] = GUICtrlCreateButton("Set", 330, 100 + $i * 17, 40, 20)
   $t1Control[$i][3] = GUICtrlCreateButton("Info", 390, 100 + $i * 17, 40, 20)
Next
GUICtrlCreateGroup("", -99, -99, 1, 1);close group
;******** Tab Two ****************************************************************
Global $tab3 = GUICtrlCreateTabItem("Globals")
;******** Tab Three **************************************************************
Global $tab4 = GUICtrlCreateTabItem("Functions")

GUICtrlCreateTabItem("")  ; end tabitem definition
GUISetState()
Global $valEvent = 0
; Run the GUI until the dialog is closed

While 1
   $msg = GUIGetMsg()
   For $i = 0 To 26
      If $msg = $t1Control[$i][2] Then
         If Not BitAND(GUICtrlRead($t1Control[$i][0]), $GUI_CHECKED) Then
            MsgBox(0, "Error: Radio Button", "Radio button not selected")
         Else
            If not (GUICtrlRead($t1Control[$i][1]) = "") Then
               Global $tab1writeval = GUICtrlRead($t1Control[$i][1])
               Global $tab1labelval = $tab1Labels[$i + 1]
               _options()
            Else
               MsgBox(0, "Error: Empty Field", "You are trying to set an empty field.")
            EndIf
         EndIf
         ExitLoop
      EndIf
   Next
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
   If $msg = $tab0infosub Then _filewrite()
WEnd

Func _filewrite()
   Global $fw1 = GUICtrlRead($tab0fileinp)
   Dim $fw2 = GUICtrlRead($tab0infoinp)
   Dim $fw3 = GUICtrlRead($tab0infoinp1)
   Dim $fw4 = GUICtrlRead($tab0infoinp2)
   Dim $fw5 = GUICtrlRead($tab0infoinp3)
   Dim $fw6 = GUICtrlRead($tab0infoinp4)
   Dim $fw7 = GUICtrlRead($tab0infoinp5)
   If $fw1 = "~filename.au3" Or $fw1 = "" Then
      MsgBox(0, "Error: Missing File Information", "You need to specify a filename before submitting.")
   Else
      $opts = 1
      MsgBox(0, $fw1 & " created", "Created initial file format for " & $fw1 & ". Continue working with your script.")
      FileOpen($fw1, 2)
      FileWrite($fw1, "; ----------------------------------------------------------------------------" & @CRLF)
      FileWrite($fw1, ";" & @CRLF)
      FileWrite($fw1, "; AutoIt Version: " & $fw2 & @CRLF)
      FileWrite($fw1, "; Language:       " & $fw3 & @CRLF)
      FileWrite($fw1, "; Platform:       " & $fw4 & @CRLF)
      FileWrite($fw1, "; Author:         " & $fw5 & " <" & $fw6 & ">" & @CRLF)
      FileWrite($fw1, ";" & @CRLF)
      FileWrite($fw1, "; Script Function:" & @CRLF)
      FileWrite($fw1, ";    " & $fw7 & @CRLF)
      FileWrite($fw1, ";" & @CRLF)
      FileWrite($fw1, "; ----------------------------------------------------------------------------" & @CRLF)
      FileWrite($fw1, "" & @CRLF)
      FileWrite($fw1, "" & @CRLF)
      FileWrite($fw1, "; ----------------------------------------------------------------------------" & @CRLF)
      FileWrite($fw1, "; Set up defaults listed below.." & @CRLF)
      FileWrite($fw1, "; ----------------------------------------------------------------------------" & @CRLF)
      FileWrite($fw1, "" & @CRLF)
   EndIf
EndFunc  ;==>_filewrite

Func _options()
   If $opts = 1 Then
      FileWrite($fw1, "AutoItSetOption(""" & $tab1labelval & """, " & $tab1writeval & ")" & @CRLF)
      MsgBox(0, "Option Set", $tab1labelval & " set to " & $tab1writeval & " value.")
      Global $globals = 1
   Else
      MsgBox(0, "Options Error", "You must first begin at Start and create your initial script file.")
   EndIf
EndFunc  ;==>_options

Func _optionsinfo()
    msgbox(0, "Testing Function", "Going to call an array function for " & $funcinfo & ".")
    Global $funcLabels = StringSplit("CaretCoordMode,ColorMode,ExpandEnvStrings,ExpandVarStrings,FtpBinaryMode,GUICoordMode,GUIOnEvent


Mode,GUIResizeMode,MouseClickDelay,MouseClickDownDelay,MouseClickDragDelay,MouseCoordMode,MustDeclar


eVars,OnExitFunc,PixelCoordMode,RunErrorsFatal,SendAttachMode,SendCapslockMode,SendKeyDelay,SendKeyD


ownDelay,TrayIconDebug,TrayIconHide,WinDetectHiddenText,WinSearchChildren,WinTextMatchMode,WinTitleM


atchMode,WinWaitDelay", ",")
    call("_" & $funcLabels[$funcinfo + 1] & "()")
EndFunc  ;==>_optionsinfo
Edited by Joel

[font="Optima"]"Those who heed life with speculation and contemplation, are the ones stuck home with constipation." - Joel[/font]

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...