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 

Switch textplace?

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





PostPosted: Mon Oct 22, 2007 7:01 pm    Post subject: Switch textplace? Reply with quote

Hi

I'm all new to ahk, and I wonder if there's a script that can do the following.
I work with a system there I very often need to switch the place between two words.
Ex.
Test-one Test-two

I just want to mark them with the mouse and dobbelclick the caps lock button or something so they switch place.

Test-two Test-one

Is that possibe?
Hope someone can help me or give me a direction where to look.
Back to top
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Mon Oct 22, 2007 7:15 pm    Post subject: Reply with quote

seems possible, though doubleclick of capslock is the hardest part.

Code:

#Capslock::
Send, ^c
Clipwait, 0.5
StringSplit, array, clipboard, %A_space%
Loop, %array0%
{
item := (array0 - A_index) + 1
SendRaw, % array%item%
}
Return


Activate with Win+Capslock
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
badchx
Guest





PostPosted: Mon Oct 22, 2007 7:27 pm    Post subject: Reply with quote

Sweet. Works great!
Thanks man. =)
Back to top
ggirf14



Joined: 01 Nov 2005
Posts: 108
Location: Ottawa

PostPosted: Mon Oct 22, 2007 7:29 pm    Post subject: Reply with quote

Simple ideal

Code:
Hotkey, ^1, label1
Hotkey, ^2, label2
Return

Label1:
Send, Test-one 
Return

Label2:
Send, Test-two 
Return


Select the text to replace than ctrl+1 wil replace selected text with "test-one"
Same with ctrl+2 "Will write test-two"
Back to top
View user's profile Send private message
badchx
Guest





PostPosted: Mon Oct 22, 2007 7:37 pm    Post subject: Reply with quote

engunneer:

I'm missing a space.
Test-one Test-two, becomes test-twotest-one.
Any tips?
Back to top
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Mon Oct 22, 2007 8:18 pm    Post subject: Reply with quote

sort of a hack, but
Code:

#Capslock::
Send, ^c
Clipwait, 0.5
StringSplit, array, clipboard, %A_space%
Loop, %array0%
{
item := (array0 - A_index) + 1
SendRaw, % array%item% . " "
}
Send {bs}
Return

_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
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