Combobox and Edit Text box

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AFerreira
Posts: 14
Joined: 01 Mar 2017, 07:07

Combobox and Edit Text box

13 Mar 2017, 10:30

Hello to the whole community. I needed to clarify a question. Can anyone clarify how I can ASSOCIATE A COMBOBOX TO A TEXT? Ex: If you choose "combobox" in the combobox, a word or text appears in the text. If you chose in the combobox "Alpha", the text box would appear another word or another text .. and so on ..
Thank you to anyone who can help!


CODE: =================================================

Gui, Add, ComboBox, x92 y109 w120 h120 , ComboBox|Alfa|Beta
Gui, Add, Edit, x242 y109 w150 h70 , Edit
Gui, Show, x127 y87 h379 w479, New GUI Window
Return

GuiClose:
ExitApp
=========

IMAGE: http://imgur.com/z0kgeph
garry
Posts: 3770
Joined: 22 Dec 2013, 12:50

Re: Combobox and Edit Text box

13 Mar 2017, 11:27

boa tarde , an example

Code: Select all

FileName=TestCombobox
Gui,1: Color, ControlColor,Black           ;- background from edit
Gui,1: Color, Black                        ;- Gui color
Gui,1:Font,cGray ,Fixedsys

e4x=
(Ltrim Join|
Combobox
Alfa
Beta
)
Gui, Add, ComboBox, x10  y10  w120 h120 gA1 vCB1,%e4x%
Gui, Add, Edit,     x140 y10  w300 h200  vED1,
Gui, Show, x100 y10 h240 w450,%filename%
Return

A1:
Gui,1:submit,nohide
e .= cb1 . "`n"
GuiControl,1:,ED1,%e%
return

GuiClose:
ExitApp
AFerreira
Posts: 14
Joined: 01 Mar 2017, 07:07

Re: Combobox and Edit Text box

13 Mar 2017, 14:21

Hi. Thanks for the speed in the reply. It's a bit of that but, every time there is a choice in the combobox, the edit should not stick to the previous record.
And I plan to do it with emails or with text.

Example 1:
Combobox: .................. Edit
(Choice 1) google ........................ www.google.com

Example 2:
Combobox: .................. Edit
(Choice2) Text ........................ I really like learning through the AutoHotKey community forum
garry
Posts: 3770
Joined: 22 Dec 2013, 12:50

Re: Combobox and Edit Text box

13 Mar 2017, 15:04

example , send text or start google , first edit is for search

Code: Select all

FileName=TestCombobox
Gui,1: Color, ControlColor,Black           ;- background from edit
Gui,1: Color, Black                        ;- Gui color
Gui,1:Font,cGray ,Fixedsys

e4x=
(Ltrim Join|
Line1
Line2
Google
)

Gui, Add, ComboBox, x10   y10  w120  gA1 vCB1,%e4x%
Gui, Add, Edit,     x140  y10  w300 h30  vSrch,Lisboa navio
Gui, Add, Edit,     x140  y50  w300 h30  vTXT readonly right,
Gui, Show, x100 y10 h240 w450,%filename%
Return

A1:
Gui,1:submit,nohide
;e .= cb1 . "`n"
if (CB1="google")
  run,https://www.google.pt/search?cr=countryPT&q=%srch%&num=100&hl=pt&tbm=nws
else
  GuiControl,1:,txt,%cb1%
return

GuiClose:
ExitApp
another example select countries and language for googlesearch

Code: Select all

#Warn
#NoEnv
SendMode, Input
SetWorkingDir, %A_ScriptDir%
Gui,2: Color, ControlColor,Black           ;- background from edit
Gui,2: Color, Black                        ;- Gui color
Gui,2: Font,s12 cWhite ,Lucida Console     ;- font , font-size and color

transform,s,chr,32
ftext=TEST
src:=""
src=schip maas grave
e5x:=""
e5x=
(Ltrim join|
Australia       ,au,en
Switzerland     ,ch,de
Nederland       ,nl,nl
Portugal        ,pt,pt
UK              ,uk,en
USA             ,us,en
Philippines     ,ph,en
Romania         ,ro,ro
Norway          ,no,nb   ;- or nn
South Africa    ,za,af
%s%

)

Gui,2: Show, NA x100 y5 w420 h90, %ftext%
Gui,2: Add, Edit,      x10   y5   w265 h25 cWhite vSearchx,%src%
Gui,2: Add, DDL ,      x10   y40  w150 vCountryDDL,%e5x%
Gui,2:  Add, Button,   x200  y40  w100 h26 gAA     ,Start
GuiControl,2:Focus,Searchx
GuiControl,2:Choose,countryddl,3
return
2Guiclose:
exitapp

