Sign in to follow this  
Followers 0
lrstndm

Write into inputbox

6 posts in this topic

Hello,

i have a problem with a tool of mine can someone help me please??

if i choose a profile and click load the information should enter in the inputbox, but i don't know how to do it.

i want that i can enter something in the inputbox with a click on the button

The text to put in the inputbox need to come from a .ini file

The inifile i used for this tool is in the attachments.

Thanks

This is the config.ini file:

[settings]

profile1=profilename1

profile2=profilename2

This is the autoit code:

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

$Form1 = GUICreate("test", 286, 138, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 16, 16, 153, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData( $Combo1, "profile1|profile2")
$Button1 = GUICtrlCreateButton("Load", 16, 40, 81, 25)
$Input1 = GUICtrlCreateInput("", 16, 72, 121, 21)
GUISetState(@SW_SHOW)

$profile1 = IniRead( "config.ini", "settings", "profile1", "")
$profile2 = IniRead( "config.ini", "settings", "profile2", "")

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button1
            If GUICtrlRead($Combo1) = $profile1 Then
                ;write the name of profile1 into $input1 (the name is the text who is in the config.ini file) (that is: profilename1)
            ElseIf GUICtrlread($Combo1) = $profile2 Then
                ;write the name of profile2 into $input1 (the name is the text who is in the config.ini file) (that is: profilename2)
            EndIf
    EndSelect
WEnd

Regards,

Lars

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try this:

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

$Form1 = GUICreate("test", 286, 138, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 16, 16, 153, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$keys = IniReadSection( "config.ini", "Settings" )
$profiles = ""
For $i = 1 To UBound($keys) - 1
    $profiles &= $keys[$i][1] & "|"
Next
GUICtrlSetData( $Combo1, $profiles, $keys[1][1])
$Button1 = GUICtrlCreateButton("Load", 16, 40, 81, 25)
$Input1 = GUICtrlCreateInput("", 16, 72, 121, 21)
GUISetState(@SW_SHOW)


While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    Case $msg = $Button1
            GUICtrlSetData($Input1, GUICtrlRead($Combo1))
    EndSelect
WEnd

Br,

UEZ

PS: I was faster than Melba23 ;)

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Thank you so much. ;)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Try this:

<snip>

Br,

UEZ

PS: I was faster than Melba23 ;)

I was going to comment on this but I made a promise to the big M and I don't remember if yesterday was the last day or if it's today. Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

George,

You have to wait until tomorrow - sorry! ;)

UEZ,

The mine rescue in Chile is taking too much of my attention today - but as Schwarzenegger says: "I'll be back!" :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I had that hunch but then again you might be sucking me into an extra day with time zones.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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