Welcome Guest.   Make a donation to an author on the site September 01, 2014, 09:05:03 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Check out and download the GOE 2007 Freeware Challenge productivity tools.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: DONE: Allow input commands to be sent to background windows.  (Read 8809 times)
big_smile
Participant
*
Posts: 3

View Profile Give some DonationCredits to this forum member
« on: May 10, 2009, 05:27:26 AM »

On Windows XP, when a window is not the active focus, it is not possible to input commands to it.

I think it would be great if someone could write a programme that allows input commands to be sent to a background window
(or alternatively a programme that allows more than one window to have the active focus).

This would be handy for:
--Video game emulation - Two emulators could be opened on one machine allowing two players to play at the same time (thus turning any 1 player game into a 2 player contest to see who could reach the end of a level first)
--Being able to input commands into a background programme that is open all the time (e.g. refreshing a web browser) while still working in a main application (e.g. typing a letter in Microsoft Word) without having to click on the background application.

It mustn't be too complex, as programmes like key loggers are able to accept inputs without being at the foreground. (Although not being a programmer I shouldn't really comment on the complexity!)  ^_^
Logged
wr975
Charter Member
***
Posts: 369



View Profile Give some DonationCredits to this forum member
« Reply #1 on: May 10, 2009, 06:21:19 AM »

> --Video game emulation ...

 tellme

> ...without having to click on the background application

Use TweakUI to activate the x-mouse setting (http://articles.techrepub...100-10878_11-5082157.html) or change the registry (http://www.pctools.com/guides/registry/detail/18/).

In Vista this feature is part of the OS (Control Panel > Ease of Access Center > Make the mouse easier to use)
Logged
Ampa
Charter Member
***
Posts: 589


I am cute ;)

View Profile WWW Give some DonationCredits to this forum member
« Reply #2 on: May 10, 2009, 07:00:18 AM »

It think that big_smile is probably refering to keyboard input, rather than mouse input, so wr975's suggestions don't quite fit the bill.

Here are some potential problems with the idea...

* Keyboard hardware is designed to accept a few keys being pressed at at time. Having 2 players at the same keyboard doubles the number of inputs that must be handled and I don't think that the hardware is up to it.

* How does the software know which keys to send to which application? Presumably I'd have to configure it for each combination of programs that I want to use.

* What if I need to send the same key to different applications, at different times? eg I have two browsers open and I hit F5 to refresh... which browser gets refreshed?

Perhaps you should seek better solutions to the problems you bring up...

* Opera (and probably other modern browsers) allow you to set an auto refresh time for each tab, removing the need to manually refresh the page at intervals.

* Look for an emulator that already incorporates 2 players, or one that will allow a network connection to play the game on 2 machines?

Ampa
Logged
skrommel
Fastest code in the west
Developer
***
Posts: 882



View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: May 11, 2009, 04:57:54 AM »

 smiley Try WriteThere!

It redirects all keyboard input to one window.
Click inside the target window and press F1 to redirect the input to it.
Press F1 twice fast to disable WriteThere.

Example:
Open Internet Explorer and Notepad, and place them side by side. Click inside Notepad and press F1 to redirect the keyboard. Now you can navigate your browser using the mouse, but everyting your write will end up in Notepad! 

This is a beta if ever there was one! There's probably a lot of keys missing, it doesn't work with all programs, it disables global hotkeys, and so on.

Skrommel


[copy or print]
;WriteThere.ahk
; Redirect all keyboard input to one window.
; Click the target window and press F1 to redirect.
; Press F1 twice fast to disable.
;Skrommel 2009

#NoEnv
#Persistent,On
#SingleInstance,Force
SetWinDelay,0
SetControlDelay,0
SetBatchLines,-1
SendMode,Input
;SetKeyDelay,0

hotkeys=0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,æ,ø,å,LCtrl,RCtrl,LShift,RShift,LAlt,RAlt,LWin,RWin,Appskey,Left,Right,Up,Down,Tab,PgUp,PgDn,Home,End,Delete,Insert,Esc,Space,BackSpace,Enter,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,!,?,+,-,_,*,/,\,(,),{,[,],},<,>,|,&,§,@,$,£,#,¤,µ,^,~,¨,´,',.,:,`%,``,`",`;

TOOLTIPON("WriteThere`n`nRedirect all keyboard input to one window.`nClick the target window and press F1 to redirect.`nPress F1 twice fast to disable.`n`nwww.1HourSoftware.com",10)
Return


TOGGLEHOTKEYS:
If enabled<>On
  enabled=On
Else
  enabled=Off
