Jump to content
Sign in to follow this  
atnextc

FileWrite Issues with waiting for user input

Recommended Posts

atnextc

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
kylomas

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
atnextc

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
kylomas

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
kylomas

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
atnextc

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
kylomas

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
atnextc

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
kylomas

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
atnextc

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
kylomas

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
atnextc

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
atnextc

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  

  • Similar Content

    • Ackerz
      By Ackerz
      Hi guys,
      So I am trying to automate a task and this task has an input box with an already set character "9". 
      I have just decided that I don't really need the input as an option but it's good to leave however for this instance I would like it to run past this point automatically. I've tried numerous ways to try and automate the use of the "OK" button using ControlClick and various other options. I just can't seem to see where this point in the script is. Scoured the forums for anything similar but didn't have any luck finding anything. Sorry to be a pain and I hope someone can help, if I haven't explained in enough detail please don't hesitate to ask for more.
      Many thanks,
      Ackerz
       
      Local $len Local $n Local $buff Local $aMyDate $Len = InputBox("Test",$msgPrompt,"9") $len = StringStripWS($len,$STR_STRIPALL) ;Check that user has entered a vaild password length if not StringIsDigit($len) or $len = 0 Then MsgBox(48,"Error","Invaild Integer was entered" & @CRLF & "Program will now exit.") Exit EndIf ;This creates the random password. for $i = 1 to $Len ;Pick a random char between 1 and the pwsMask Length $n = int(random(1,StringLen($pwsMask))) ;Concat each char that has been picked out of pwsMask to $buff $buff = $Buff & StringMid($pwsmask,$n,1) Next  
    • ramin92003
      By ramin92003
      Hi, 
      Is there any possibility to change the cancel button text to quit in the Inputbox?
    • FMS
      By FMS
      Hello,

      I'm having a problem whit winwait on firefoxscreens whit the same title and text.
      On mine quest on this forum and internet I've found some work around and solutions.
      unfortunaly This wasn't working for me.

      I've tried searching tru winlist or finding some unique text but wasn't finding any solution.
      Does anyone know how to get the wright handle?
      I just want to move the browser to the right place in the end whit WinMove.

      thnx in advanced.

       
      #include <Array.au3> Global $A_URL[4][2] = _ [["url1" , "same_title"] , _ ["url2", "same_title"] , _ ["url3" , "other_title" ] , _ ["url4" , "other_title" ]] ;~ _ArrayDisplay($A_URL) ;-----kill all firefox.exe ;~ Run("taskkill /IM firefox.exe /F", "", @SW_HIDE) ;Sleep(5000) For $i = 0 To 1 ConsoleWrite("running 1 : " & $i & @CRLF) Local $ID = ShellExecute("firefox.exe", "-new-window " & $A_URL[$i][0] ,"C:\Program Files\Mozilla Firefox" ) ConsoleWrite("$ID = " & $ID & @CRLF) Next sleep(200) ;~ Local $screen1HWND = WinWait($A_URL[0][1],"") ;~ If Not WinActive($screen1HWND) Then WinActivate($screen1HWND) ;~ ConsoleWrite("$screen1HWND = " & $screen1HWND & @CRLF) ;~ Local $screen2HWND = WinWait($A_URL[1][1],"") ;~ If Not WinActive($screen2HWND) Then WinActivate($screen2HWND) ;~ ConsoleWrite("$screen2HWND = " & $screen2HWND & @CRLF) $sWinTitle = $A_URL[0][1] $avWinList = WinList($sWinTitle) For $n = 1 to $avWinList[0][0] ConsoleWrite("Window " & $n & ": Text: " & WinGetText($avWinList[$n][1]) & @LF) Next For $i = 0 To 1 ;~ WinWait("title1", "", 10) ;~ WinActive("title1", "") ;~ WinMove ("title1", "", $i , $i ) Next  
    • MFrancisca
      By MFrancisca
      OK, after days looking at my code, the help file and forums I come (again) for help on message windows.
      I'm having trouble trying to close window messages that appear. This is the code I'm using
      #include <MsgBoxConstants.au3> Local $obs_handler = 0 Opt("WinTitleMatchMode",2) While 1 $obs_handler = WinWait("C:\Users\", "", 1) If IsHWnd($obs_handler) then MsgBox($MB_OK, "Message", "handler: "&$obs_handler, 1) ;Sleep(100) $obs_handler = HWND($obs_handler) WinKill($obs_handler, "") ;<<<<< PROBLEM!!!!! Else MsgBox($MB_OK, "Message", "No handler", 1) EndIf Send("{ESC}") Sleep(2000) $obs_handler = 0 WEnd The problem is on the Winkill command, it won't just close the window! 
      Winwait is capturing the handler, it checks as handler. Ii'm using the HWND() command just to be sure it is the correct variable type.  I've also checked the message box info with the autoit window info tool and the handle value matches the one captured by the code. 
      I've tried winkill, winclose, using wingethandle, moving the winkill command to Before the message box so it is not converted to a string, and now using the hwnd function to force the variable type of the handler. The use of the sleep command does not make any diference.
      As a side quest, I'd like to use classes to capture the windows instead of titles, just to keep things cleaner, but using the [CLASS:...] value for winwait is not working. I have the class name and number, am I missing something? 
       
      Thanks! 
    • pixelsearch
      By pixelsearch
      Hi everybody,
      I wanted to share with you this short piece of code where InputBox will always be on top (it's important to have it on top, kind of "MsgBox style") .  It's the shortest way I found to make it happen, with few lines of code :
      Do $sNb_Quest = InputBox("Quiz", "How many questions to answer ? (1-99)", "10", " M2", _ 220, 140, Default, Default, 0, GUICreate("", 0, 0, 0, 0, Default, @SW_SHOWDEFAULT)) If @error = 1 Then MsgBox(4096, "End of script", "You choosed to Quit") Exit EndIf GUIDelete() ; place this line here, not just after InputBox, or @error will be reset to 0 $iNb_Quest = Number($sNb_Quest) Until $iNb_Quest > 0 And IsInt($iNb_Quest) = 1 MsgBox(4096, "Result", "Your choice : " & $iNb_Quest) In the precedent code, the user can't type more than 2 characters. Inputs like "0" or ".5" or "-1" will be automatically rejected, also the Input is mandatory, default is 10. The last parameter, GUICreate, is the key to have this InputBox always on top (in a quick way)

      My question is : should GUIDelete() be present in the code or can we delete that line ?
      It seems to work fine without the GUIDelete() line, but in case the loop repeats several times (because of bad inputs), then we will have several GUICreate() without a single GUIDelete() ?
      Thanks for... your input 
       
×