Jump to content

Cut and Paste Automation


Recommended Posts

Hello All.

I have a question about cut and paste. I need to retrieve a bit of information from a flat file.

The data will change each time I loop to the next file, and I know the exact position that the data will be in each time.

I would like to open the file with notepad, arrow over 44 spaces and copy the next 9, and then paste the data into an input field.

Does anyone know any methods that will work here?

Thanks in advance.

Link to comment
Share on other sites

Hello All.

I have a question about cut and paste. I need to retrieve a bit of information from a flat file.

The data will change each time I loop to the next file, and I know the exact position that the data will be in each time.

I would like to open the file with notepad, arrow over 44 spaces and copy the next 9, and then paste the data into an input field.

Does anyone know any methods that will work here?

Thanks in advance.

<{POST_SNAPBACK}>

get SciTE and under tools there is a AU3recorder. Try that, it might to the job for ya.
Link to comment
Share on other sites

  • Moderators

Look at StringMid() in the help file...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

This will do the trick

#include <GUIConstants.au3>

GUICreate(" My GUI input ", 320,120)

$input = GUICtrlCreateInput ("", 10,  35, 300, 20)  
$btn1 = GUICtrlCreateButton ("G&et info", 80,  75, 60, 25)
$btn2 = GUICtrlCreateButton ("S&end info", 160,  75, 60, 25)

GUISetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
            Case $msg = $btn1
                $file = FileOpen("test.txt", 0)
                $line = FileReadLine($file)
                $line2 = StringTrimLeft($line, 44)
                $line3 = StringLeft($line2, 9)
                GUICtrlSetData($input, $line3)
                FileClose($file)
            Case $msg = $btn2
                MsgBox (4096, "Sending", GUICtrlRead($input))
       EndSelect
Wend

hope it helps

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