Sign in to follow this  
Followers 0
maqleod

HotKeySet or _IsPressed for sequence for purposes of replacement

3 posts in this topic

#1 ·  Posted (edited)

What I want to do is detect a stream of letters and replace with a different string of letters.

Something like this, but this detects the f and starts going, also pulling the f from the sent key and continually repeating forever:

#include <Process.au3>
 
 
 
HotKeySet("forumsX", "LinkForums") ;listens for forumsX to be typed
 
While 1 ;loop indefinitely
Sleep(100) ;keeps from maxing out processor
 
WEnd
 
Func LinkForums()
Dim $pid
If WinExists("Gmail", "") Then ;check if a window relating to Gmail is open
$pid = WinGetProcess("Gmail", "") ;check that window is actually open in a browser (therefore negating notepad, wordpad, etc)
If _ProcessGetName($pid) = "firefox.exe" Then ;verify browser is firefox
Send("<a href='www.myforums.com'>My Forums</a>") ;replacement text goes here
EndIf
EndIf
EndFunc

Is the only way to do this to have a sequence of _IsPressed() functions in a large set of nested If statements? or is there a cleaner way using Hotkey set or IsPressed, or even something else?

Edited by maqleod

[u]You can download my projects at:[/u] Pulsar Software

Share this post


Link to post
Share on other sites



Hi,

Have a look at the example in AutoIt help file -> User Defined Functions Reference -> WinAPI Management ->

_WinAPI_SetWindowsHookEx.

That should give you all the help you'll need to accomplish what your after.

Cheers

Share this post


Link to post
Share on other sites

Maybe this

Follow the Link --------

Share this post


Link to post
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
Sign in to follow this  
Followers 0