Elvis439_PL Posted November 20, 2019 Posted November 20, 2019 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? :)
seadoggie01 Posted November 20, 2019 Posted November 20, 2019 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 functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
Elvis439_PL Posted November 21, 2019 Author Posted November 21, 2019 Thx, but $sYoutText will be a variable that must be taken from the txt file. How to download it?
Musashi Posted November 21, 2019 Posted November 21, 2019 44 minutes ago, Elvis439_PL said: How to download it? No need to download it, just read the textfile. Example (modified from help) : expandcollapse popup#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 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
Elvis439_PL Posted November 21, 2019 Author Posted November 21, 2019 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)
Zedna Posted November 21, 2019 Posted November 21, 2019 (edited) Use Au3Info (Control tab) to get ClassnameNN of your control for ControlSetText() "C:\Program Files\AutoIt3\Au3Info.exe" Edited November 21, 2019 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now