TOOLTIPON("WriteThere " enabled)
Loop,Parse,hotkeys,`,
{
  Hotkey,$*%A_LoopField%,SEND,%enabled%
  Hotkey,$*%A_LoopField% Up,SEND,%enabled%
}
Hotkey,$*`,,SEND,%enabled%
Hotkey,$*`, Up,SEND,%enabled%
Return


SEND:
;TOOLTIPON(A_ThisHotkey)
StringTrimLeft,key,A_ThisHotkey,2
ControlSend,%ctrl%,{%key%},ahk_id %win%
Return


F1::
If enabled=On
If A_PriorHotkey=F1
If A_TimeSincePriorHotkey<999
{
  Gosub,TOGGLEHOTKEYS
  Return
}

If enabled<>On
  Gosub,TOGGLEHOTKEYS

win:=WinExist("A")
Loop
{
  parent:=DllCall("GetParent",UInt,win)
  If parent=0
    Break
  win:=parent
}

ControlGetFocus,ctrl,ahk_id %win%
winGetClass,class,ahk_id %win%
TOOLTIPON("Keyboard redirected to `n" ctrl " in `n" class)
Return


TOOLTIPON(tip,delay=3)
{
  ToolTip,%tip%
  SetTimer,TOOLTIPOFF,% delay*-1000
}


TOOLTIPOFF:
ToolTip,
Return
« Last Edit: May 11, 2009, 05:02:20 AM by skrommel » Logged

Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
big_smile
Participant
*
Posts: 3

View Profile Give some DonationCredits to this forum member
« Reply #4 on: May 11, 2009, 01:05:35 PM »

That's great for the second scenario I posted, but I would really like a solution to the first scenario (of using two game emualtors).

Is there anyway to make it direct all input to two windows?

With a game emulator, there isn't the problem of having wrong commands being sent to the wrong window, as you can set the each emulator to ignore commands.
(For example, you can tell emulator window 1 to execute the 'jump' command when the A key is pressed and tell emulator window 2 to execute the jump command when the B key is pressed.
It doesn't matter if emulator 2 receives the A key command, because it will only execute a jump when it receives a B key input).
Logged
skrommel
Fastest code in the west
Developer
***
Posts: 882



View Profile WWW Give some DonationCredits to this forum member
« Reply #5 on: May 11, 2009, 01:16:32 PM »

 smiley It could easily be done. Just make two separete scripts, edit the hotkeys= in each of them, and give each it's own redirect hotkey. But I'm uncertain if it will work properly, the last key pressed will probably overrule the other ones...

Skrommel
« Last Edit: May 11, 2009, 01:25:32 PM by skrommel » Logged

Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
big_smile
Participant
*
Posts: 3

View Profile Give some DonationCredits to this forum member
« Reply #6 on: May 27, 2009, 01:09:54 PM »

Hi
How do I use the script.

I have tried to figure it out on my own but haven't got very far.

Thanks!
Logged
skrommel
Fastest code in the west
Developer
***
Posts: 882



View Profile WWW Give some DonationCredits to this forum member
« Reply #7 on: May 31, 2009, 03:22:22 PM »

 smiley Go to www.autohotkey.com and download AutohotkeyInstaller. Install it, download the script, save it to WriteThere.ahk. Doubleclick it to run it.

Open Internet Explorer and Notepad, and place them side by side. Click inside Notepad and press F1 to redirect the keyboard. Now you can navigate your browser using the mouse, but everyting your write will end up in Notepad!

Skrommel
Logged

Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
937o5
Participant
*
Posts: 14

View Profile Give some DonationCredits to this forum member
« Reply #8 on: September 29, 2009, 12:06:44 PM »

I was wondering... Would anyone here be willing to make this much more compatable with other applications? Like... Texter was coded with AHK scripts, and it works just fine in any program I've tested it on, even games. Couldn't this be changed to input the text the same way texter does? In turn making it more compatable with random programs out there.
Logged
lanux128
Global Moderator
*****
Posts: 6,088



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: September 30, 2009, 08:06:46 AM »

there is a similar program by jgpaiva here and a exe version which you can try out, if you wish.

edit by jgpaiva: fixed link
« Last Edit: September 30, 2009, 08:20:46 AM by jgpaiva » Logged

937o5
Participant
*
Posts: 14

View Profile Give some DonationCredits to this forum member
« Reply #10 on: September 30, 2009, 08:15:50 AM »

Ohhh! That one works like I had hoped, but I don't need to select multiple windows.. And I'm trying to make the main window I'm working with not lose focus... Maybe I might be able to make some edits and try to make WriteThere work like that, and be able to toggle WriteThere on and off with a different hotkey, so no more double-tapping F1...

Actually, I just had an idea. I think WriteThere and the other script could be used together to send data to other windows the way I want! But... Would someone mind modding a version of WriteThere to use F1 to capture a window, and F2 to toggle the input redirect on and off?... Or maybe customizable hotkeys?... I just need them to be different, so I can capture what window I want, and only send text when I want to, without losing focus on the main window..
« Last Edit: September 30, 2009, 08:21:11 AM by 937o5 » Logged
lanux128
Global Moderator
*****
Posts: 6,088



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #11 on: September 30, 2009, 08:21:17 AM »

that's the beauty of AHK, you can pick the best of the bunch to suit your needs.. take a look at both sources and maybe you can come with something. smiley
Logged

937o5
Participant
*
Posts: 14

View Profile Give some DonationCredits to this forum member
« Reply #12 on: September 30, 2009, 08:22:08 AM »

If I get this working, I'll post the hybrid code up. =P
Logged
lanux128
Global Moderator
*****
Posts: 6,088



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #13 on: September 30, 2009, 08:37:01 AM »

good luck.. smiley
Logged

Curt
Supporting Member
**
Posts: 6,336

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #14 on: January 02, 2011, 10:23:40 AM »

WriteThere works in my setup, but is buggy: NO spaces at all. Everythingisoneverylongword.

Did any one use it with success?  tellme  I like the program's idea very much.
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.042s | Server load: 0.12 ]