 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Harmor
Joined: 06 Nov 2005 Posts: 182
|
Posted: Sat Nov 12, 2005 6:01 am Post subject: BF2: Paste (Ctrl+V) while running BF2 |
|
|
Battlefield 2, for some reason, disabled the paste ability. Often you'll want to copy an IP address of a server to connect to and then can't paste it when you Alt+Tab over to BF2 - with this script you can:
| Code: | ;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
;
#SingleInstance force
;
; Only run this script when BF2 is running in the foreground
;
SetTimer, KeepRunning
return
KeepRunning:
; Get the process name of the active window (i.e. notepad.exe)
WinGet, szProcessName, ProcessName, A
if szProcessName = bf2.exe
{
Suspend, off
}
else
{
Suspend, on
}
return
;
; Pressing Ctrl+V while BF2 is active
;
$^v::
Sleep 200
SetKeyDelay, 40
Send, {Space}%clipboard%
SetKeyDelay, 0
return
|
For whatever reason I needed to add a Sleep 200 before pasting into BF2 because it was removing the first character in the text it was pasting.
This works great in the server browser. _________________ //TODO: Create kewl sig...
Last edited by Harmor on Sat Jul 15, 2006 2:32 pm; edited 1 time in total |
|
| Back to top |
|
 |
Harmor
Joined: 06 Nov 2005 Posts: 182
|
Posted: Sat Jul 15, 2006 2:30 pm Post subject: |
|
|
EDIT: I added a Keydelay of 40 and put {Space} before %clipboard% because it would clip the first character you paste. I use this for pasting text for the IP address and in-game now. _________________ //TODO: Create kewl sig... |
|
| Back to top |
|
 |
JSLover
Joined: 20 Dec 2004 Posts: 634 Location: LooseChange911.com The WTC bldgs shouldn't have fallen that fast. The official story is a lie!
|
Posted: Sun Jul 16, 2006 7:19 am Post subject: Re: BF2: Paste (Ctrl+V) while running BF2 |
|
|
I can't test this, but it looks cleaner (if you remove all the comments)...
| Code: | #SingleInstance force
SetKeyDelay, 40
SetTimer, WatchBF2
return
WatchBF2:
SetTimer, WatchBF2, Off
Loop
{
; Get the process name of the active window (i.e. notepad.exe)
WinExist("a")
;WinGet, id, id
WinGet, pn, ProcessName
if pn=bf2.exe
Suspend, off
else Suspend, on
WinWaitNotActive
}
return
;//really need the hook?...it don't "send itself"...
;//$^v::
^v::
Sleep, 219
;//you should set this in the auto-execute section, if this is the only thing this script does...
;//SetKeyDelay, 40
;//SendRaw ensures no surprises on the clipboard...
SendRaw, %clipboard%
;//use %A_Space% if you still need a space...
;//SendRaw, %A_Space%%clipboard%
;//at the very least, you don't need to undo the change, since this is a sub-routine...
;//SetKeyDelay, 0
return |
_________________
Home • Click image! • Blog |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|