AutoHotkey Community

It is currently May 27th, 2012, 12:07 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: March 8th, 2011, 5:03 pm 
Offline

Joined: August 28th, 2009, 11:17 am
Posts: 599
Location: Brighton, UK
According to the manual:

Raw mode wrote:
The SendRaw command sends the keystrokes exactly as they appear rather than translating {Enter} to an ENTER keystroke, ^c to Control-C, etc. To use raw mode with SendInput, SendPlay, or SendEvent, write {Raw} as the first item in the string; for example: SendInput {Raw}abc


For instance this won't send the backticks:
Code:
`::SendInput {raw}FileAppend, %A_LoopReadLine%`, %Subref%`n
and this one won't even run:
Code:
F12::SendRaw, `
I get the error
Code:
---------------------------
Test Script.ahk
---------------------------
Error at line 5.

Line Text: SendRaw,
Error: "SendRaw" requires at least 1 parameter.

The program will exit.
---------------------------
OK   
---------------------------


If the Raw mode send keystrokes exactly as they appear then it shouldn't treat the backtick as an escape character.

Even this fails:
Code:
`::SendInput {raw}FileAppend, %A_LoopReadLine%``, %Subref%``n
Using that ^ code, it actually sends this:
Code:
FileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , nFileAppend, , n

However, this does work:
Code:
F12::SendRaw, ``


Tested on AHK basic and AHK_L under XP sp3 x86

David

_________________
With mixed feelings I am stepping down from all moderation responsibilities: http://www.autohotkey.com/forum/viewtopic.php?t=82906


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2011, 5:49 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
IIRC escape chars are processed before the script at load time, so how the escape chars work doesn't change no matter what command they're used in. So this:

Code:
F12::SendRaw, `


should throw an error.

As far as your other example, I had no issues making this hotkey work:

Code:
`::SendInput {raw}FileAppend, %A_LoopReadLine%``, %Subref%``n


Output:

Code:
FileAppend, `, `nFileAppend, `, `nFileAppend, `, `nFileAppend, `, `nFileAppend, `, `nFileAppend, `, `nFileAppend, `, `nFileAppend, `, `nFileAppend, `, `nFileAppend, `, `nFileAppend, `, `nFileAppend, `, `n


Using 1.0.92.02 on WIN7.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 8th, 2011, 10:49 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Quote:
The SendRaw command sends the keystrokes exactly as they appear
That's as they appear to the command, not as they appear in the editor. The point is that SendRaw doesn't do any parsing, such as for ^!+{Keys}. You expect it to resolve variable references, so why should ` be treated literally? (Like sinkfaze said, escape sequences are resolved at too early a stage for SendRaw to see them.)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2011, 11:01 pm 
Offline

Joined: August 28th, 2009, 11:17 am
Posts: 599
Location: Brighton, UK
I wasn't aware that escape sequences where parsed when the script loads. To me, if the documentation says that it should send asis, that is what I would expect.

I will put this on my list of document changes to update the official docs to show that Raw won't send ` on it's own.

David

_________________
With mixed feelings I am stepping down from all moderation responsibilities: http://www.autohotkey.com/forum/viewtopic.php?t=82906


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2011, 11:21 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
It won't send % either, unless you escape it. Are you going to mention that? Seriously, it sends exactly the string it is given. If the current documentation is misleading, it should be clarified; but not by merely pointing out that ` still acts as the escape char, since that really has nothing to do with SendRaw. ` and % aren't even necessarily the only cases. For instance,
Code:
SendRaw,
(Ltrim
   Multiple
   lines
   of
   text
)
Would you expect (LTrim ) or the indentation to be sent? They do "appear" after all.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 12th, 2011, 9:52 am 
Docs say "The SendRaw command sends the keystrokes exactly as they appear"

As they appear where? (Maybe the docs should say where)
On the screen in the text editor? (NO)
On some imaginary text editor in the sky that knows ' and % won't be sent.
What other single characters will SendRaw not send?

thanks


Report this post
Top
  
Reply with quote  
 Post subject: SendRaw error
PostPosted: August 31st, 2011, 4:32 am 
Code:
::.badluck::
SendRaw %*-{
:( :roll:


Report this post
Top
  
Reply with quote  
 Post subject: Re: SendRaw error
PostPosted: September 8th, 2011, 12:28 am 
Offline

Joined: August 14th, 2011, 8:31 pm
Posts: 69
Location: Nova Scotia, Canada
AHK_Scripter1025 wrote:
Code:
::.badluck::
SendRaw %*-{
:( :roll:


your forgot }

_________________
ImageImage


Twitter: http://twitter.com/NictraSavios
Tumblr: http://nictrasavios.tumblr.com


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group