Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Dynamically show result in Gui according to the information inputted



  • Please log in to reply
4 replies to this topic
yorkflying
  • Members
  • 3 posts
  • Last active:
  • Joined: 28 Nov 2013

I am new in Autohotkey.  I have a created a Gui . It has a DropDownList, Calendar, a textBox  and another Feport File textbox (The default value is clipboard value). I want the Report file textbox could be changed dynamically according to the information inputted in the dropdown box and the calendar.

 

Any one can help to solve this problem?

 

 

 

gosub tst

 

tst:

{

:*:tst::

Gui, Font, s9

Gui, Add, Text, x10 y17 w130 h30 , Instrument

Gui, Add, DropDownList, x10 y35 w130 h140 vInstID Choose1,

(

                MSD14

                |MSD16

                |MSD28

                |MSD40

                |MSD46

                |MSD48

                |MSD50

)

 

Gui, Add, Text, x10 y142 w130 h25 , Data File

Gui, Add, Edit, x10 y160 w130 h25 vFileID,

Gui, Add, Text, x185 y17 w110 h25 , Sequence Date

Gui, Add, MonthCal, x185 y35 w200 h160 vSeqDate,

Gui, Add, Text, x10 y215 w130 h-200 ,

Gui, Add, Text, x10 y232 w130 h30 , Report File

;~ Gui, Add, Edit, x10 y250 w380 h25 vReportFile, T:\MSD50\DATA\2015\MS500930\MS50SS09.D

Gui, Add, Edit, x10 y250 w380 h25 vReportFile, %clipboard%

Gui, Add, Button, x25 y315 w100 h30 gOpen, Open

Gui, Add, Button, x150 y315 w100 h30 gBrowse, Browse

Gui, Add, Button, x275 y315 w100 h30 gCancel, Cancel

Gui, Show, w400 h360, Report File

 

return

 

Open:

                Gui,  Submit, NoHide                                                      ; Save the selection

                StringTrimRight, InstID, InstID, 2                                                                                                ;Trim the {Enter} at the end of InstID

                ReportFile = %ReportFile%\epatemp.txt

                IfNotExist, %ReportFile%

                                {

                                ReportFile :="T:\" InstID "\Data\" substr(SeqDate,1,4) "\MS" substr(InstID,4,2) substr(SeqDate,5,4) "\MS" substr(InstID,4,2) FileID ".D\epatemp.txt"

                                }

                ;~ run notepad %ReportFile%

                ExitApp

                return

 

Browse:

                Gui, Destroy

                FileSelectFile, ReportFile, 3, T:\ , Open a file, Text Documents (epatemp.txt)

                ;~ run notepad %ReportFile%

                ExitApp

                return

               

Cancel:

ExitApp

 

GuiClose:

ExitApp

 

return

return

}

 



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

In what way should the Report File Text Box (do you mean the Text control or the Edit control?) be dynamically updated?

 

You can pull this off using gLabels and the GuiControl command. You've already got gLabels in your script, so I presume you understand how they'd work. In this case, you may also want to use the Gui, Submit, NoHide command to respond to the selected Calendar Dates and selected DropDownList item more easily than trying to use GuiControlGet to retrieve their values.



yorkflying
  • Members
  • 3 posts
  • Last active:
  • Joined: 28 Nov 2013

To simplify the problem.  Assume there is one gui has 3 Edit box. The content of the 3rd Edit box will show concatenation of Box 1 and Box 2 dynamically while I input something in box 1 and box 2.

 

 

Gui, Add, Text, x10 y10 w200 h30 , String 1
Gui, Add, Edit, x10 y40 w200 h30 , aaa
Gui, Add, Text, x10 y90 w180 h30 , String 2
Gui, Add, Edit, x10 y130 w200 h30 , bbb
Gui, Add, Text, x10 y180 w200 h30 , Result
Gui, Add, Edit, x10 y210 w320 h30 ,                                                                     ;Here will show "aaabbb" (String 1 + String 2)
 
Gui, Show, w332 h280, Untitled GUI
return
 
GuiClose:
ExitApp


Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012
Gui, Add, Text, x10 y10 w200 h30 , String 1
Gui, Add, Edit, x10 y40 w200 h30 gUpdateEdit3 vEdit1, aaa
Gui, Add, Text, x10 y90 w180 h30 , String 2
Gui, Add, Edit, x10 y130 w200 h30 gUpdateEdit3 vEdit2, bbb
Gui, Add, Text, x10 y180 w200 h30 , Result
Gui, Add, Edit, x10 y210 w320 h30 vEdit3,   aaabbb                                                                   ;Here will show "aaabbb" (String 1 + String 2)
 
Gui, Show, w332 h280, Untitled GUI
return
 
UpdateEdit3:
Gui, Submit, NoHide
GuiControl,,Edit3, % Edit1 Edit2
return
 
GuiClose:
ExitApp
 
Yeah?


yorkflying
  • Members
  • 3 posts
  • Last active:
  • Joined: 28 Nov 2013
✓  Best Answer

Thanks so much. It works.