AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GUI conceptual newbie question

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
viking



Joined: 03 May 2005
Posts: 2

PostPosted: Tue May 03, 2005 10:01 am    Post subject: GUI conceptual newbie question Reply with quote

Hi, I would like to do the following and would like to understand the concept behind AHK with displaying a GUI and read the user input:

The program should simply read an input file like follows:

x Kategorie 1
Kategorie 2
Kategorie 3
x Kategorie 4

The x before the kategorie name should indicate that this kategorie schould be kategorie in the GUI menu.

The program should read the above file and display in the GUI checkboxes with the kategorie names. The kategories with the x should be checken in the gui.

The user should see this GUI with the checkboxes, make some additional checks or delete some checks. After that the programm should write the input file (same format as above). Any help is very appreciated.
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 1186
Location: switzerland

PostPosted: Tue May 03, 2005 11:43 am    Post subject: Reply with quote

This script is an example with variables input and select ,write a csv file
saves variables and read last input
combobox,checkbox,DDL (DropDownList)

Code:

;PBX2.AHK  2005-05-03 garry, writes CSV file (PBX2.TXT)

Gui, Show, x270 y110 h420 w485, PBX2            ;WINDOW

Gui, Font,  S12 CDefault Bold, Verdana          ;TITLE
Gui, Add, Text, x186 w140 h30, EXAMPLE-1

Gui, Font,  S8 w400 Cgreen, Arial               ;GroupBox
Gui,add,GroupBox, x165 y230 w110 h120, Parameters

;----------------------------------------------------------
Loop, read, PBX2.txt
{
  Loop, parse, A_LoopReadLine, CSV
  {
    if a_index = 1
      lac = %a_loopfield%
    if a_index = 2
      msn1 = %a_loopfield%
    if a_index = 3
      pbx = %a_loopfield%
    if a_index = 4
      acr = %a_loopfield%
    if a_index = 5
      lines = %a_loopfield%
    if a_index = 6
      COLOR = %a_loopfield%
    if a_index = 7
      C5 = %a_loopfield%
  }
}
;--------------INPUTS VARIABLE-----------------------------
Gui, Font,  S10 CDefault Bold, Verdana
Gui, Add, Text, x40 y40 w120 h20, LAC
Gui, Add, Edit, x176 y40 w240 h20 vLAC, %LAC%

Gui, Add, Text, x40 y80 w120 h20, MSN1
Gui, Add, Edit, x176 y80 w240 h20 vMSN1, %MSN1%

Gui, Add, checkbox, x176 y120 vPBX, PBX
Gui, Add, checkbox, x260 y120 vACR, ACR

Gui, Add, Text, x40 y160 w120 h20, LINES 16/32/64
Gui, Add, ComboBox, x176 y160 vLINES, 16|32|64

Gui, Add, Text, x40 y200 w120 h20, COLOR B/W/G
Gui, Add, DDL, x176 y200 sort vCOLOR, B|W|G

Gui, Add, Radio,x176 y250 vC5, 256
Gui, Add, Radio,x176 y270 ,    512
Gui, Add, Radio,x176 y290 ,    1024



;---------------CONTROL CHECK/COMBOBOX---------------------
Control, ChooseString, %lines%, ComboBox1, PBX2

Control, ChooseString, %COLOR%, ComboBox2, PBX2
Control, ChooseString, %COLOR%, DDL2, PBX2


if pbx = 1
  Control, Check,, PBX, PBX2
else
  Control, Uncheck,, PBX, PBX2

if acr = 1
  Control, Check,, ACR, PBX2
else
  Control, Uncheck,, ACR, PBX2


if C5 = 1
  Control, check,, 256, PBX2
else
  Control, Uncheck,, 256, PBX2

if C5 = 2
  Control, Check,, 512, PBX2
else
  Control, Uncheck,, 512, PBX2

if C5 = 3
  Control, check,, 1024, PBX2
else
  Control, Uncheck,, 1024, PBX2

;-----------------BUTTON------------------------------------
Gui, Font,  S8 CDefault Bold, Verdana
Gui, Add, Button, x136 y370 w90 h30, CLEAR
Gui, Add, Button, x366 y370 w90 h30, OK

Return
;------------------------------------------------------------
ButtonClear:
FILEDELETE PBX2.TXT
reload
return

ButtonOK:
GuiClose:
GuiEscape:
Gui, submit

FILEDELETE PBX2.TXT
ifNotExist, %A_ScriptDir%\PBX2.TXT
FILEAPPEND, %LAC%`,%MSN1%`,%PBX%`,%ACR%`,%LINES%`,%COLOR%`,%C5%, PBX2.TXT
ExitApp

Back to top
View user's profile Send private message
viking



Joined: 03 May 2005
Posts: 2

PostPosted: Tue May 03, 2005 2:36 pm    Post subject: Thanks a lot Reply with quote

Hi Garry, thanks a lot for the very fast feedback Very Happy Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group