Sign in to follow this  
Followers 0
Newbie2

+ And {+} Issue

10 posts in this topic

Hi Guys,

I'm a little confused here...

Run ("Notepad")
Sleep (2000)
$word=('AB+CD')
msgbox (0,"",$word); This is OK!
send ($word); why? I wanted AB+CD!

I want that $word will be exactly the same as the chars sent to notepad. Is it possible?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

A + means Shift in a send string so if you want to send the + you need to specify it as {+} so in your case:

Run ("Notepad")
Sleep (2000)
$word=('AB{+}CD')
send ($word)

Edit: or send the text RAW like this:

Run ("Notepad")
Sleep (2000)
$word=('AB+CD')
msgbox (0,"",$word
send ($word,1)
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

10x, JdeB.

I knew that. I'll explain a little more.

I want to send some text into a text file (using notepad), save the file and then, using 'FileReadLine', to read each line and compare each line to what was sent.

I have coded all this already and it works OK with all chars. The problem is with the '+' sign.

e.g.

Run ("Notepad")
Sleep (2000)
$word=string ("AB@CD")
msgbox (0,"",$word); all fine! the msgbox displays AB@CD
send ($word); all fine too AB@CD is sent to the window

But if I use {}

Sleep (2000)
$word=string ("AB{+}CD")
msgbox (0,"",$word); all fine! the msgbox displays AB+CD
send ($word); NOT OK! ABCD is sent to the window. The comparation will fail!

Is there another way? :D

Share this post


Link to post
Share on other sites

Then as JdeB pointed, out, send the raw characters.

Share this post


Link to post
Share on other sites

:iamstupid: Felling kind of ashamed. What are RAW characters?

Share this post


Link to post
Share on other sites

Read the Send section of the help file and have a look at the optional second parameter of the Send command.

Share this post


Link to post
Share on other sites

10x, Valik. That did it. :D

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Run ("Notepad")
Sleep (2000)
$word=('AB+CD')
msgbox (0,"",$word); This is OK!
send ($word,1); flag = 1, keys are sent raw.

Send

--------------------------------------------------------------------------------

Sends simulated keystrokes to the active window.

Send ( "keys" [, flag])

Parameters

keys The sequence of keys to send.

flag [optional] Changes how "keys" is processed:

  flag = 0 (default), Text contains special characters like + and ! to indicate SHIFT and ALT key presses.

  flag = 1, keys are sent raw.

edit, dang I got to this a bit late it looks like. Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

edit, dang I got to this a bit late it looks like.

Maybe, but you saved lazy people like me from having to go and look up what Valik was talking about :D

GrahamS

Share this post


Link to post
Share on other sites

Maybe, but you saved lazy people like me from having to go and look up what Valik was talking about  :D

Which kind of sucks since I hate when people are too lazy to look something up when it's right in front of their face.

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