aa:
Gui,2:submit,nohide
stringreplace,searchx,searchx,`",`%22,all
if countryDDL<>
   {
   StringSplit,h, countryddl, `,
   stringupper,h2,h2
   xxc=&cr=country%h2%
   }
;msgbox,https://www.google.com/search?hl=%h3%%xxc%&q=%searchx%&num=100
run,https://www.google.com/search?hl=%h3%%xxc%&q=%searchx%&num=100
;run,https://www.google.com/search?hl=en%xxc%q=%searchx%#q=%searchx%&tbm=nws&num=100
return
send email ( thunderbird )

Code: Select all

[email protected]
stringsplit,CXA,C9,`@,
DATES=%A_DD%-%A_MM%-%A_YYYY%

PR=%A_ProgramFiles%\Mozilla Thunderbird\thunderbird.exe

TO=to='%C9%'
SB=subject=Greetings
BD=body=%dates%`%0A`%0A`%0AHi %cxa1% `%0A`%0AHow ar`%27 you ?`%0A`%0AConcerns ... `%0A`%0A`%0A`%0A           Greetings`%2C`%0AGarry`%0A`%0A+33-71-1234567
ALL=%TO%,%SB%,%BD%
run,%PR% -compose "%ALL%"
return
AFerreira
Posts: 14
Joined: 01 Mar 2017, 07:07

Re: Combobox and Edit Text box

13 Mar 2017, 16:45

Thank you, friend, for your attempts to help. This is still a little hard to understand, for me ... I'm just getting started with AutoHotKey!
I just need something simpler, even the kind I said.
I was not talking about the choice of google to take to the page!
I was trying to say that if in the "combobox" I chose google, in the "text box" should appear www.google.com!
That is, to type a database of mails, in which the "combobox" has the annotation and the "text box" has the complete extension of the mails.
This applies to longer texts ...
Something we can choose in the "combobox" and this will imply a text writing in the "text box" .. that can be a line, a paragraph, or a text .. just that!
I apologize if there is any difficulty understanding, but I am Portuguese and I am using Google Translate
garry
Posts: 3770
Joined: 22 Dec 2013, 12:50

Re: Combobox and Edit Text box

18 Mar 2017, 15:02

example send to notepad or start internet,email,folder etc ...

Code: Select all

;https://autohotkey.com/boards/viewtopic.php?f=5&t=29178

#Warn
#NoEnv
SendMode, Input
SetWorkingDir, %A_ScriptDir%
Gui,2: Color, ControlColor,Black           ;- background from edit
Gui,2: Color, Black                        ;- Gui color
Gui,2: Font,s12 cWhite ,Lucida Console     ;- font , font-size and color
transform,s,chr,32
ftext=TEST

pr=notepad
sc=ahk_exe Notepad.exe

searchx=Lisboa
h2:=""
e5x:=""
e5x=
(Ltrim join|
Google             ;https://www.google.com/search?hl=pt&cr=countryPT&q=%searchx%&num=100
emailTOMyFriend    ;mailto:[email protected]
SunCalc            ;http://suncalc.net/#/38.7223,-9.1393,13/
MyFolder           ;C:\Test
MyText1 Hello      ;Hello Ferreira
MyText2 By         ;Wishing you a nice day !
%s%

)

Gui,2: Show, NA x100 y5 w420 h90, %ftext%
Gui,2: Add, Edit,      x10   y5   w400 h25 cGray readonly vLineX,
Gui,2: Add, DDL ,      x10   y40  w200 gAA2 vMyDDL,%e5x%
Gui,2: Add, Button,   x240  y40  w100 h26 gAA1     ,Send
GuiControl,2:Choose,MyDDL,5
gosub,aa2
return
2Guiclose:
exitapp

aa2:
Gui,2:submit,nohide
StringSplit,h,Myddl, `;
GuiControl,2:,LineX,%h2%
return

aa1:
Gui,2:submit,nohide
if MyDDL<>
{
StringSplit,h,Myddl, `;
stringmid,h2a,h2,1,4
stringmid,h2b,h2,2,2
if (h2a="mail") or (h2a="http")
  {
  run,%h2%
  return
  }
if (h2b=":\")
  {
  ifexist,%h2%
    run,%h2%
  return
  }
IfWinNotExist,%sc%
 {
 Run, %pr%,,,pid1
 WinWait,%SC%
 }
IfWinNotActive ,%SC%,,WinActivate,%SC%
    WinWaitActive,%SC%
ControlSend, Edit1, %h2%`n,%sc%
}
return
;======================================

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ccqcl, inseption86, mikeyww and 385 guests