Jump to content

Recommended Posts

Posted

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?

  • Developers
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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

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

Posted

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

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.

Posted

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

Posted

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...