Jump to content

Filereadline And Clipput With Edit Box


 Share

Recommended Posts

I made a simple GUI edit box with the code shown. I open it and put ...

1

2

3

in it.(just one example). I want a seperate script to read the 1 and put it on clipboard then the 2, then 3 and so on, there will be may entries. I understand the clipputs and clipgets but i'm struggling to get this to work. There's much more I'll be doing between the text copys but I need to get past this hurdle first. Any help would be appreciated...Dennis

region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("MyGUI", 253, 323,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Edit_1 = GuiCtrlCreateEdit("", 40, 40, 160, 280)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End --
Link to comment
Share on other sites

i am hurry now but it's all in tmp.tmp .... read line by line and put it

in clipboard

PS:

take a look at C:\PROGRA~1\AUTOIT3\INCLUDE for array.au3

maybe is simpler to do

air code :

#include<array.au3>
#include<ArrayToDisplayString.au3>
#include <GuiConstants.au3>

GuiCreate("MyGUI", 253, 323,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$b = GUICtrlCreateButton("",10,10,40.40)
$Edit_1 = GuiCtrlCreateEdit("", 40, 40, 160, 280)


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    case $msg = $b
        $read = GUICtrlRead ($Edit_1,1)
        MsgBox(262144, "", $read[0])
     _FWrite(@TempDir & "\tmp.tmp",$read[0])
    Case Else
;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End 

Func _FWrite($temp1,$text)
$file = FileOpen($temp1, 2)
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
FileWrite($file, $text & @CRLF)
FileClose($file)
EndFunc

readline :

$file = FileOpen("tmp.tmp", 0)


; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    MsgBox(0, "Line read:", $line)
    ClipPut($line)
Wend

FileClose($file)
Edited by Lapo
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...