Jump to content

Extract contents of GUICtrlCreateInput


e2e4au
 Share

Recommended Posts

$AddName = GUICtrlCreateInput(" ", 90, 74, 150, 20)

I have the above line in my script. When I use MSGBOX to look at what $AddName contains, it shows "8" - The ControlID. How do I get the Human input from within the GUICtrlCreateInput?

Regards

Link to comment
Share on other sites

Posted ImageRTFM

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

GUICtrlRead

--------------------------------------------------------------------------------

Read state or data of a control.

GUICtrlRead ( controlID [, advanced] )

<{POST_SNAPBACK}>

RTFM - For the user who posted this - I always RTFM before posting!!!! Any that is why people who have issues with certain things do post items for help.

We can not all be so special as you (NOT) Mr RTFM,

To the person who replied with help - Thank you. My script is below and as you will see I had that command but still no joy. What I have got wrong??

-------------------------------------------------------------------------------------

#include <GUIConstants.au3>

#include<array.au3>

; Global Variables

Dim $MaxNumOfDoctors = 5 ;Change this for higher useage charge $$$$

Dim $UserName[10]

Dim $NumberOfNames

Dim $AName

Dim $TabName1 = "Add Doctor"

Dim $TabName2 = "Sync Files"

Dim $TabName3 = "Delete Doctor"

Dim $TabName4

Dim $TabName5

Dim $TabName6

Dim $TabName7

Dim $TabName8

Dim $TabName9

Dim $TabName10

;Function Names --> User Functions

UF_RunFunctions()

Func UF_RunFunctions()

UF_ControlFileExist()

UF_ReadUserNames()

UF_UserGUI()

EndFunc ;==>UF_RunFunctions

;---------------------------------------------------------------------------------------------------------------

Func UF_ControlFileExist()

Local $LString

Local $CreateFile

Local $Count

Local $WriteLineString

Local $AY

Local $i

$LString = StringFormat("%s", "ControlFile.ini")

If FileExists($LString) Then

;Check to see if ready

Return

Else

; Create new control file with all inclusions

$CreateFile = FileOpen($LString, 1) ; Append Mode

;Write RaceResults area to file

$WriteLineString = StringFormat("%s", "[DoctorsName]")

FileWriteLine($CreateFile, $WriteLineString & @CRLF & @CRLF)

For $Count = 1 To $MaxNumOfDoctors

$WriteLineString = StringFormat("%s%s%s", "DrName", $Count, " = ")

FileWriteLine($CreateFile, $WriteLineString & @CRLF)

Next

FileWriteLine($CreateFile, @CRLF)

$WriteLineString = StringFormat("%s", "[FilePath]")

FileWriteLine($CreateFile, $WriteLineString & @CRLF)

$WriteLineString = StringFormat("%s", "Source = ")

FileWriteLine($CreateFile, $WriteLineString & @CRLF)

$WriteLineString = StringFormat("%s", "Destination = ")

FileWriteLine($CreateFile, $WriteLineString & @CRLF & @CRLF)

$WriteLineString = StringFormat("%s", "[DrNameUsed]")

FileWriteLine($CreateFile, $WriteLineString & @CRLF)

$WriteLineString = StringFormat("%s", "Used = 0")

FileWriteLine($CreateFile, $WriteLineString)

EndIf

EndFunc ;==>UF_ControlFileExist

;---------------------------------------------------------------------------------------------------------------

Func UF_ReadUserNames()

$NumberOfNames = 0

Local $i

Local $AZ = 1

Local $PNames, $LinesInSection, $IniKey

$PNames = IniReadSection ("ControlFile.ini", "DoctorsName")

$LinesInSection = 0

If @error Then

MsgBox(4096, "", "Error occured, probably no INI file.")

Exit (0)

Else

For $i = 1 To $PNames[0][0]

$UserName[$AZ] = $PNames[$i][1]

If StringLen($UserName[$AZ]) > 1 Then

$NumberOfNames = $NumberOfNames + 1

$AZ = $AZ + 1

Else

EndIf

$LinesInSection = $LinesInSection + 1

Next

EndIf

;This next Section writes the reordered array back to the Control File.

For $i = 1 To $LinesInSection

$IniKey = StringFormat("%s%s", "DrName", $i)

If StringLen($UserName[$i]) > 1 Then

IniWrite("ControlFile.ini", "DoctorsName", $IniKey, $UserName[$i])

Else

IniWrite("ControlFile.ini", "DoctorsName", $IniKey, " ")

EndIf

Next

EndFunc ;==>UF_ReadUserNames

;---------------------------------------------------------------------------------------------------------------

; Creates the User Interface

Func UF_UserGUI()

Local $ExitGUI = 0

Local $UserChoice = 0

Local $i

GUICreate("DictaCopy Version 1.5c", 400, 230)

; TAB

GUICtrlCreateTab(10, 10, 374, 200)

GUICtrlCreateTabItem($TabName1)

GUICtrlCreateLabel("INSTRUCTIONS:", 20, 40)

GUICtrlCreateLabel("Type the new name into the field below and CLICK the ADD button", 20, 55)

GUICtrlCreateLabel("Name to add:", 20, 77)

; INPUT BOXES

$AName = GUICtrlCreateInput(" ", 90, 74, 150, 20)

GUICtrlRead($AName)

GUICtrlCreateButton("Add Name", 300, 74, 70)

GUICtrlCreateButton("Exit", 300, 176, 70)

GUICtrlCreateCombo("", 20, 150, 100) ; create first item

For $i = 1 To $NumberOfNames

GUICtrlSetData(-1, $UserName[$i])

Next

GUICtrlCreateTabItem($TabName2)

GUICtrlCreateTabItem($TabName3)

GUICtrlCreateTabItem("")

GUICtrlCreateLabel("Created by Phillip Holmes and Paul Julian - www.redrocksolutions.net", 10, 215)

GUISetState(@SW_SHOW)

While $ExitGUI <> 1

$UserChoice = GUIGetMsg()

Select

Case $UserChoice = $GUI_EVENT_CLOSE

$ExitGUI = 1

Case $UserChoice = 9

MsgBox(0," ",$UserChoice &" "&$AName)

UF_ButtonDistribution($UserChoice, $AName)

Case $UserChoice = 5555

UF_ButtonDistribution($UserChoice)

Case $UserChoice = 6666

UF_ButtonDistribution($UserChoice)

Case $UserChoice = 10

$ExitGUI = 1

EndSelect

WEnd

EndFunc ;==>UF_UserGUI

;---------------------------------------------------------------------------------------------------------------

Func UF_ButtonDistribution(ByRef $Button, ByRef $AN)

Local $Button

Local $AN

Local $LineNumber, $IniKey

Select

Case $Button = 4

MsgBox(0, "What Button", "You pressed button" & $Button)

Case $Button = 5

MsgBox(0, "What Button", "You pressed button" & $Button)

Case $Button = 6

MsgBox(0, "What Button", "You pressed button" & $Button)

Case $Button = 9 ; Add new name

$LineNumber = $NumberOfNames+1

$IniKey = StringFormat("%s%s", "DrName", $LineNumber)

IniWrite("ControlFile.ini", "DoctorsName", $IniKey, $AN)

MsgBox(0,"Name Add", "The name -> "&$AN &" has been added")

EndSelect

EndFunc ;==>UF_ButtonDistribution

Link to comment
Share on other sites

In GUICtrlRead

Return Value

Input, Edit The text entered

There's also example scripts in the manual for both GUICtrlCreateInput and GUICtrlRead, thats why he posted RTFM.

$text = GUICtrlRead(ControlID)

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...