Sign in to follow this  
Followers 0
kpu

Sending text in uppercase to input box

9 posts in this topic

I'm having issues sending text to an input box in uppercase. Even if the text is in uppercase, it changes it to lower case... I'm sure I'm just missing something small.. but any help would greatly be appreciated.

Here's my code. You need a Text File called "temp.txt" with Four lines in it:

; Script generated by FormDesigner Preview 1 (very alpha state, use at your own risk)
#include <GuiConstants.au3>
Dim $temp, $file, $replace, $line
;-----------------------------------------------------------------------------------------------
AutoItSetOption("TrayIconHide", 1)
;-----------------------------------------------------------------------------------------------
$script_title = "Gui app"
GuiCreate($script_title, 266, 120, 430,346)
GUISetFont(12, 400, "", "Arial")
$txt_pcname = GuiCtrlCreateInput("Text here", 8, 32, 249, 29)
GUICtrlSetLimit(-1, 14)
$btn_findit = GuiCtrlCreateButton("Find It", 56, 64, 97, 25)
;-----------------------------------------------------------------------------------------------
GuiSetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $btn_findit
            GUICtrlSetState($btn_findit, $GUI_DISABLE)
            $ws = GUICtrlRead($txt_pcname)
            $temp = "temp.txt"
            $file = FileOpen($temp, 0)
            If $file = -1 Then
                MsgBox(0, "Error", "Unable to open " & $temp)
                Exit
            EndIf
            $line = FileReadLine($file, 1)
            SplashOff()
            If $line = "Nothing Found" Then
                MsgBox(16, "Warning!", $line)
            Else
                $line = FileReadLine($file, 4)
                $line = StringUpper($line)
                ClipPut($line)
                MsgBox(32,"",$line)
                MsgBox(32,"","found the following information:" & @CRLF & $line)
                GUICtrlSetState($btn_findit, $GUI_ENABLE)
            ;-->moved upClipPut($line)
                FileClose($file)
                WinSetState($script_title, "", @SW_SHOW)
                ControlSend($script_title, "", "Edit1", ClipGet())
            EndIf
    ;---------------------------------------------------------------------------------------
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
        ;;;
    EndSelect
WEnd
Exit
;-----------------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

i cant test it ... but maybe this will work??

MsgBox(32,"","found the following information:" & @CRLF & (StringUpper($line)))

and

ControlSend($script_title, "", "Edit1", (StringUpper(ClipGet())))

good luck

8)

i also noticed what gafrost said

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Why use controlsend instead of GuiCtrlSetdata?

I am using controlsend. One line up from the "EndIF"

ControlSend($script_title, "", "Edit1", ClipGet())

Valuater,

I'm trying your solution now.

Thanks to both of you for the quick response! B)

Share this post


Link to post
Share on other sites

this worked

;Script generated by FormDesigner Preview 1 (very alpha state, use at your own risk)
#include <GuiConstants.au3>
Dim $temp, $replace, $line
;-----------------------------------------------------------------------------------------------
AutoItSetOption("TrayIconHide", 1)
;-----------------------------------------------------------------------------------------------
$script_title = "Gui app"
GuiCreate($script_title, 266, 120, 430,346)
GUISetFont(12, 400, "", "Arial")
$txt_pcname = GuiCtrlCreateInput("Text here", 8, 32, 249, 29)
GUICtrlSetLimit(-1, 14)
$btn_findit = GuiCtrlCreateButton("Find It", 56, 64, 97, 25)
;-----------------------------------------------------------------------------------------------
GuiSetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $btn_findit
            GUICtrlSetState($btn_findit, $GUI_DISABLE)
            $ws = GUICtrlRead($txt_pcname)
            $temp = @ScriptDir & "\test.txt"; i changed this
            $file = FileOpen($temp, 0)
            If $file = -1 Then
                MsgBox(0, "Error", "Unable to open " & $temp)
                Exit
            EndIf
            $line = FileReadLine($file, 1)
            
            If $line = "Nothing Found" Then
                MsgBox(16, "Warning!", $line)
            Else
                $line = FileReadLine($file, 4)
                $line = StringUpper($line)
                ClipPut($line)
                MsgBox(32,"",$line)
                MsgBox(32,"","found the following information:" & @CRLF & (StringUpper($line)))
                GUICtrlSetState($btn_findit, $GUI_ENABLE)
           ;-->moved upClipPut($line)
                FileClose($file)
                WinSetState($script_title, "", @SW_SHOW)
                GUICtrlSetData( $txt_pcname, (StringUpper(ClipGet())))
               ;ControlSend($script_title, "", "Edit1", (StringUpper(ClipGet())))
            EndIf
   ;---------------------------------------------------------------------------------------
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
       ;;;
    EndSelect
WEnd
Exit
;-----------------------------------------------------------------------------------------------

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

I am using controlsend. One line up from the "EndIF"

Edit:

Opps.. I read it wrong. Sorry Gafost! :">

ControlSend($script_title, "", "Edit1", ClipGet())

Valuater,

I'm trying your solution now.

Thanks to both of you for the quick response! B)

Share this post


Link to post
Share on other sites

Cool...

8)


NEWHeader1.png

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