Jump to content


controlsend


  • Please log in to reply
4 replies to this topic

#1 NekoVamp

NekoVamp
  • Guests

Posted 19 June 2012 - 06:01 AM

pgdn::
ControlSend, , pgdn, cdisplay.exe
return

I use Cdisplay to read my comic books on my computer.
Pgup/Pgdn are the hotkeys to turn the pages but they only work if its in focus.
I have 2 monitors and so its not always in focus when i press the key because im doing other things aswell.

i am trying to set it up so pgup/pgdn is sent to cdisplay regardless of if its in focus or not.

Now here is the problem. The window title changes depending on the comis im reading. So i am not sure how to do this.

#2 VxE

VxE
  • Fellows
  • 3504 posts

Posted 19 June 2012 - 07:57 AM

Firstly ControlSend, , pgdn will actually send the letter keys 'p', 'g', 'd', 'n'. You want {PgDn}.

Secondly, you can usually use the window class to identify a window with a changing title. Here's a small demo:
\:: ; Hotkey: Backslash. Hides and shows a tooltip with the active window's class
	IfWinActive, AHK_Class %someclass%
	{
		Tooltip
		someclass := ""
	}
	Else IfWinExist, A ; sets the "last found window" to the active window
	{
		WinGetClass, someclass
		Tooltip, %someclass%
	}
Return

esc::Exitapp


#3 Guests

  • Guests

Posted 19 June 2012 - 08:14 AM

i think i am still getting this wrong or not understanding. I found the class name and reformatted the command how i thought it would work but it still isnt.

pgdn::
ControlSend, TMainDisplayForm, {pgdn}
return

i dont get errors or anything from this it just doesnt work.

#4 VxE

VxE
  • Fellows
  • 3504 posts

Posted 19 June 2012 - 04:41 PM

ControlSend, Control, Keys, WinTitle...

The window is not a control. It's unlikely that you will need to put anything in that parameter.
$PgDn::
IfWinExist, AHK_Class TMainDisplayForm
   ControlSend,, {PgDn}
Else
   Send {PgDn}
return


#5 NekoVamp

NekoVamp
  • Guests

Posted 19 June 2012 - 05:57 PM

thank you so much it works perfect! *hugs* :D