Jump to content


Photo

Linefeed turning into little squares


  • Please log in to reply
19 replies to this topic

#1 bonniehandi

bonniehandi
  • Members
  • 25 posts

Posted 10 February 2011 - 11:04 PM

Hello all,

I have a variable like this
MyVar := "Hello world 'n This is my text"

I have Notepad open, and I want to send the text the the notepad like this
ControlSetText, Edit1, %MyVar%, Untitled -

It sends all my text, but instead of getting a new line where 'n is, I get this little square. What is wrong?

Thanks.

#2 flyingDman

flyingDman
  • Members
  • 1072 posts

Posted 10 February 2011 - 11:24 PM

What about this:
MyVar := "Hello world `r`nThis is my text"

Note the escape character: it is ` and not '

#3 bonniehandi

bonniehandi
  • Members
  • 25 posts

Posted 10 February 2011 - 11:42 PM

Yea.. it is `n.

Sorry, it was a typo on the post, not in the program.

#4 Leef_me

Leef_me
  • Moderators
  • 7704 posts

Posted 11 February 2011 - 05:09 AM

Two notes about posting:
1. don't break up your script into pieces unless absolutely needed.
2. No matter how good a typist you are, post your script, not something 'retyped'.

There was a case where the copied script help extra characters embedded.
If the script was re-typed, the characters would not have beed found as easily.

In the case of your script, putting data in the control requires a specific character sequence. `r`n , nothing else works.
f1::

MyVar := "Hello world `r`n This is my text"

ControlSetText, Edit1, %MyVar%, Untitled -


#5 flyingDman

flyingDman
  • Members
  • 1072 posts

Posted 11 February 2011 - 06:55 AM

If I may add: if a solution is proposed, please have the courtesy of trying that solution. In this case you responded but did you try what I suggested?...

#6 bonniehandi

bonniehandi
  • Members
  • 25 posts

Posted 11 February 2011 - 04:59 PM

I do very much appreciate the help that everyone offers here at the AutoHotkey community, but I do not enjoy getting random lectures when you don't understand why I decide to do things a certain way.

The reason I have to retype the code is because I use autohotkey for some propitiatory information.

And yes, `r`n worked.

#7 Leef_me

Leef_me
  • Moderators
  • 7704 posts

Posted 11 February 2011 - 10:28 PM

>>>...but I do not enjoy getting random lectures when you don't understand why I decide to do things a certain way.
The reason I have to retype the code is because I use autohotkey for some propitiatory information.

bonniehandi,
I am sorry that you were offended by my suggestions. :cry:
My intent was to inform not offend. But my points are still true.

#8 SneekMatrix

SneekMatrix
  • Members
  • 11 posts

Posted 04 May 2011 - 01:10 PM

i have the same problem;

I did try the above mentioned ; works fine on Notepad;

But when i try this;
MyVAR:="999.99`r`n"
and send it to a control edit i get 2 squares

please help

#9 SoLong&Thx4AllTheFish

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts

Posted 04 May 2011 - 01:21 PM

Remove the `r

#10 SneekMatrix

SneekMatrix
  • Members
  • 11 posts

Posted 04 May 2011 - 02:08 PM

hi hugov i did try it then i get one square;
its still not acting like an enter in that edit field;
i want it so it automatically enters - but the software im using wont allow;#
i have to use send,{Enter}
an i was hoping avoid thats

#11 SoLong&Thx4AllTheFish

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts

Posted 04 May 2011 - 02:09 PM

Then remove the `n :wink:

#12 SneekMatrix

SneekMatrix
  • Members
  • 11 posts

Posted 04 May 2011 - 02:13 PM

no then it jus hangs on 999.99
it wont send a carriage return unless i press enter or use Send, {enter}

is it possible some controls dont update?

#13 SoLong&Thx4AllTheFish

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts

Posted 04 May 2011 - 02:18 PM

How do you send it? Send % MyVar or do you use controlsettext controlsend etc. What application is it?

#14 SneekMatrix

SneekMatrix
  • Members
  • 11 posts

Posted 04 May 2011 - 02:19 PM

i use this;

ControlSetText, %Total%,%MyCsh%, Buy In

Its poker to rebuy chips when im low;

Is ControlSend better

#15 sinkfaze

sinkfaze
  • Moderators
  • 6089 posts

Posted 04 May 2011 - 02:23 PM

...but I do not enjoy getting random lectures when you don't understand why I decide to do things a certain way.


Then quit doing things in a seemingly random way that makes it difficult to support you.

How do you send it? Send % MyVar or do you use controlsettext controlsend etc.


I'm guessing it's ControlSetText, which does not give the control focus and thus bypasses event detection.