AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

backward search, delete a word, to the left

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
frosty
Guest





PostPosted: Wed Dec 10, 2008 12:37 am    Post subject: backward search, delete a word, to the left Reply with quote

Hi. Just wondering if I can do like in Microsoft Word search backwards. I'm trying to send keystroke to do backward search of a space. Actually what I want my script to do is delete a word, to the left side. I'm trying to search the space to the left after this word.
Back to top
Conquer



Joined: 27 Jun 2006
Posts: 385
Location: Canada

PostPosted: Wed Dec 10, 2008 12:54 am    Post subject: Reply with quote

Code:
Send {Control Down}{Backspace}{Control Up}


That will erase text until the next space. (Unless you're starting with a space, in which case it will erase until the first space after it reaches a character)

Hope that made sense and helped.
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 3254
Location: Simi Valley, CA

PostPosted: Wed Dec 10, 2008 2:46 am    Post subject: Reply with quote

Code:
; [Shift]+[backspace] to delete word (chars up to the first space to the left)
+BS::Send, {blind}^{Left}{Del} ; [ctrl]+[shift]+[left/right] = select chars up to space ('right' includes the space, 'left' doesn't)

tested in notepad.

for me, ctrl+backspace prints a little rectangle () at the caret (in notepad), though it does work in firefox.
_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!
Back to top
View user's profile Send private message
frosty
Guest





PostPosted: Sat Dec 13, 2008 10:37 am    Post subject: Reply with quote

Thank you guys for the quick reply. Yea, ctrl backspace also gave me box thingy. VXE your code worked perfectly. I tried to change {Left} with {Right} in hopes to delete word to the right, but didn't work. Just wondering if you have any ideas.
Back to top
frosty
Guest





PostPosted: Wed Dec 17, 2008 4:55 am    Post subject: Reply with quote

VXE, help me how to delete word to the right using same principle. I put {right} in place of {left} but didn't. Thanks in advance. I appreciate it.
Back to top
[VxE]



Joined: 07 Oct 2006
Posts: 3254
Location: Simi Valley, CA

PostPosted: Wed Dec 17, 2008 5:17 am    Post subject: Reply with quote

I'm not sure exactly what you're asking for.
Code:
; [Shift]+[backspace] to delete word (chars up to the first space to the left)
$+BS::Send, {blind}^{Left}{BS} ; [ctrl]+[shift]+[left/right] = select chars up to space ('right' includes the space, 'left' doesn't)
; [Shift]+[del] to delete word (chars up to and including the first space to the right)
$+Del::Send, {blind}^{Right}{BS}

This *should* work. If you're having trouble, please give more information about what isn't working and about what you've tried to get it to work.

btw: recent experimentation has lead me to discover that [shift][del] is the same as 'cut' (or [ctrl][v]). I didn't know that before

[edit:] typo
_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Last edited by [VxE] on Fri Dec 19, 2008 1:31 pm; edited 1 time in total
Back to top
View user's profile Send private message
frosty
Guest





PostPosted: Fri Dec 19, 2008 6:02 am    Post subject: Reply with quote

Works perfect now. Thanks VXE. I just missed the second "}". Anywho, I was trying to have ctrl BS as hotkey, but didn't get it to work. Where did I go wrong?

$^BS::Send, {blind}^{Left}{BS}
Back to top
[VxE]



Joined: 07 Oct 2006
Posts: 3254
Location: Simi Valley, CA

PostPosted: Fri Dec 19, 2008 1:35 pm    Post subject: Reply with quote

frosty wrote:
Where did I go wrong?
$^BS::Send, {blind}^{Left}{BS}

Well, my previous code relied on the [shift] key being already down, hence the {blind} flag.

The exact sending without the {blind} should be
Code:
$+BS::Send, ^+{Left}{BS}
$^BS::Send, ^+{Right}{BS}

*untested*
_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!
Back to top
View user's profile Send private message
frosty
Guest





PostPosted: Thu Dec 25, 2008 5:26 am    Post subject: Reply with quote

On second thought I can't have use CTRL cause I'm gonna need it to browse in between tabs in FF. I thought to use this one I don't know the name of the key is, which is the one in between RWin and RCtrl. Logo looks like a box with cursor. Also near Ctrl, it's convenient enough. VXE if you can please code me to have it

(???logo here???)+PgUp::Send, ^+{Left}{BS}
(???logo here???)+PgDn::Send, ^+{Right}{BS}
Back to top
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Thu Dec 25, 2008 10:34 am    Post subject: Reply with quote

It is called the AppsKey, http://www.autohotkey.com/docs/KeyList.htm
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group