Jump to content

Swap Charecters as you type


bchindia
 Share

Recommended Posts

Hi,

I am new to this forum and my interest in AutoIt software is not more than using it for "swapping two characters as you type" in ms word 2010/ other word processing software.   My question is -

When I type "any character" followed by  "f" in ms word, the letter "f" should swap with its previous typed letter. i.e. whenever there is an occurrence of "any character"  followed by "f", the character "f" should be shifted before that typed previous "any character".  Symbolically,   

                                                                                If you type "?f", it should immediately change to "f?".  (Here '?' is used as a wildcard - any letter)

Going one step further, I also need, when the previous second letter is 'd', then 'f" should be shifted three letters ahead.  Symbolically,  

                                                                       If you type  "?d?f", it should immediately change to "f?d?".  (Here '?' is used as a wildcard - any letter)

Presently, I am using a software called Shortkey, but it does not support wildcards.  As a result, for the above simple two steps, I have to give all the possible "f" combinations for the program to work eg. tf to ft, sf to fs, kf to fk, sdtf to fsdt, kdsf to fkds, etc. and the list is more than 100 and still keep including more combinations.

Your kind help will use a simplified macro.  Thanks.

A.Chandrasekar

Link to comment
Share on other sites

Good morning @bchindia, and welcome to this forum :)
SO, what you need, is to swap letters, but, the thing I don't understand, is the logic behind this "swap"... 
Because, when you do this example:
 

44 minutes ago, bchindia said:

 If you type  "?d?f", it should immediately change to "f?d?"

seems that the logic behind the result is to swap "alphabetically" the string...
If the logic behind you result is, indeed, to simply reverse your string,  you could use:
 

StringReverse() ; Used to reverse literally the string 
; I.E. : 
#include <MsgBoxCostants>
Local $sString = "Hello!", $sStringReversed = ""
$sStringReversed = StringReverse($sString)
MsgBox($MB_SYSTEMODAL, "String Reverse Example", "This is your string reversed: " & $sStringReversed)

There are a lot of functions you can manage string through them...
You can find more here.
Just ask if you have to :)

EDIT:

There's another script language, called "AutoHotKey", which allows to create this kind of shortcut...
I don't know so much about that, but if you look on Internet, you can easily find out something interesting... :) 

Edited by FrancescoDiMuro
Information...

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

Thanks for your reply.  There is no logic for swapping/ shifting of letter "f".  Whatever may be previous letter, it should swap.  For example, bf, cf will become fb, fc where the alphabet logic doesn't work.  

 Actually, I am using English Keyboard for typing in "HINDI" language with Inscript key layout. 

As suggested by you, I shall also try autoscript software also, as the purpose of my query is to get my simple job done and in no way it is software oriented.

With regards,

A.Chandrasekar

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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