Jump to content

Sending text in uppercase to input box


kpu
 Share

Recommended Posts

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
;-----------------------------------------------------------------------------------------------
Link to comment
Share on other sites

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

Link to comment
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

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...