AutoHotkey Community

It is currently May 27th, 2012, 8:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: January 3rd, 2012, 4:06 pm 
[I'm not sure if it has requested before, I did find a few ask for help posts where `t as used instead of %A_Tab%. A mod may delete this wish if it was already asked before.]

Str(ing)Replace accepts `r and `n why not add `t as well?

Code:
StringReplace, var, var, `r, , all
StringReplace, var, var, `n, , all

Currently you have to do
Code:
StringReplace, var, var, %A_Tab%, , all
if possible
Code:
StringReplace, var, var, `t, , all
would be nice.

You can use `t in a MsgBox for example so why not StringReplace.


Report this post
Top
  
Reply with quote  
PostPosted: January 3rd, 2012, 7:19 pm 
Offline
User avatar

Joined: December 20th, 2004, 12:19 pm
Posts: 798
Location: LooseChange911.com Ask Questions, Demand Answers █ The WTC bldgs █ shouldn't have fallen █ that fast
I actually support this.

This code...

Code:
text:="Test`ting"

StringReplace, text, text, `t, ___TAB___, a

msgbox, text(%text%)

...gives this error msg...

Code:
Error at line 3.

Line Text: StringReplace, text
Error: "StringReplace" requires that parameter #3 be non-blank.

The program will exit.

However, there is a workaround, make it an expression...

Code:
text:="Test`ting"

StringReplace, text, text, % "`t", ___TAB___, a

msgbox, text(%text%)

...but even with a workaround, I'd still like to see if this could be made to work.

_________________
AutoHotkey-Hotstring.ahk - Helping the world spell "AutoHotkey" correctly! (btw, it's a lowercase k!)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2012, 8:00 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
I would imagine that it's probably disallowed because it would be difficult for AHK to know when to omit surrounding whitespace in a parameter, since some people put a space/tab after the commas for the parameters.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2012, 11:08 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
It should be possible to remove those spaces though before parsing `t I think.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 5th, 2012, 6:19 am 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
#EscapeChar was removed from v2. Would it be feasible to simply remove the escape sequences by replacing them with built-in constants? They're another instance of dual syntax: the root of all confusion.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 5th, 2012, 9:30 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Guest wrote:
You can use `t in a MsgBox for example so why not StringReplace.
The beginning and end of the parameter list are trimmed before escape sequences are processed, whereas the whitespace surrounding each delimiter (comma) is not.
Code:
MsgBox `t`t`t`t`t<< ; Tabs
MsgBox 0,, `t`t`t`t`t<< ; No tabs

fragman wrote:
It should be possible to remove those spaces though before parsing `t I think.
That would not be feasible due to the need to differentiate `, from ,. However, characters originating from escape sequences (whether `t or `,) are marked in a way that could be used to avoid trimming `t.
jaco0646 wrote:
Would it be feasible to simply remove the escape sequences by replacing them with built-in constants?
No. There are various contexts which allow escape sequences but not variable references.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2012, 3:06 pm 
This has now been impletemented in AutoHotkey_L v1.1.06 http://www.autohotkey.com/forum/topic82444.html
Thanks!


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 12 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