Sign in to follow this  
Followers 0
Dewey6

How to paste a multiple-line window-text?

7 posts in this topic

Hi everyone,

Big beginner here. Very big. PArdon the simplicity of my question.

How do you paste a window-text (as in WinWaitActive("Notepad", "window text")

if the window text is printed on several lines?

For instance, if I get a window text saying:

"Do you want to save your file

Or go bake french fries instead"

Autoit v3 Window info tool will report the following text:

"Do you want to save your file (strange sign resembling a mignaturized Dolby logo)Or go bake french fries instead"

The copy-pasteing of the latter gives the following result:

WinWaitActive("Notepad", "Do you want to save your file

Or go bake french fries instead"

wich is not usable in the script, of course.

So what shall I do with my strange sign? I guess it's simply a sign that gives the order to change line, but how do I paste it?

I try to just ommit the sign, but it gives nothing better.

Thanks for your answers.

Dewey

Share this post


Link to post
Share on other sites



Would this work?

WinWaitActive("Notepad")
Send("Do you want to save your file {ENTER} Or go back french fries instead.")

Share this post


Link to post
Share on other sites

Dewey6,

Welcome to the AutoIt forum. ;)

Your "minaturized Dolby logo" is a carriage return and line feed - which in AutoIt is replaced by the @CRLF macro. In order to combine the 2 lines of text you need to use the concatenation operator & like this:

$sText = "Do you want to save your file" & @CRLF & "Or go bake french fries instead"
WinWaitActive("Notepad", $sText")

All clear? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

att Jlarson: thx, but it doesn't seem to do the trick ;)

att Melba23: What you explianed is very clear.

But it's not working. I know theat the window text must be very carefully pasted, but it doesnot work.

ANyway, I think I will read more of the "learning to script with autoIt" pdf.

There are too many questions that remain unanswered for me to begin and ask here each time something is unexplained.

Want an example? What is a scope? I know the word, I think I know what it means even thought I'm french, but Dim/Global/and Local still means nothing to me.

I guess it will come.

I might look for a French written tutorial too :))

Thanks for your answer, anyway, and for the welcome.

Share this post


Link to post
Share on other sites

I think the function WinGetText will help you. If you want to read the text from a window

$wText = WinGetText("Notepad")
The variable $wText will then contain all of the text that AutoIT can read from the window

If you are trying to identify a window with WinWait or WinExists, you do not have to pass all of the text (with line breaks) to the function...you only need to pass enough text to differentiate the window. Par example, if there is only one Notepad window open, you do not have to specify any text at all to identify it

WinWait("Notepad", "")
;or
Winatwait("[CLASS:Notepad]", "")
If there are multiple Notepad windows open, you just need to pass enough text to specify the on that you want
WinWait("Notepad", "unique text for the window")
Hope this helps

Share this post


Link to post
Share on other sites

Dewey6

What is a scope? I know the word, I think I know what it means even thought I'm french, but Dim/Global/and Local still means nothing to me.

Look at the Variables - using Global, Local and ByRef tutorial in the Wiki and everything should become much clearer. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Dewey6

Look at the Variables - using Global, Local and ByRef tutorial in the Wiki and everything should become much clearer. ;)

M23

Thanks for both your answers.

Varian's answer is interesting because it made me discover how many way there was to identify a window.

And btw: you are right: I should stick to identifying the window by a portion of the beginning of it's name, like mode 1 allows.

In time, I will find a use for the more elaborate or complete identification.

Melba23's answer made me realize that I had tooooooo many documentation to read.

Furthermore, I found a french translation of the help file ;))

Now that's study time. :)

Huey

Share this post


Link to post
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
Sign in to follow this  
Followers 0