Sign in to follow this  
Followers 0
SATHEESH

TEXT BOX IN AUTOIT

4 posts in this topic

Can any one help me:

I want a msg box open in autoit and giving input as text in msg box ,which should take it in notepad. (ie. the same text I entered like raw_input should be printed in notepad)

If not possible is there any other method. Give me some examples

Share this post


Link to post
Share on other sites



Satheesh,

See InputBox and ControlSend in the Help file.  You will find examples there.

Welcome to the forum!

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

That would only scratch the surface of what the person is wanting. This is a very good simple to understand (I hope) example :

; =====================================================
; Title .........: Test Input Window
; Script Version : 1.0.0
; Date Created ..: July 31st, 2015
; AutoIt Version : 3.5.4
; Description ...: Input your info into the input box and press submit it will open the INI file so you can view the changes i reccommend using notepad++ so you dont get a million notepads opened up if you forget to close them
; Author(s) .....: xxaviarxx
; Infomation ....: I tried to label each and every thing in this script so you would know what everything does (That I knew about at least).
; Disclaimer ....: I do not condone any use of any script that violates any person(s) application's ToS/EULA. That being said I hope you enjoy the script either as reference material or as something you could use to complete your own.
; Credits .......: Autoit websites help files and programs
; =====================================================

; =====================================================
; Start Includes
; =====================================================

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

; =====================================================
; End Includes
; =====================================================

; =====================================================
; Start Global Variables
; =====================================================

Global $iniOutput = IniRead(@ScriptDir & "\testinfo.ini", "Test Your Info", "Your Info Input", "") ; reads the iniOutput from the ini file and sets it as the variable
Global $iniInput = $iniOutput ; sets the iniInput input area of the dialog editor to be the same as the iniOutput

; =====================================================
; End Global Variables
; =====================================================

; =====================================================
; Start Script
; =====================================================

; =====================================================
; Start Test Window
; =====================================================

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Test Input Window", 240, 132, 192, 114) ; sets the window title
$Label1 = GUICtrlCreateLabel("Your Info", 8, 16, 86, 24) ; sets the Label for the input box
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") ; sets the font size and type for the label
$iniInput = GUICtrlCreateInput($iniOutput, 112, 16, 121, 21) ; sets the input area
$Submit = GUICtrlCreateButton("Submit", 88, 88, 75, 25) ; sets the button to click
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") ; sets the buttons font
Dim $Form1_AccelTable[1][2] = [["{ENTER}", $Submit]] ; sets enter as a hotkey to press the button
GUISetAccelerators($Form1_AccelTable) ; sets the hotkey to work (guess)
GUISetState(@SW_SHOW) ; sets the window to show itself
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit ; exits the window when the X button is pressed
        Case $Submit
            WriteToIniFile() ; runs this function to test if input was 100% successful
            ; submit button will not exit the script so you can see the changes
            ; in the file without reruning it all the time
            ShellExecute(@ScriptDir & "\testinfo.ini") ; opens the ini file when submit is clicked
    EndSwitch
WEnd

; =====================================================
; End Test Window
; =====================================================

; =====================================================
; Start Write To Ini File
; =====================================================

Func WriteToIniFile()
    IniWrite(@ScriptDir & "\testinfo.ini", "Test Your Info", "Your Info Input", GUICtrlRead($iniInput)) ; writes the iniInput you enter to the INI file
EndFunc   ;==>WriteToIniFile

; =====================================================
; End Write To Ini File
; =====================================================

; =====================================================
; End Script
; =====================================================

Hope this provides you with the type of example you are wanting.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@xxaviarxx - Nice example and kudos for trying to help.  Now consider the following:

1 - The op is new and nothing in the post hints at a level of expertise so rudimentary is where we start.

2 - The general bent of this forum is to teach.  That involves digging on the part of the thread author.

3 - We have no previous experience with this person so we do not know if he is looking for handouts or a serious programmer/hobbyist.

Lastly, the example in the Help file is exactly what this op is asking for.

kylomas

edit:  This is offered as advice, no need to start a pissing contest.

Edited by kylomas
1 person likes this

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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