Jump to content

Recommended Posts

I'm trying to make a Checklist of things I have to do every morning to get my computer stations up and running. I have about 100 lines of text to add but I only want to see one line at a time and advance through each line by clicking next on the GUI that I've created. I also want to be able to add or delete certain lines in the future. 

Here I've only included 7 strings of the checklist rather than the full 100 strings. I was going to create 100 variables but have realized that future editing would be a pain especially if I want to add something to the middle of the list. There must be a better way. I've looked at arrays but haven't found a way to implement an array with the amount of strings that I intend to use. I am looking through the help file to find other methods. To speed things up I am wondering if anyone might be so kind as to point me in the right direction. 

 

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\dadda\OneDrive\Documents\CheckList.kxf
$TradeInfo_1 = GUICreate("TradeInfo", 396, 196, 0, 0)
GUISetBkColor(0x000000)
$TextField = GUICtrlCreateEdit("", 24, 12, 345, 113, BitOR($ES_CENTER,$ES_WANTRETURN), 0)
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x1D276A)
GUICtrlSetBkColor(-1, 0x060606)
$Back = GUICtrlCreateLabel("Back", 56, 144, 113, 33, $SS_CENTER)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x1D276A)
GUICtrlSetBkColor(-1, 0x020005)
$Next = GUICtrlCreateLabel("Next", 200, 144, 117, 33, $SS_CENTER)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x1D276A)
GUICtrlSetBkColor(-1, 0x020005)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $count = 0

$1 = 'Open TOS and AutoIt Apps on Far-Right PC. '
$2 = 'Open TOS and AutoIt apps on all stations but don’t log in to TOS and do not load the "Hide White Bar" yet. '
$3 = 'Set up Daily levels on Far-Right PC. '
$4 = 'Log-in on all stations'
$5 = 'Minimize all TOS Main Screens Except on Tower'
$6 = 'HP Touch'
$7 = 'Open OBS Studio and adjust position if needed'

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Next
        $Count += 1
        Message()

        Case $Back
        $Count -= 1
        Message()

    EndSwitch
WEnd

func message()
    if $count = 1 then GUICtrlSetData($TextField, $1)
    if $count = 2 then GUICtrlSetData($TextField, $2)
    if $count = 3 then GUICtrlSetData($TextField, $3)
    if $count = 4 then GUICtrlSetData($TextField, $4)
    if $count = 5 then GUICtrlSetData($TextField, $5)
    if $count = 6 then GUICtrlSetData($TextField, $6)
    if $count = 7 then GUICtrlSetData($TextField, $7)
EndFunc

Link to post
Share on other sites
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\dadda\OneDrive\Documents\CheckList.kxf
$TradeInfo_1 = GUICreate("TradeInfo", 396, 196, 0, 0)
GUISetBkColor(0x000000)
$TextField = GUICtrlCreateEdit("", 24, 12, 345, 113, BitOR($ES_CENTER,$ES_WANTRETURN), 0)
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x1D276A)
GUICtrlSetBkColor(-1, 0x060606)
$Back = GUICtrlCreateLabel("Back", 56, 144, 113, 33, $SS_CENTER)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x1D276A)
GUICtrlSetBkColor(-1, 0x020005)
$Next = GUICtrlCreateLabel("Next", 200, 144, 117, 33, $SS_CENTER)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x1D276A)
GUICtrlSetBkColor(-1, 0x020005)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $count = 1

Global $aArray = ThisArrayFromFile()
Func ThisArrayFromFile()
    Local $sFileRead = "" ; FileRead("myfile")
    $sFileRead &= 'Open TOS and AutoIt Apps on Far-Right PC. ' & @CRLF
    $sFileRead &= 'Open TOS and AutoIt apps on all stations but don’t log in to TOS and do not load the "Hide White Bar" yet. ' & @CRLF
    $sFileRead &= 'Set up Daily levels on Far-Right PC. ' & @CRLF
    $sFileRead &= 'Log-in on all stations' & @CRLF
    $sFileRead &= 'Minimize all TOS Main Screens Except on Tower' & @CRLF
    $sFileRead &= 'HP Touch' & @CRLF
    $sFileRead &= 'Open OBS Studio and adjust position if needed' & @CRLF
    Return StringSplit($sFileRead, @CRLF, 1)
EndFunc
GUICtrlSetData($TextField, $aArray[$Count])
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Next
        $Count += 1
        Message()

        Case $Back
        $Count -= 1
        Message()

    EndSwitch
WEnd

func message()
    If $Count < 1 Then
        $Count += 1
        Return
    EndIf
    If $Count > $aArray[0] - 1 Then
        $Count -= 1
        Return
    EndIf
    GUICtrlSetData($TextField, $aArray[$Count])
EndFunc

 

Link to post
Share on other sites
  • Moderators

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...