Jump to content

Recommended Posts

Posted

Hi, i'm new in Autoit

I try to copy text from txt file (3 lines, each line to a different field), to another program (Cardfive version 7.2 Classic). I don't know how do it. :( Here's my code:

 

Run('C:\Program Files\CardFive\Cardfive.exe')
Sleep(9000)
Send("^o")
WinWait('Open', 'Card Preview')
WinActivate('Open', 'Card Preview')
MouseClick('left', 127, 222, 1, 0)
Send('dziabasj.car')
Send("{Enter}")
Sleep(9000)
MouseClick('right', 260, 532, 1, 0)
MouseClick('left', 352, 788, 1, 0)
WinWait('Properties', 'Get...')
WinActivate('Properties', 'Get...')
ControlClick("Properties", "&Get...", "Button5")
Send('C:\Documents and Settings\Jacek\Desktop\foto.JPG')
Send("{Enter}")
ControlClick('Properties', '&Zastosuj', 'Button33')
Sleep(1000)
ControlClick('Properties', 'OK', 'Button31')
MouseClick('right', 510, 259, 1, 0)
MouseClick('left', 599, 508, 1, 0)
WinWait('Properties', '')
WinActivate('Properties')

And then I have this window  [Look to attachment (on the balck place i must paste the text)] 

 

Someone can help me? :)

foto.JPG

Posted

You can use the Au3Info tool to get the control's properties. They should look something like "[CLASS:Edit;INSTANCE:1]". Then you can set the control's value

ControlSetText($hWnd, "", "[Control Properties here]", $sYourText)

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Posted
44 minutes ago, Elvis439_PL said:

How to download it?

No need to download it, just read the textfile.

Example (modified from help) :

#include <MsgBoxConstants.au3>
#include <File.au3>

Example()

Func Example()
    ; Run Notepad
    Run("notepad.exe")

    ; Wait 10 seconds for the Notepad window to appear.
    Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)


    ; Open the file for reading and store the handle to a variable.
    Local $sFilename = @ScriptDir & "\test.txt" ; <=== USE YOUR TEXTFILE HERE
    Local $hFileOpen = FileOpen($sFilename)
    If $hFileOpen = -1 Then
        MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.")
        Return False
    EndIf
    ; Read lines of the file.
    Local $sYourText = ""
    For $i = 1 to _FileCountLines($sFilename)
        $sYourText &= FileReadLine($hFileOpen, $i) & @CRLF
    Next
    ; Close the handle returned by FileOpen.
    FileClose($hFileOpen)


    ; Set the edit control in Notepad with some text. The handle returned by WinWait is used for the "title" parameter of ControlSetText.
    ControlSetText($hWnd, "", "Edit1", $sYourText)

    ; Retrieve the text of the edit control in Notepad. The handle returned by WinWait is used for the "title" parameter of ControlGetText.
    Local $sText = ControlGetText($hWnd, "", "Edit1")

    ; Display the text of the edit control.
    MsgBox($MB_SYSTEMMODAL, "", "The text in Edit1 is: " & $sText)

    ; Close the Notepad window using the handle returned by WinWait.
    WinClose($hWnd)
EndFunc   ;==>Example

 

test.txt

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Posted

Thanks! i do it right this:

On the start of code i have this

$File = FileOpen('C:\Documents and Settings\Jacek\Pulpit\dane.txt')
$FileRead1 = FileReadLine($File, 1)

$File = FileOpen('C:\Documents and Settings\Jacek\Pulpit\dane.txt')
$FileRead1 = FileReadLine($File, 1)

 

in the center of code i have this:

Send($FileRead1)

 

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...