Sign in to follow this  
Followers 0
atnextc

FileWrite Issues with waiting for user input

13 posts in this topic

Hello All,

This is my test script i've been messing around with to get the syntax correct for my real script that I am working on. Simply, this script will:

The problem that I am having is my loop that I have isn't waiting for a user to input new data into the "username" input box.

How to replicate:

1. Input Project Name "TESTING-01A-Q1-2013"

2. Number of Projects Can be any number more than 1

3. Third input box is looking for a name "can be anything."

4. Click Next Project

5. When Next project button is dim click submit

6. Look in the script directory where you ran it from for "testing.txt"

You will notice something similar to the following:

Project TESTING-01A-Q1-2013

This is my username

Project TESTING-01B-Q1-2013

This is my username TEST USER

Project TESTING-01C-Q1-2013

This is my username TEST USER

Project TESTING-01D-Q1-2013

This is my username TEST USER

Project TESTING-01E-Q1-2013

This is my username TEST USER

What needs to happen is the script will wait for the username input box to have data in it before filewrite.

code is below

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1_1 = GUICreate("Test", 615, 438, 215, 170)
$RDCNextProjectButton = GUICtrlCreateButton("Next Project", 183, 241, 99, 33)
GUICtrlSetState(-1, $GUI_DISABLE)
$ProjectNameInputBox = GUICtrlCreateInput("", 35, 104, 193, 21)
$ProjectNameLabel = GUICtrlCreateLabel("Please Input Your Project Name", 27, 80, 200, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$NumberOfProjectsLabel = GUICtrlCreateLabel("Please Input The Number Of Projects You Have Of This Kind", 19, 160, 364, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCNumberOfProjectsInput = GUICtrlCreateInput("", 49, 198, 193, 21)
$RDCSubmitButton = GUICtrlCreateButton("Submit", 72, 240, 99, 33)
GUICtrlSetState(-1, $GUI_ENABLE)
Global $ProjectNameRead = GUICtrlRead($ProjectNameInputBox)
$username = GUICtrlCreateInput("", 48, 290, 193, 21)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

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

Case $RDCNumberOfProjectsInput
;$RDCProjectSiteRead = GUICtrlRead ($ProjectSiteCombo)
$RDCProjectNameRead = GUICtrlRead($ProjectNameInputBox)
$RDCNumberOfProjectsRead = GUICtrlRead($RDCNumberOfProjectsInput)
$usernameread = GUICtrlRead($username)
If $RDCNumberOfProjectsRead > 1 Then
GUICtrlSetState($RDCNextProjectButton, $GUI_ENABLE)
GUICtrlSetState($RDCSubmitButton, $GUI_DISABLE)
FileOpen("testing.txt", 1)
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", "Project ")
FileWrite("testing.txt", $RDCProjectNameRead & @CRLF)
FileWrite("testing.txt", "This is my username " & $usernameread & @CRLF)
FileClose("testing.txt")
guictrlsetdata($username,"")
ElseIf $RDCNumberOfProjectsRead = 1 Then
GUICtrlSetState($RDCNextProjectButton, $GUI_DISABLE)
GUICtrlSetState($RDCSubmitButton, $GUI_ENABLE)
EndIf
$CapacityInput = ($RDCNumberOfProjectsRead * 10)

Case $RDCNextProjectButton
$ProjectNameRead = GUICtrlRead($ProjectNameInputBox)
$RDCNumberOfProjectsRead = GUICtrlRead($RDCNumberOfProjectsInput)
$usernameread = GUICtrlRead($username)
If guictrlread($username) = ("") Then
MsgBox(0,"WAIT","Please Input A Name.")
EndIf
For $I = 1 To $RDCNumberOfProjectsRead - 1
FileOpen("testing.txt", 1)
ConsoleWrite("'" & StringRegExpReplace($ProjectNameRead, "(?<=-\d{2})([A-Z])(?=-Q)", "' & Chr(Asc('$1') + $I) & '") & "'" & @LF)
Local $soutput = Execute("'" & StringRegExpReplace($ProjectNameRead, "(?<=-\d{2})([A-Z])(?=-Q)", "' & Chr(Asc('$1') + $I) & '") & "'")
GUICtrlSetData($ProjectNameInputBox, $soutput)
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", "Project ")
FileWrite("testing.txt", $soutput & @CRLF)
FileWrite("testing.txt", "This is my username " & $usernameread & @CRLF)
FileClose("testing.txt")
guictrlsetdata($username,"")
Next
GUICtrlSetState($RDCNextProjectButton, $GUI_DISABLE)
GUICtrlSetState($RDCSubmitButton, $GUI_ENABLE)

Case $RDCSubmitButton

MsgBox(0, "TESTING", "END OF SCRIPT")
Exit

EndSwitch
WEnd

Thanks to all for helping.

Share this post


Link to post
Share on other sites



atnextc,

See comments in the code...

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1_1 = GUICreate("Test", 615, 438, 215, 170)
$RDCNextProjectButton = GUICtrlCreateButton("Next Project", 183, 241, 99, 33)
GUICtrlSetState(-1, $GUI_DISABLE)
$ProjectNameInputBox = GUICtrlCreateInput("", 35, 104, 193, 21)
$ProjectNameLabel = GUICtrlCreateLabel("Please Input Your Project Name", 27, 80, 200, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$NumberOfProjectsLabel = GUICtrlCreateLabel("Please Input The Number Of Projects You Have Of This Kind", 19, 160, 364, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCNumberOfProjectsInput = GUICtrlCreateInput("", 49, 198, 193, 21)
$RDCSubmitButton = GUICtrlCreateButton("Submit", 72, 240, 99, 33)
GUICtrlSetState(-1, $GUI_ENABLE)
Global $ProjectNameRead = GUICtrlRead($ProjectNameInputBox) ; <---- you do this later in the msg loop
$username = GUICtrlCreateInput("", 48, 290, 193, 21)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

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

        Case $RDCNumberOfProjectsInput


            ;$RDCProjectSiteRead = GUICtrlRead ($ProjectSiteCombo)
            $RDCProjectNameRead = GUICtrlRead($ProjectNameInputBox)
            $RDCNumberOfProjectsRead = GUICtrlRead($RDCNumberOfProjectsInput)
            $usernameread = GUICtrlRead($username)
            If $RDCNumberOfProjectsRead > 1 Then
                GUICtrlSetState($RDCNextProjectButton, $GUI_ENABLE)
                GUICtrlSetState($RDCSubmitButton, $GUI_DISABLE)
                FileOpen("testing.txt", 1)
                FileWrite("testing.txt", @CRLF & @CRLF)
                FileWrite("testing.txt", "Project ")
                FileWrite("testing.txt", $RDCProjectNameRead & @CRLF)
                FileWrite("testing.txt", "This is my username " & $usernameread & @CRLF)
                FileClose("testing.txt")
                GUICtrlSetData($username, "")
            ElseIf $RDCNumberOfProjectsRead = 1 Then
                GUICtrlSetState($RDCNextProjectButton, $GUI_DISABLE)
                GUICtrlSetState($RDCSubmitButton, $GUI_ENABLE)
            EndIf
            $CapacityInput = ($RDCNumberOfProjectsRead * 10)

        Case $RDCNextProjectButton
            $ProjectNameRead = GUICtrlRead($ProjectNameInputBox)
            $RDCNumberOfProjectsRead = GUICtrlRead($RDCNumberOfProjectsInput)
            $usernameread = GUICtrlRead($username)
            If GUICtrlRead($username) = ("") Then
                MsgBox(0, "WAIT", "Please Input A Name.")
            EndIf
            For $I = 1 To $RDCNumberOfProjectsRead - 1
                FileOpen("testing.txt", 1)
                ConsoleWrite("'" & StringRegExpReplace($ProjectNameRead, "(?<=-\d{2})([A-Z])(?=-Q)", "' & Chr(Asc('$1') + $I) & '") & "'" & @LF)
                Local $soutput = Execute("'" & StringRegExpReplace($ProjectNameRead, "(?<=-\d{2})([A-Z])(?=-Q)", "' & Chr(Asc('$1') + $I) & '") & "'")
                GUICtrlSetData($ProjectNameInputBox, $soutput)
                FileWrite("testing.txt", @CRLF & @CRLF)
                FileWrite("testing.txt", "Project ")
                FileWrite("testing.txt", $soutput & @CRLF)
                FileWrite("testing.txt", "This is my username " & $usernameread & @CRLF)
                FileClose("testing.txt")
                GUICtrlSetData($username, "")
            Next
            GUICtrlSetState($RDCNextProjectButton, $GUI_DISABLE)
            GUICtrlSetState($RDCSubmitButton, $GUI_ENABLE)

        Case $RDCSubmitButton

            ; start added code

            if guictrlread($username) = '' then
                MsgBox(0, "TESTING", "User must enter something")
                continueloop
            EndIf

            ; end added code

    EndSwitch
WEnd

This same kind of edit should be done on all input fields.

Instead of a msgbox, I wold use a label to output the message and return focus to whatever control edit failed.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

The problem is that, if you enter 3 for the number of projects and hit "next project" that it immediately jumps to the end and it is not allowing you to enter a username of project #2 as it were, and the username that gets entered for project #3 is the same username that was entered for project #1.

sounds confusing but rather simple if code is executed.

**note**

Havent updated script with notes above, however it would seem to me that what you added should be in the loop, no?

**note**

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

The problem is that, if you enter 3 for the number of projects and hit "next project" that it immediately jumps to the end and it is not allowing you to enter a username of project #2 as it were

And thus,

This same kind of edit should be done on all input fields.

and the username that gets entered for project #3 is the same username that was entered for project #1.

It is up to you to manage variables and contents. After each iteration of project you probably need to clear your variables.

it would seem to me that what you added should be in the loop, no?

Is it not ?

kylomas

edit: your code is somewhat disorganized...most processing should take place when buttons are actioned, not when $RDCNumberOfProjectsInput is actioned. I'm in the middle of something right now, if you don't mind I would like to suggest a different organization when I get the chance.

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

atnextc,

Apologies, was going to re-organize script but no time right now.

This addresses your "exiting" problem if more than 1 project

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1_1 = GUICreate("Test", 615, 438, 215, 170)
$RDCNextProjectButton = GUICtrlCreateButton("Next Project", 183, 241, 99, 33)
GUICtrlSetState(-1, $GUI_DISABLE)
$ProjectNameInputBox = GUICtrlCreateInput("", 35, 104, 193, 21)
$ProjectNameLabel = GUICtrlCreateLabel("Please Input Your Project Name", 27, 80, 200, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$NumberOfProjectsLabel = GUICtrlCreateLabel("Please Input The Number Of Projects You Have Of This Kind", 19, 160, 364, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCNumberOfProjectsInput = GUICtrlCreateInput("", 49, 198, 193, 21)
$RDCSubmitButton = GUICtrlCreateButton("Submit", 72, 240, 99, 33)
GUICtrlSetState(-1, $GUI_ENABLE)
Global $ProjectNameRead = GUICtrlRead($ProjectNameInputBox)
$username = GUICtrlCreateInput("", 48, 290, 193, 21)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
 $nMsg = GUIGetMsg()
 Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $RDCNumberOfProjectsInput
   ;$RDCProjectSiteRead = GUICtrlRead ($ProjectSiteCombo)
   $RDCProjectNameRead = GUICtrlRead($ProjectNameInputBox)
   $RDCNumberOfProjectsRead = GUICtrlRead($RDCNumberOfProjectsInput)
   $usernameread = GUICtrlRead($username)
   If $RDCNumberOfProjectsRead > 1 Then
    GUICtrlSetState($RDCNextProjectButton, $GUI_ENABLE)
    GUICtrlSetState($RDCSubmitButton, $GUI_DISABLE)
    FileOpen("testing.txt", 1)
    FileWrite("testing.txt", @CRLF & @CRLF)
    FileWrite("testing.txt", "Project ")
    FileWrite("testing.txt", $RDCProjectNameRead & @CRLF)
    FileWrite("testing.txt", "This is my username " & $usernameread & @CRLF)
    FileClose("testing.txt")
    GUICtrlSetData($username, "")
   ElseIf $RDCNumberOfProjectsRead = 1 Then
    GUICtrlSetState($RDCNextProjectButton, $GUI_DISABLE)
    GUICtrlSetState($RDCSubmitButton, $GUI_ENABLE)
   EndIf
   $CapacityInput = ($RDCNumberOfProjectsRead * 10)
  Case $RDCNextProjectButton
   $ProjectNameRead = GUICtrlRead($ProjectNameInputBox)
   $RDCNumberOfProjectsRead = GUICtrlRead($RDCNumberOfProjectsInput)
   $usernameread = GUICtrlRead($username)
   If GUICtrlRead($username) = ("") Then
    MsgBox(0, "WAIT", "Please Input A Name.")
   EndIf
   For $I = 1 To $RDCNumberOfProjectsRead - 1
    FileOpen("testing.txt", 1)
    ConsoleWrite("'" & StringRegExpReplace($ProjectNameRead, "(?<=-\d{2})([A-Z])(?=-Q)", "' & Chr(Asc('$1') + $I) & '") & "'" & @LF)
    Local $soutput = Execute("'" & StringRegExpReplace($ProjectNameRead, "(?<=-\d{2})([A-Z])(?=-Q)", "' & Chr(Asc('$1') + $I) & '") & "'")
    GUICtrlSetData($ProjectNameInputBox, $soutput)
    FileWrite("testing.txt", @CRLF & @CRLF)
    FileWrite("testing.txt", "Project ")
    FileWrite("testing.txt", $soutput & @CRLF)
    FileWrite("testing.txt", "This is my username " & $usernameread & @CRLF)
    FileClose("testing.txt")
    GUICtrlSetData($username, "")
   Next
   GUICtrlSetState($RDCNextProjectButton, $GUI_DISABLE)
   GUICtrlSetState($RDCSubmitButton, $GUI_ENABLE)
  Case $RDCSubmitButton
   ; this will keep you in the script
   if guictrlread($RDCNumberOfProjectsInput) > 1 then
    guictrlsetdata($RDCNumberOfProjectsInput,guictrlread($RDCNumberOfProjectsInput) - 1)
    continueloop
   endif
   MsgBox(0, "TESTING", "END OF SCRIPT")
   Exit
 EndSwitch
WEnd

kyloma


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

I used your code above but I am still having the same issue of:

When you have say 5 projects and the first project name that you enter is "TESTING-01A-Q1-2013" when you click the next project button the project input name increments to "TESTING-01E-Q1-2013" instead of 01B like it should since that is the next letter that it should increment to. The other issue is still that you can't input anything in username input box for that project since it automatically moves to the end of the For loop.

This makes a lot of sense if the code is run and you see what I am referring to. Thanks again for all the help.

Share this post


Link to post
Share on other sites

atnextc,

I did the following:

1 - Eliminated interim variables.

2 - Re-arranged the code to a format I am used to (anal retentive)

3 - Eliminated the two button system. It did'nt make sense to me.

4 - Moved all processing to the submit button control.

5 - Changed the way the file is being handled

6 - Changewd that crazy executed regexp to somethng i actually understand

Please note, this is just how I would do it.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <array.au3>

local $gui010       =   GUICreate('Project Manager',500,500)
$RDCSubmitButton    =   GUICtrlCreateButton("Submit",20, 400, 460, 30)
                GUICtrlCreateLabel("Please Input Your Project Name",20,20,190,20)
                GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$ProjectNameInputBox    =   GUICtrlCreateInput("", 210,17,250,20)
                GUICtrlCreateLabel("Please Input The Number Of Projects You Have Of This Kind", 20, 50, 370, 20)
                GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCNumberOfProjectsInput =     GUICtrlCreateInput("", 390, 47, 70, 20)
                guictrlcreatelabel('User Name',20,80,100,20)
                guictrlsetfont(-1,8,800,-1,'ms sans serif')
$username       =   GUICtrlCreateInput("", 210,80,250,20)
                guictrlcreatelabel('Status',20,445,50,20)
                guictrlsetfont(-1,8.5,800)

$status         =   guictrlcreatelabel('',20,460,460,20,$ss_sunken)
                guictrlsetfont(-1,9,800)
                guictrlsetcolor(-1,0xff0000)
                guictrlsetstate($ProjectNameInputBox,$gui_focus)
                GUISetState(@SW_SHOW)

                guictrlsetdata($ProjectNameInputBox,'TESTING-01A-Q1-2013')  ; <--- for testing

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            ;shellexecute(@scriptdir & '\testing.txt')
            Exit
        Case $RDCSubmitButton

            If guictrlread($RDCNumberOfProjectsInput) = '' then
                guictrlsetdata($status,'# of projects required')
                guictrlsetstate($RDCNumberOfProjectsInput,$gui_focus)
                continueloop
            endif
            If not stringisdigit(guictrlread($RDCNumberOfProjectsInput)) then
                guictrlsetdata($status,'# of projects must be numeric')
                guictrlsetstate($RDCNumberOfProjectsInput,$gui_focus)
                continueloop
            endif
            If guictrlread($ProjectNameInputBox) = '' then
                guictrlsetdata($status,'Project name required')
                guictrlsetstate($ProjectNameInputBox,$gui_focus)
                continueloop
            endif
            if guictrlread($username) = '' then
                guictrlsetdata($status,'User Name required')
                guictrlsetstate($username,$gui_focus)
                continueloop
            EndIf

            guictrlsetdata($status,'')

            local $hfl = FileOpen(@scriptdir & '\testing.txt', 1)
            filewrite($hfl,stringformat('username = %-20s projectname = %-30s number of projects = %-5s',guictrlread($username),  _
                guictrlread($ProjectNameInputBox),  _
                guictrlread($RDCNumberOfProjectsInput)) & @lf)
            fileclose($hfl)

            if guictrlread($RDCNumberOfProjectsInput) = 1 then
                guictrlsetdata($ProjectNameInputBox,'')
                guictrlsetdata($RDCNumberOfProjectsInput,'')
                guictrlsetdata($username,'')
                guictrlsetstate($ProjectNameInputBox,$gui_focus)
            endif

            if guictrlread($RDCNumberOfProjectsInput) > 1 then
                local $aprojincr = stringregexp(guictrlread($ProjectNameInputBox),"(?<=-\d{2})([A-Z])(?=-Q)",3)
                local $incr_char = chr(asc($aprojincr[0])+1)
                guictrlsetdata($ProjectNameInputBox,StringRegExpReplace(guictrlread($ProjectNameInputBox), _
                "(?<=-\d{2})([A-Z])(?=-Q)", $incr_char))
                guictrlsetdata($RDCNumberOfProjectsInput,guictrlread($RDCNumberOfProjectsInput) - 1)
                guictrlsetdata($username,'')
                guictrlsetstate($username,$gui_focus)
            endif

    EndSwitch
WEnd

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Thanks I will check this out later tonight when I get a chance. If possible can you comment on what you did ca what was there. Ie your way of formatting etc. just so I can understand what all that you did. I apologize if you did this already but I'm checking on a phone and formatting looks all jacked up. Thanks again.

Share this post


Link to post
Share on other sites

atnextc,

It's pretty much a re-write of the entire thing based on my understanding of what you are doing. I tried to maintain control names, but that is about it. The two biggest changes are the gui (appearance) and consolidating the processing to one control. Minor changes are; eliminating redundant variable usage, output file handling, that crazy executed regexp, input field edits and code formatting.

You pretty much need to run it to see if it's what you are going for, if not, it kept me from having to do the dishes!

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Lol thanks. I guess I should maybe post the real script that I'm going to use this for. As it essentially what I'm ultimately looking to build if you wouldn't mind taking a look at it. It "works" but I'm 99.9% sure it can be cleaned up a lot while still allowing me to understand it and be able to do follow work on it. Thanks so much again. This script above was just a quick and dirty one for testing

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

atnextc,

No problem...at worst you've seen another way of looking at the problem :rolleyes:

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Ok, so here is the real code that I'm working with.......bare in mind there is ALOT of stuff that probably isn't needed. Still the same issues remain as stated in all the other posts above.

How to replicate:

1. Input Project Name "TESTING-01A-Q1-2013"

2. Number of Projects Can be any number more than 1

3. Pick a router on both side

4 .Input port number should be in the syntax of 1/1/1

5. repeat for z side

6. Click Next Project

7. Pick a router on both side

8 .Input port number should be in the syntax of 1/1/1

9. repeat for z side

10. When Next project button is dim click submit

11. Look in the script directory where you ran it from for "testing.txt"

[/font][/color]
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIComboBox.au3>
#include <WinAPI.au3>
#include <Array.au3>
#include <Misc.au3>
$RdcProjectTypeFrm = GUICreate("Maintenance Email Notification", 1344, 852, 263, 68)
$CoxLabel = GUICtrlCreateLabel("Maintenance Email Notification ", 248, 8, 780, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$ProjectSiteLabel = GUICtrlCreateLabel("Please Choose Your Project Site Location", 24, 256, 241, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$ProjectNameLabel = GUICtrlCreateLabel("Please Input Your Project Name", 24, 192, 200, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$TypeofProjectLabel = GUICtrlCreateLabel("Please Choose The Type Of Project This Is", 24, 72, 249, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$NumberOfProjectsLabel = GUICtrlCreateLabel("Please Input The Number Of Projects You Have Of This Kind", 24, 320, 349, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetState(-1, $GUI_HIDE)
GUIStartGroup()
$RdcProjectTypeRadio = GUICtrlCreateRadio("RDC Interconnect", 40, 104, 105, 17)
$C4CoreProjectTypeRadio = GUICtrlCreateRadio("C4 Core Link", 40, 128, 105, 17)
$SystemProjectTypeRadio = GUICtrlCreateRadio("System Connection", 40, 152, 113, 17)
GUIStartGroup()
$ProjectNameInputBox = GUICtrlCreateInput("", 48, 216, 193, 21)
Global $ProjectSiteCombo = GUICtrlCreateCombo("", 48, 288, 193, 25, BitOR($CBS_DROPDOWNLIST, $CBS_SORT))
Global $RDCNumberOfProjectsInput = GUICtrlCreateInput("", 48, 344, 193, 21)
$RDCNumberOfProjectsRead = GUICtrlRead($RDCNumberOfProjectsInput)
GUICtrlSetState(-1, $GUI_HIDE)


Global $ProjectNameRead = GUICtrlRead($ProjectNameInputBox)
Global $AutoNameNextProject = $ProjectNameRead
Local $RDCRouterNameCombo
Local $RDCInterfaceTypeCombo
Local $RDCRouterInterfacePortInput
Local $RDCOtherRouterNameCombo
Local $RDCOtherRouterInterfaceTypeCombo
Local $RDCOtherRouterInterfacePortInput
Local $RDCYesInstallFPCRadio
Local $RDCNoInstallFPCRadio
Local $RDCFPCInstallLocationInput
Local $RDCYesInstallPicRadio
Local $RDCNoInstallPICRadio
Local $RDCPicInstallLocationInput
Local $RDCYesInstallOpticRadio
Local $RDCNoInstallOpticRadio
Local $RDCOpticInstallLocationInput
Local $RDCNextProjectButton
Local $RDCClearButton
Local $RDCSubmitButton
Local $RDCRouterSideLabel
Local $RDCInterfaceTypeLabel
Local $RDCRouterInterfacePortLabel
Local $RDCRouterNameOtherSideLabel
Local $RDCOtherRouterInterfacePortLabel
Local $RDCOtherRouterInterfaceTypeLabel
Local $RDCInstallHardwareLabel
Local $RDCFPCInstallLabel
Local $RDCInstallPICLabel
Local $RDCPICInstallLabel
Local $RDCInstallOpticLabel
Local $RDCInputOpticLocationLabel
Local $RDCASideFPCInstallInput
Local $RDCZSideFPCInstallInput
Local $RDCBothRouterFPCInstall
Local $RDCASideFPCInstall
Local $RDCZSideFPCInstall
Local $RDCFPCSideALabel
Local $RDCASideFPCInstallInput
Local $RDCZSideFPCInstallInput
Local $RDCSideZFPCInstallLabel
Local $RDCASidePicInstall
Local $RDCZSidePicInstall
Local $RDCChooseRouterPicInstallLabel
Local $RDCBothRouterPicInstall
Local $RDCInstallPICSIdeALabel
Local $RDCASidePicInput
Local $RDCInstallPICSIdeZLabel
Local $RDCZSidePicInput
Local $RDCOpticsInstallLabel
Local $RDCASideOpticsInstall
Local $RDCZSideOpticsInstall
Local $RDCBothRoutersOpticsInstall
Local $RDCInstallOpticsSIdeALabel
Local $RDCASideOpticsInstallInput
Local $RDCInstallOpticsSideZLabel
Local $RDCZSideOpticsInstallInput
Local $ASideFPCInstallInput
Local $ZSideFPCInstallInput

GUISetState(@SW_SHOW)

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



GUICtrlSetState($RDCNumberOfProjectsInput, $GUI_SHOW)
GUICtrlSetState($NumberOfProjectsLabel, $GUI_SHOW)


$RDCRouterNameCombo = GUICtrlCreateCombo("", 48, 408, 193, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
$RDCInterfaceTypeCombo = GUICtrlCreateCombo("", 48, 472, 57, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
$RDCRouterInterfacePortInput = GUICtrlCreateInput("", 120, 472, 89, 21)
$RDCOtherRouterNameCombo = GUICtrlCreateCombo("", 48, 632, 193, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
$RDCOtherRouterInterfaceTypeCombo = GUICtrlCreateCombo("", 40, 704, 57, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
$RDCOtherRouterInterfacePortInput = GUICtrlCreateInput("", 120, 704, 89, 21)
GUICtrlSetData($RDCInterfaceTypeCombo, "et|ge|xe", "Choose Interface Type")
GUICtrlSetData($RDCOtherRouterInterfaceTypeCombo, "et|ge|xe", "Choose Interface Type")


GUIStartGroup()
$RDCYesInstallFPCRadio = GUICtrlCreateRadio("Yes", 512, 168, 41, 17)

$RDCNoInstallFPCRadio = GUICtrlCreateRadio("No", 576, 168, 41, 17)

GUIStartGroup()
$RDCFPCInstallLabel = GUICtrlCreateLabel("Choose Where You Need An FPC Installed", 480, 208, 245, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUIStartGroup()
$RDCASideFPCInstall = GUICtrlCreateRadio("A Side", 504, 240, 57, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$RDCBothRouterFPCInstall = GUICtrlCreateRadio("Both Routers", 640, 240, 81, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$RDCZSideFPCInstall = GUICtrlCreateRadio("Z Side", 576, 240, 57, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUIStartGroup()
$RDCASideFPCInstallInput = GUICtrlCreateInput("", 496, 312, 193, 21)
GUICtrlSetState(-1, $GUI_HIDE)
$RDCZSideFPCInstallInput = GUICtrlCreateInput("", 496, 384, 193, 21)
GUICtrlSetState(-1, $GUI_HIDE)
GUIStartGroup()
$RDCYesInstallPicRadio = GUICtrlCreateRadio("Yes", 512, 456, 41, 17)

$RDCNoInstallPICRadio = GUICtrlCreateRadio("No", 576, 456, 41, 17)

GUIStartGroup()
$RDCFPCSideALabel = GUICtrlCreateLabel("Input Which Slot You Need The FPC Installed (A Side)", 456, 280, 313, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUIStartGroup()
$RDCYesInstallOpticRadio = GUICtrlCreateRadio("Yes", 912, 168, 41, 17)

$RDCNoInstallOpticRadio = GUICtrlCreateRadio("No", 976, 168, 41, 17)

GUIStartGroup()
$RDCNextProjectButton = GUICtrlCreateButton("Next Project", 984, 440, 99, 33)
GUICtrlSetState(-1, $GUI_DISABLE)
$RDCClearButton = GUICtrlCreateButton("Clear", 928, 496, 89, 33)
$RDCSubmitButton = GUICtrlCreateButton("Submit", 1040, 496, 89, 33)
$RDCRouterSideLabel = GUICtrlCreateLabel(" Please Choose The Router For A-Side", 24, 384, 223, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCRouterInterfacePortLabel = GUICtrlCreateLabel("Choose Interface Type and Input Port Number For A-Side", 24, 448, 328, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCRouterNameOtherSideLabel = GUICtrlCreateLabel("Please Choose The Router For Z-Side Router", 24, 592, 261, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCOtherRouterInterfacePortLabel = GUICtrlCreateLabel("Choose Interface Type and Input Port Number For Z-Side", 16, 672, 328, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCInstallHardwareLabel = GUICtrlCreateLabel("Choose If You Need To Install An FPC", 480, 136, 221, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCInstallPICLabel = GUICtrlCreateLabel("Choose If You Need To Install A PIC", 480, 424, 211, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCInstallOpticLabel = GUICtrlCreateLabel("Choose If You Need To Install An Optic", 880, 136, 228, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCSideZFPCInstallLabel = GUICtrlCreateLabel("Input Which Slot You Need The FPC Installed (Z Side)", 456, 352, 313, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCChooseRouterPicInstallLabel = GUICtrlCreateLabel("Choose Where You Need A PIC Installed", 480, 488, 235, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUIStartGroup()
$RDCASidePicInstall = GUICtrlCreateRadio("A Side", 496, 520, 57, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$RDCZSidePicInstall = GUICtrlCreateRadio("Z Side", 568, 520, 57, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$RDCBothRouterPicInstall = GUICtrlCreateRadio("Both Routers", 632, 520, 81, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUIStartGroup()
$RDCInstallPICSIdeALabel = GUICtrlCreateLabel("Input Which Slot You Need The PIC Installed (A Side)", 456, 560, 310, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCASidePicInput = GUICtrlCreateInput("", 496, 592, 193, 21)
GUICtrlSetState(-1, $GUI_HIDE)
$RDCInstallPICSIdeZLabel = GUICtrlCreateLabel("Input Which Slot You Need The PIC Installed (Z Side)", 456, 632, 310, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCZSidePicInput = GUICtrlCreateInput("", 496, 664, 193, 21)
GUICtrlSetState(-1, $GUI_HIDE)
$RDCOpticsInstallLabel = GUICtrlCreateLabel("Choose Where You Need Optics Installed", 880, 208, 239, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUIStartGroup()
$RDCZSideOpticsInstall = GUICtrlCreateRadio("Z Side", 976, 240, 57, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$RDCASideOpticsInstall = GUICtrlCreateRadio("A Side", 904, 240, 57, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$RDCBothRoutersOpticsInstall = GUICtrlCreateRadio("Both Routers", 1040, 240, 81, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUIStartGroup()
$RDCInstallOpticsSIdeALabel = GUICtrlCreateLabel("Input Which Port You Need The Optics Installed (A Side)", 864, 280, 327, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCASideOpticsInstallInput = GUICtrlCreateInput("", 912, 312, 193, 21)
GUICtrlSetState(-1, $GUI_HIDE)
$RDCInstallOpticsSideZLabel = GUICtrlCreateLabel("Input Which Port You Need The Optics Installed (Z Side)", 864, 352, 327, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCZSideOpticsInstallInput = GUICtrlCreateInput("", 911, 377, 193, 21)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetData($ProjectSiteCombo, "SITE #1|SITE #2|SITE #3")
GUICtrlSetData($RDCRouterNameCombo, "SITE1-ROUTER01|SITE1-ROUTER02|SITE2-ROUTER01|SITE2-ROUTER02|SITE3-ROUTER01|SITE3-ROUTER02")
GUICtrlSetData($RDCOtherRouterNameCombo, "SITE1-ROUTER01|SITE1-ROUTER02|SITE2-ROUTER01|SITE2-ROUTER02|SITE3-ROUTER01|SITE3-ROUTER02")


Case $RDCNumberOfProjectsInput
$RDCProjectSiteRead = GUICtrlRead($ProjectSiteCombo)
$RDCInterfaceTypeRead = GUICtrlRead($RDCInterfaceTypeCombo)
$RDCInterfacePortRead = GUICtrlRead($RDCRouterInterfacePortInput)
$RDCOtherRouterRead = GUICtrlRead($RDCOtherRouterNameCombo)
$RDCRouterNameRead = GUICtrlRead($RDCRouterNameCombo)
$RDCOtherInterfaceTypeRead = GUICtrlRead($RDCOtherRouterInterfaceTypeCombo)
$RDCOtherInterfacePortRead = GUICtrlRead($RDCOtherRouterInterfacePortInput)
$ASideFPCInstallRead = GUICtrlRead($ASideFPCInstallInput)
$ZSideFPCInstallRead = GUICtrlRead($ZSideFPCInstallInput)
$ASidePICInstallRead = GUICtrlRead($RDCASidePicInput)
$ZSidePICInstallRead = GUICtrlRead($RDCZSidePicInput)
$ASideOpticInstallRead = GUICtrlRead($RDCASideOpticsInstallInput)
$ZSideOpticInstallRead = GUICtrlRead($RDCZSideOpticsInstallInput)
$RDCProjectNameRead = GUICtrlRead($ProjectNameInputBox)
$RDCASideFPCInstallRead = GUICtrlRead($RDCASideFPCInstall)
$RDCYesInstallFPCRadioRead = GUICtrlRead($RDCYesInstallFPCRadio)
$RDCZSideFPCInstallRead = GUICtrlRead($RDCZSideFPCInstall)
$RDCASideFPCInstallInputRead = GUICtrlRead($RDCASideFPCInstallInput)
$RDCZSideFPCInstallInputRead = GUICtrlRead($RDCZSideFPCInstallInput)
$CapacityInput = ($RDCNumberOfProjectsRead * 10)
$RDCBothRouterFPCInstallRead = GUICtrlRead($RDCBothRouterFPCInstall)
$RDCProjectSiteRead = GUICtrlRead($ProjectSiteCombo)
$RDCProjectNameRead = GUICtrlRead($ProjectNameInputBox)
$RDCNumberOfProjectsRead = GUICtrlRead($RDCNumberOfProjectsInput)
If $RDCNumberOfProjectsRead > 1 Then
GUICtrlSetState($RDCNextProjectButton, $GUI_ENABLE)
GUICtrlSetState($RDCSubmitButton, $GUI_DISABLE)
FileOpen("testing.txt", 1)
FileWrite("testing.txt", $RDCProjectSiteRead)
FileWrite("testing.txt", ",")
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", "We recently have launched the below C4 projects for your system. We need on site assistance to perform the maintenance. Please let us know who the POC for this activity will be so we can set up a call to plan this work." & @CRLF & @CRLF & "Details for C4 Projects:")
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", "Project ")
FileWrite("testing.txt", $RDCProjectNameRead & @CRLF)
FileClose("testing.txt")
ElseIf $RDCNumberOfProjectsRead = 1 Then
GUICtrlSetState($RDCNextProjectButton, $GUI_DISABLE)
GUICtrlSetState($RDCSubmitButton, $GUI_ENABLE)

EndIf
$CapacityInput = ($RDCNumberOfProjectsRead * 10)

Case $RDCNextProjectButton
$RDCProjectSiteRead = GUICtrlRead($ProjectSiteCombo)
$RDCInterfaceTypeRead = GUICtrlRead($RDCInterfaceTypeCombo)
$RDCInterfacePortRead = GUICtrlRead($RDCRouterInterfacePortInput)
$RDCOtherRouterRead = GUICtrlRead($RDCOtherRouterNameCombo)
$RDCRouterNameRead = GUICtrlRead($RDCRouterNameCombo)
$RDCOtherInterfaceTypeRead = GUICtrlRead($RDCOtherRouterInterfaceTypeCombo)
$RDCOtherInterfacePortRead = GUICtrlRead($RDCOtherRouterInterfacePortInput)
$ASideFPCInstallRead = GUICtrlRead($ASideFPCInstallInput)
$ZSideFPCInstallRead = GUICtrlRead($ZSideFPCInstallInput)
$ASidePICInstallRead = GUICtrlRead($RDCASidePicInput)
$ZSidePICInstallRead = GUICtrlRead($RDCZSidePicInput)
$ASideOpticInstallRead = GUICtrlRead($RDCASideOpticsInstallInput)
$ZSideOpticInstallRead = GUICtrlRead($RDCZSideOpticsInstallInput)
$RDCProjectNameRead = GUICtrlRead($ProjectNameInputBox)
$RDCASideFPCInstallRead = GUICtrlRead($RDCASideFPCInstall)
$RDCYesInstallFPCRadioRead = GUICtrlRead($RDCYesInstallFPCRadio)
$RDCZSideFPCInstallRead = GUICtrlRead($RDCZSideFPCInstall)
$RDCASideFPCInstallInputRead = GUICtrlRead($RDCASideFPCInstallInput)
$RDCZSideFPCInstallInputRead = GUICtrlRead($RDCZSideFPCInstallInput)
$RDCBothRouterFPCInstallRead = GUICtrlRead($RDCBothRouterFPCInstall)
$CapacityInput = ($RDCNumberOfProjectsRead * 10)

Local $ProjectNameRead = GUICtrlRead($ProjectNameInputBox)
$RDCNumberOfProjectsRead = GUICtrlRead($RDCNumberOfProjectsInput)
GUICtrlSetState($RDCSubmitButton, $GUI_DISABLE)
FileOpen("testing.txt", 1)
FileWrite("testing.txt", @CRLF)
FileWrite("testing.txt", "The purpose of this project is to add an additional ")
FileWrite("testing.txt", $CapacityInput)
FileWrite("testing.txt", "GB of capacity between ")
FileWrite("testing.txt", $RDCRouterNameRead)
FileWrite("testing.txt", " and ")
FileWrite("testing.txt", $RDCOtherRouterRead)
FileWrite("testing.txt", ".")
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", $RDCRouterNameRead)
FileWrite("testing.txt", ": Connect fiber into ")
FileWrite("testing.txt", $RDCInterfaceTypeRead)
FileWrite("testing.txt", "-")
FileWrite("testing.txt", $RDCInterfacePortRead)
FileWrite("testing.txt", @CRLF)
FileWrite("testing.txt", $RDCOtherRouterRead)
FileWrite("testing.txt", ": Connect fiber into ")
FileWrite("testing.txt", $RDCOtherInterfaceTypeRead)
FileWrite("testing.txt", "-")
FileWrite("testing.txt", $RDCOtherInterfacePortRead)
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", "Connect fiber between ports.")
FileWrite("testing.txt", @CRLF)
FileWrite("testing.txt", @CRLF & @CRLF)

For $I = 1 To $RDCNumberOfProjectsRead - 1
FileOpen("testing.txt", 1)

Local $soutput = Execute("'" & StringRegExpReplace($ProjectNameRead, "(?<=-\d{2})([A-Z])(?=-Q)", "' & Chr(Asc('$1') + $I) & '") & "'")
GUICtrlSetData($ProjectNameInputBox, $soutput)




FileWrite("testing.txt", "Project ")
FileWrite("testing.txt", $soutput)
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", "The purpose of this project is to add an additional ")
FileWrite("testing.txt", $CapacityInput)
FileWrite("testing.txt", "GB of capacity between ")
FileWrite("testing.txt", $RDCRouterNameRead)
FileWrite("testing.txt", " and ")
FileWrite("testing.txt", $RDCOtherRouterRead)
FileWrite("testing.txt", ".")
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", $RDCRouterNameRead)
FileWrite("testing.txt", ": Connect fiber into ")
FileWrite("testing.txt", $RDCInterfaceTypeRead)
FileWrite("testing.txt", "-")
FileWrite("testing.txt", $RDCInterfacePortRead)
FileWrite("testing.txt", @CRLF)
FileWrite("testing.txt", $RDCOtherRouterRead)
FileWrite("testing.txt", ": Connect fiber into ")
FileWrite("testing.txt", $RDCOtherInterfaceTypeRead)
FileWrite("testing.txt", "-")
FileWrite("testing.txt", $RDCOtherInterfacePortRead)
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", "Connect fiber between ports.")
FileWrite("testing.txt", @CRLF)
FileWrite("testing.txt", @CRLF & @CRLF)
FileClose("testing.txt")

GUICtrlSetData($ASideFPCInstallInput, "")
GUICtrlSetData($ZSideFPCInstallInput, "")
GUICtrlSetData($RDCASideOpticsInstallInput, "")
GUICtrlSetData($RDCZSideOpticsInstallInput, "")
GUICtrlSetData($RDCASidePicInput, "")
GUICtrlSetData($RDCZSidePicInput, "")
GUICtrlSetData($RDCZSideFPCInstallInput, "")
GUICtrlSetData($RDCASideFPCInstallInput, "")
GUICtrlSetState($RDCASideFPCInstall, $GUI_UNCHECKED)
GUICtrlSetState($RDCZSideFPCInstall, $GUI_UNCHECKED)
GUICtrlSetState($RDCASideOpticsInstall, $GUI_UNCHECKED)
GUICtrlSetState($RDCZSideOpticsInstall, $GUI_UNCHECKED)
GUICtrlSetState($RDCASidePicInstall, $GUI_UNCHECKED)
GUICtrlSetState($RDCZSidePicInstall, $GUI_UNCHECKED)
GUICtrlSetState($RDCBothRouterFPCInstall, $GUI_UNCHECKED)
GUICtrlSetState($RDCBothRouterPicInstall, $GUI_UNCHECKED)
GUICtrlSetState($RDCBothRoutersOpticsInstall, $GUI_UNCHECKED)
GUICtrlSetData($RDCOtherRouterInterfacePortInput, "")
GUICtrlSetData($RDCRouterInterfacePortInput, "")
GUICtrlSetState($RDCYesInstallFPCRadio, $GUI_UNCHECKED)
GUICtrlSetState($RDCNoInstallFPCRadio, $GUI_UNCHECKED)
GUICtrlSetState($RDCYesInstallPicRadio, $GUI_UNCHECKED)
GUICtrlSetState($RDCNoInstallPICRadio, $GUI_UNCHECKED)
GUICtrlSetState($RDCYesInstallOpticRadio, $GUI_UNCHECKED)
GUICtrlSetState($RDCNoInstallOpticRadio, $GUI_UNCHECKED)
GUICtrlSetData(-1, $RDCInterfaceTypeCombo)
GUICtrlSetData(-1, $RDCOtherRouterInterfaceTypeCombo)
GUICtrlSetState($RDCASideFPCInstall, $GUI_HIDE)
GUICtrlSetState($RDCZSideFPCInstall, $GUI_HIDE)
GUICtrlSetState($RDCBothRouterFPCInstall, $GUI_HIDE)
GUICtrlSetState($RDCFPCInstallLabel, $GUI_HIDE)
GUICtrlSetState($RDCFPCSideALabel, $GUI_HIDE)
GUICtrlSetState($RDCASideFPCInstallInput, $GUI_HIDE)
GUICtrlSetState($RDCSideZFPCInstallLabel, $GUI_HIDE)
GUICtrlSetState($RDCZSideFPCInstallInput, $GUI_HIDE)
GUICtrlSetState($RDCOpticsInstallLabel, $GUI_HIDE)
GUICtrlSetState($RDCASideOpticsInstall, $GUI_HIDE)
GUICtrlSetState($RDCZSideOpticsInstall, $GUI_HIDE)
GUICtrlSetState($RDCBothRoutersOpticsInstall, $GUI_HIDE)
GUICtrlSetState($RDCInstallOpticsSIdeALabel, $GUI_HIDE)
GUICtrlSetState($RDCASideOpticsInstallInput, $GUI_HIDE)
GUICtrlSetState($RDCInstallOpticsSideZLabel, $GUI_HIDE)
GUICtrlSetState($RDCZSideOpticsInstallInput, $GUI_HIDE)
GUICtrlSetState($RDCOpticsInstallLabel, $GUI_HIDE)
GUICtrlSetState($RDCASideOpticsInstall, $GUI_HIDE)
GUICtrlSetState($RDCZSideOpticsInstall, $GUI_HIDE)
GUICtrlSetState($RDCBothRoutersOpticsInstall, $GUI_HIDE)
GUICtrlSetState($RDCInstallOpticsSIdeALabel, $GUI_HIDE)
GUICtrlSetState($RDCASideOpticsInstallInput, $GUI_HIDE)
GUICtrlSetState($RDCInstallOpticsSideZLabel, $GUI_HIDE)
GUICtrlSetState($RDCZSideOpticsInstallInput, $GUI_HIDE)
GUICtrlSetState($RDCChooseRouterPicInstallLabel, $GUI_HIDE)
GUICtrlSetState($RDCASidePicInstall, $GUI_HIDE)
GUICtrlSetState($RDCZSidePicInstall, $GUI_HIDE)
GUICtrlSetState($RDCBothRouterPicInstall, $GUI_HIDE)
GUICtrlSetState($RDCInstallPICSIdeALabel, $GUI_HIDE)
GUICtrlSetState($RDCASidePicInput, $GUI_HIDE)
GUICtrlSetState($RDCInstallPICSIdeZLabel, $GUI_HIDE)
GUICtrlSetState($RDCZSidePicInput, $GUI_HIDE)
Next

GUICtrlSetState($RDCNextProjectButton, $GUI_DISABLE)
GUICtrlSetState($RDCSubmitButton, $GUI_ENABLE)

Case $ProjectSiteCombo
If GUICtrlRead($ProjectSiteCombo) = "SITE #1" Then
_GUICtrlComboBox_ResetContent($RDCRouterNameCombo)
GUICtrlSetData($RDCRouterNameCombo, "SITE1-ROUTER01|SITE1-ROUTER02", "")
_GUICtrlComboBox_SetCurSel($RDCRouterNameCombo, 0)
_GUICtrlComboBox_ResetContent($RDCOtherRouterNameCombo)
GUICtrlSetData($RDCOtherRouterNameCombo, "SITE1-ROUTER01|SITE1-ROUTER02", "")
_GUICtrlComboBox_SetCurSel($RDCOtherRouterNameCombo, 0)

ElseIf GUICtrlRead($ProjectSiteCombo) = "SITE #2" Then
_GUICtrlComboBox_ResetContent($RDCRouterNameCombo)
GUICtrlSetData($RDCRouterNameCombo, "SITE2-ROUTER01|SITE2-ROUTER02", "")
_GUICtrlComboBox_SetCurSel($RDCRouterNameCombo, 0)
_GUICtrlComboBox_ResetContent($RDCOtherRouterNameCombo)
GUICtrlSetData($RDCOtherRouterNameCombo,"SITE2-ROUTER01|SITE2-ROUTER02", "")
_GUICtrlComboBox_SetCurSel($RDCOtherRouterNameCombo, 0)

ElseIf GUICtrlRead($ProjectSiteCombo) = "SITE #3" Then
_GUICtrlComboBox_ResetContent($RDCRouterNameCombo)
GUICtrlSetData($RDCRouterNameCombo, "SITE3-ROUTER01|SITE3-ROUTER02", "")
_GUICtrlComboBox_SetCurSel($RDCRouterNameCombo, 0)
_GUICtrlComboBox_ResetContent($RDCOtherRouterNameCombo)
GUICtrlSetData($RDCOtherRouterNameCombo, "SITE3-ROUTER01|SITE3-ROUTER02", "")
_GUICtrlComboBox_SetCurSel($RDCOtherRouterNameCombo, 0)

EndIf
Case $RDCNoInstallFPCRadio
GUICtrlSetState($RDCASideFPCInstall, $GUI_HIDE)
GUICtrlSetState($RDCZSideFPCInstall, $GUI_HIDE)
GUICtrlSetState($RDCBothRouterFPCInstall, $GUI_HIDE)
GUICtrlSetState($RDCFPCInstallLabel, $GUI_HIDE)
GUICtrlSetState($RDCFPCSideALabel, $GUI_HIDE)
GUICtrlSetState($RDCASideFPCInstallInput, $GUI_HIDE)
GUICtrlSetState($RDCSideZFPCInstallLabel, $GUI_HIDE)
GUICtrlSetState($RDCZSideFPCInstallInput, $GUI_HIDE)


Case $RDCYesInstallFPCRadio
GUICtrlSetState($RDCASideFPCInstall, $GUI_SHOW)
GUICtrlSetState($RDCZSideFPCInstall, $GUI_SHOW)
GUICtrlSetState($RDCBothRouterFPCInstall, $GUI_SHOW)
GUICtrlSetState($RDCFPCInstallLabel, $GUI_SHOW)
Case $RDCASideFPCInstall
GUICtrlSetState($RDCSideZFPCInstallLabel, $GUI_HIDE)
GUICtrlSetState($RDCZSideFPCInstallInput, $GUI_HIDE)
GUICtrlSetState($RDCFPCSideALabel, $GUI_SHOW)
GUICtrlSetState($RDCASideFPCInstallInput, $GUI_SHOW)
Case $RDCZSideFPCInstall
GUICtrlSetState($RDCFPCSideALabel, $GUI_HIDE)
GUICtrlSetState($RDCASideFPCInstallInput, $GUI_HIDE)
GUICtrlSetState($RDCSideZFPCInstallLabel, $GUI_SHOW)
GUICtrlSetState($RDCZSideFPCInstallInput, $GUI_SHOW)
Case $RDCBothRouterFPCInstall
GUICtrlSetState($RDCFPCSideALabel, $GUI_SHOW)
GUICtrlSetState($RDCASideFPCInstallInput, $GUI_SHOW)
GUICtrlSetState($RDCSideZFPCInstallLabel, $GUI_SHOW)
GUICtrlSetState($RDCZSideFPCInstallInput, $GUI_SHOW)

Case $RDCNoInstallOpticRadio
GUICtrlSetState($RDCOpticsInstallLabel, $GUI_HIDE)
GUICtrlSetState($RDCASideOpticsInstall, $GUI_HIDE)
GUICtrlSetState($RDCZSideOpticsInstall, $GUI_HIDE)
GUICtrlSetState($RDCBothRoutersOpticsInstall, $GUI_HIDE)
GUICtrlSetState($RDCInstallOpticsSIdeALabel, $GUI_HIDE)
GUICtrlSetState($RDCASideOpticsInstallInput, $GUI_HIDE)
GUICtrlSetState($RDCInstallOpticsSideZLabel, $GUI_HIDE)
GUICtrlSetState($RDCZSideOpticsInstallInput, $GUI_HIDE)

Case $RDCYesInstallOpticRadio
GUICtrlSetState($RDCOpticsInstallLabel, $GUI_SHOW)
GUICtrlSetState($RDCASideOpticsInstall, $GUI_SHOW)
GUICtrlSetState($RDCZSideOpticsInstall, $GUI_SHOW)
GUICtrlSetState($RDCBothRoutersOpticsInstall, $GUI_SHOW)

Case $RDCASideOpticsInstall
GUICtrlSetState($RDCInstallOpticsSIdeALabel, $GUI_SHOW)
GUICtrlSetState($RDCASideOpticsInstallInput, $GUI_SHOW)
GUICtrlSetState($RDCInstallOpticsSideZLabel, $GUI_HIDE)
GUICtrlSetState($RDCZSideOpticsInstallInput, $GUI_HIDE)

Case $RDCZSideOpticsInstall
GUICtrlSetState($RDCInstallOpticsSIdeALabel, $GUI_HIDE)
GUICtrlSetState($RDCASideOpticsInstallInput, $GUI_HIDE)
GUICtrlSetState($RDCInstallOpticsSideZLabel, $GUI_SHOW)
GUICtrlSetState($RDCZSideOpticsInstallInput, $GUI_SHOW)

Case $RDCBothRoutersOpticsInstall
GUICtrlSetState($RDCInstallOpticsSIdeALabel, $GUI_SHOW)
GUICtrlSetState($RDCASideOpticsInstallInput, $GUI_SHOW)
GUICtrlSetState($RDCInstallOpticsSideZLabel, $GUI_SHOW)
GUICtrlSetState($RDCZSideOpticsInstallInput, $GUI_SHOW)
Case $RDCNoInstallPICRadio
GUICtrlSetState($RDCChooseRouterPicInstallLabel, $GUI_HIDE)
GUICtrlSetState($RDCASidePicInstall, $GUI_HIDE)
GUICtrlSetState($RDCZSidePicInstall, $GUI_HIDE)
GUICtrlSetState($RDCBothRouterPicInstall, $GUI_HIDE)
GUICtrlSetState($RDCInstallPICSIdeALabel, $GUI_HIDE)
GUICtrlSetState($RDCASidePicInput, $GUI_HIDE)
GUICtrlSetState($RDCInstallPICSIdeZLabel, $GUI_HIDE)
GUICtrlSetState($RDCZSidePicInput, $GUI_HIDE)

Case $RDCYesInstallPicRadio
GUICtrlSetState($RDCChooseRouterPicInstallLabel, $GUI_SHOW)
GUICtrlSetState($RDCASidePicInstall, $GUI_SHOW)
GUICtrlSetState($RDCZSidePicInstall, $GUI_SHOW)
GUICtrlSetState($RDCBothRouterPicInstall, $GUI_SHOW)
Case $RDCASidePicInstall
GUICtrlSetState($RDCInstallPICSIdeALabel, $GUI_SHOW)
GUICtrlSetState($RDCASidePicInput, $GUI_SHOW)
GUICtrlSetState($RDCInstallPICSIdeZLabel, $GUI_HIDE)
GUICtrlSetState($RDCZSidePicInput, $GUI_HIDE)
Case $RDCZSidePicInstall
GUICtrlSetState($RDCInstallPICSIdeALabel, $GUI_HIDE)
GUICtrlSetState($RDCASidePicInput, $GUI_HIDE)
GUICtrlSetState($RDCInstallPICSIdeZLabel, $GUI_SHOW)
GUICtrlSetState($RDCZSidePicInput, $GUI_SHOW)
Case $RDCBothRouterPicInstall
GUICtrlSetState($RDCInstallPICSIdeZLabel, $GUI_SHOW)
GUICtrlSetState($RDCZSidePicInput, $GUI_SHOW)
GUICtrlSetState($RDCInstallPICSIdeALabel, $GUI_SHOW)
GUICtrlSetState($RDCASidePicInput, $GUI_SHOW)
Case $RDCSubmitButton
If $RDCNumberOfProjectsRead = 1 Then
FileOpen("testing.txt", 1)
FileWrite("testing.txt", $RDCProjectSiteRead)
FileWrite("testing.txt", ",")
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", "We recently have launched the below C4 projects for your system. We need on site assistance to perform the maintenance. Please let us know who the POC for this activity will be so we can set up a call to plan this work." & @CRLF & @CRLF & "Details for C4 Projects:")
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", "Project ")
FileWrite("testing.txt", $RDCProjectNameRead & @CRLF)
FileWrite("testing.txt", @CRLF)
FileWrite("testing.txt", "The purpose of this project is to add an additional ")
FileWrite("testing.txt", $CapacityInput)
FileWrite("testing.txt", "GB of capacity between ")
FileWrite("testing.txt", $RDCRouterNameRead)
FileWrite("testing.txt", " and ")
FileWrite("testing.txt", $RDCOtherRouterRead)
FileWrite("testing.txt", ".")
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", $RDCRouterNameRead)
FileWrite("testing.txt", ": Connect fiber into ")
FileWrite("testing.txt", $RDCInterfaceTypeRead)
FileWrite("testing.txt", "-")
FileWrite("testing.txt", $RDCInterfacePortRead)
FileWrite("testing.txt", @CRLF)
FileWrite("testing.txt", $RDCOtherRouterRead)
FileWrite("testing.txt", ": Connect fiber into ")
FileWrite("testing.txt", $RDCOtherInterfaceTypeRead)
FileWrite("testing.txt", "-")
FileWrite("testing.txt", $RDCOtherInterfacePortRead)
FileWrite("testing.txt", @CRLF & @CRLF)
FileWrite("testing.txt", "Connect fiber between ports.")
FileWrite("testing.txt", @CRLF)
FileWrite("testing.txt", @CRLF & @CRLF)
FileClose("testing.txt")
Exit
Else
Exit
EndIf
Case $C4CoreProjectTypeRadio

Case $SystemProjectTypeRadio


EndSwitch
WEnd
[color=#282828][font=helvetica, arial, sans-serif]

Share this post


Link to post
Share on other sites

ok i have everything working on this first part except for one minor thing.

I have all of this writing to a file "rdc.txt" and I need the following to be "replaced"

Example:

TESTING-01A-Q1-2013.....let's say we had 4 projects....that would make the last project name TESTING-01E-Q1-2013....i need a string replace or add or something to have the end result looking like this:

TESTING-01A-01E-Q1-2013 I have tried a few things but am failing.

as always any help would be appreciated.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <array.au3>

#include <File.au3>
local $gui010       =   GUICreate('Project Manager',500,500)

$RDCSubmitButton    =   GUICtrlCreateButton("Submit",20, 400, 460, 30)
                GUICtrlCreateLabel("Please Input Your Project Name",20,20,190,20)
                GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$ProjectNameInputBox    =   GUICtrlCreateInput("", 210,17,250,20)
                GUICtrlCreateLabel("Please Input The Number Of Projects You Have Of This Kind", 20, 50, 370, 20)
                GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$RDCNumberOfProjectsInput =     GUICtrlCreateInput("", 390, 47, 70, 20)
                guictrlcreatelabel('Site Name',20,80,100,20)
                guictrlsetfont(-1,8,800,-1,'ms sans serif')
$site       =   GUICtrlCreateInput("", 210,80,250,20)
                guictrlcreatelabel('Status',20,445,50,20)
                guictrlsetfont(-1,8.5,800)

$status         =   guictrlcreatelabel('',20,460,460,20,$ss_sunken)
                guictrlsetfont(-1,9,800)
                guictrlsetcolor(-1,0xff0000)
                guictrlsetstate($ProjectNameInputBox,$gui_focus)
                GUISetState(@SW_SHOW)
$ProjectNameRead = GUICtrlRead($ProjectNameInputBox)
                guictrlsetdata($ProjectNameInputBox,'TESTING-01A-Q1-2013')  ; <--- for testing
guictrlsetstyle($RDCSubmitButton,$BS_DEFPUSHBUTTON)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            ;shellexecute(@scriptdir & '\testing.txt')
            Exit
        Case $RDCSubmitButton
$CapacityInput = ($RDCNumberOfProjectsInput * 10)

            If guictrlread($RDCNumberOfProjectsInput) = '' then
                MsgBox(0,"Error", 'Number of projects required')
                guictrlsetstate($RDCNumberOfProjectsInput,$gui_focus)
                continueloop
            endif

            If not stringisdigit(guictrlread($RDCNumberOfProjectsInput)) then
                MsgBox(0,"Error",'Number of projects must be numeric')
                guictrlsetstate($RDCNumberOfProjectsInput,$gui_focus)
                continueloop
            endif
            If guictrlread($ProjectNameInputBox) = '' then
                MsgBox(0,"Error",'Project name required')
                guictrlsetstate($ProjectNameInputBox,$gui_focus)
                continueloop
            endif
            if guictrlread($site) = '' then
                MsgBox(0,"Error",'Site name required')
                guictrlsetstate($site,$gui_focus)
                continueloop
            EndIf


            local $hfl = FileOpen(@scriptdir & '\testing.txt', 1)
            filewrite($hfl,guictrlread($site)& "," & @CRLF)
FileWrite($hfl, @CRLF & @CRLF)
FileWrite($hfl,"We recently have launched the below C4 projects for your system. We need on site assistance to perform the maintenance. Please let us know who the POC for this activity will be so we can set up a call to plan this work." & @CRLF & @CRLF & "Details for C4 Projects:")
FileWrite($hfl," Project ")
filewrite($hfl,guictrlread($ProjectNameInputBox)& @CRLF)
            FileWrite($hfl, @CRLF & @CRLF)
FileWrite($hfl,"The purpose of this project is to add an additional ")
FileWrite($hfl, $CapacityInput)
FileWrite($hfl, "GB of capacity between ")
filewrite($hfl,guictrlread($RDCNumberOfProjectsInput) & @CRLF)
            FileWrite($hfl, @CRLF)
fileclose($hfl)

            if guictrlread($RDCNumberOfProjectsInput) = 1 then
                guictrlsetdata($ProjectNameInputBox,'')
                guictrlsetdata($RDCNumberOfProjectsInput,'')
                guictrlsetdata($site,'')
                guictrlsetstate($ProjectNameInputBox,$gui_focus)
            endif
            if guictrlread($RDCNumberOfProjectsInput) > 1 then

                $aprojincr = stringregexp(guictrlread($ProjectNameInputBox),"(?<=-\d{2})([A-Z])(?=-Q)",3)
                 $incr_char = chr(asc($aprojincr[0])+guictrlread($RDCNumberOfProjectsInput))
                guictrlsetdata($ProjectNameInputBox,StringRegExpReplace(guictrlread($ProjectNameInputBox), _
                "(?<=-\d{2}A)(-\d{2}[A-Z])(?=-Q)", $incr_char))
                msgbox(0,"test1", $aprojincr)
msgbox(0,"test1", $incr_char)
;guictrlsetdata($RDCNumberOfProjectsInput,guictrlread($RDCNumberOfProjectsInput) - 1)
                guictrlsetdata($site,'')
                guictrlsetstate($site,$gui_focus)
            endif
 $find = $aprojincr
 $replace =$incr_char
_ReplaceStringInFile("rdc.txt", $find, $replace,0,0)
if guictrlread($RDCNumberOfProjectsInput) < 1 then
FileOpen(@scriptdir & '\testing.txt', 1)
Exit

EndIf
EndSwitch
WEnd

Share this post


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
Sign in to follow this  
Followers 0

  • Similar Content

    • wimhek
      By wimhek
      Is it possible , and how can I read and write txt files from Icloud (apple service) ?
      Let me try to explain my application.
      On my Ipad and Iphone I create txt files. On my windows computer it is possible to read and modify these files manually, by logging in on www.icloud.com.
      What I want to make is an auto-it script who reads the txt file and create an new txt file on www.icloud.com,  so I can acces these on my ipad and/or phone.
       
      Thank you.
    • StudioMaker
      By StudioMaker
      Hey anyone knows how i can have a inputbox that is connected to an HotKeySet? Like if u put in like "a" in the inputbox it sets the hotkey to "a"?
       
    • ur
      By ur
      if ControlClick("[CLASS:MsiDialogCloseClass]"," ","[CLASS:SysTreeView32; INSTANCE:1]") Then $htreeview=ControlGetHandle($hwnd,"","[CLASS:SysTreeView32; INSTANCE:1]") ControlTreeView($hwnd," ",$htreeview,"Select","#4") The above code worked well to enable the martupgrade feature on windows 7.
      As part of our Installation Testing Automation before delivering the installer to end user.To confirm whether all the screens are working good.

      But it is not working on windows 10.
       
      $h= ControlTreeView($hwnd," ",$htreeview,"Select","#4") The $h is getting value 1,which means error.
    • ur
      By ur
      I have automated an install process by using the below code.
       
      Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc $win1 = "Text 1" $win2 = "Text 2" _WinWaitActivate($win1,"WARNING: This progra") Send("{ALTDOWN}n{ALTUP}");Send("{SPACE}") _WinWaitActivate($win1,"I DISAGREE and &do n") Send("{UP}n") _WinWaitActivate($win1,"Customer Information") Send("{ALTDOWN}n{ALTUP}");Send("{TAB}{TAB}n") _WinWaitActivate($win1,"Click Next to instal") Send("{ALTDOWN}n{ALTUP}");Send("n") _WinWaitActivate($win1,"This feature require") Send("{ALTDOWN}n{ALTUP}");Send("{TAB}n") _WinWaitActivate($win1,"Ready to Install the") Send("{ALTDOWN}i{ALTUP}");Send("i") _WinWaitActivate($win1,"The InstallShield Wi") Send("{ALTDOWN}f{ALTUP}");Send("f") _WinWaitActivate($win2,"You must restart you") Send("{ALTDOWN}n{ALTUP}");Send("n") Now if any new screen comes in the middle of installation, like some VC++ installation error or like that.
      The AutoIT is waiting in the background.
      Is there any way to skip the new screens with just "enter" and continue the installation??
    • akira2891
      By akira2891
      Hi,
      I was wondering is this all inputs can be done in 1 box with 3 fields and not to use another gui.
      And how can i validate data for example if i don't enter username he prompt me a message box all time until field is empty.
      I try like this but it give me a msgbox and continue on another field.
      $username = InputBox("Add new user", "Username", "", "", 200, 130, Default, Default, 0) if $username <> " " then msgbox(0, "", "Please enter username") endif $email = InputBox("Add new user", "Email", "", "", 200, 130, Default, Default, 0) $password = InputBox("Add new user", "Password", "", "*", 200, 130, Default, Default, 0)