Jump to content

HotKeySet or _IsPressed for sequence for purposes of replacement


Recommended Posts

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
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...