Jump to content

I need to Send a 20 line text via AutoIt, but I don't know how


Recommended Posts

Hello, it's my first time using AutoIt.

I know how to send 1 line text, by doing this:

$text = "trololol"

Send ($text, 1)

But I've got absolutely no idea, how to send a 20 line text.

I was thinking in loading it from a external .txt file, or write the 20 line text direcly into the code, I wouldn't mind that, but I've looked at the AutoIt docs, and it just explains how to send a 1 line text (I've might missed something, I don't know).

Link to comment
Share on other sites

Welcome to AutoIt and the forum!

Where do you want to send the text to? Means: Which program is the target of the send command?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hello Fluence,

Welcome to the AutoIt Forums :oops:

First of all, your explanation is a bit vague and general. With what you have provided, there are many directions to go.

First, Is the 'lines of text' possibly going to change during or between application operations? If so, I'd suggest reading it from a file with one of these methods:

FileRead()

FileReadLine()

_FileReadtoArray()

Second, what are you sending to? Another File? A control? Another Application via Control? Another Application via Commandline? or?

Another File:

FileWrite()

FileWriteLine()

A control in your application/script:

GuiCtrlSetData()

Another Application via a Control:

ControlSetText()

ControlSend()

Another Application via Commandline:

Run()

From your vague description it appears your sending text to another application via a control. Using Send() in this instance is not recommended since it can be interrupted by user input. ControlSetText() would be a better option

Realm

PS. When asking for help, there are few things you should always include. First, a brief description of what your trying to accomplish. Secondly, what elements are being used like files, other applications and so on. Third, and example of the code you are having problems with. This will receive more accurate advice since they will have a better grasp of your project.

Edit: Typos

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

Try this:

$text = "trololol" & @CRLF & "Line 2"
Send ($text, 1)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Does it have to be Mozilla?

AutoIt3 has a wonderful UDF called IE.au3 for automating Internet Explorer and most Web elements.

There is a UDF for FireFox somewhere in the examples as well, however, last I checked it was not being maintained and updated often.

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

Hmmm, I've got to read about that "UDF" thing, I'm having problems now, because my mouseclicks, depend on the position of the firefox window, and of course that's lame.

I need to find a solution for this, I would prefer to use Firefox over IE, but if I've got to use IE to make the things work, well, I'll just use it.

Link to comment
Share on other sites

I think it should be possible with FF too but here you will get far more support for IE than for FF.

Download the UDF, install mozrepl and give it a try.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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