 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
DynamiteToast Guest
|
Posted: Wed Apr 15, 2009 5:26 pm Post subject: Invalid Hotkey |
|
|
So I'm tryint to make a program that will detect when my friend enters a website and redirect him to that website with "http://bacolicio.us/" in front of it.
If you don't know what that does, click here: http://bacolico.us/http://http://bacolicio.us/http://www.google.com
Anyways, here's my code:
IfWinExist (Chrome)
{
www::Input, OutputVar, C V, {enter},
Send http://bacolicio.us/http://www.%OutputVar%{Enter}
}
I thought that means anytime he's using his browser (Chrome, in this case), if he presses www it will start an input and copy the website to a string, then when he presses enter I was hoping I could use Send to reinput the website with the desired prefix.
When I try to run it I get this error:
Error at line 3.
Line Text: www::Input, OutputVar, C V, {enter}
Error: Invalid hotkey.
The program will exit.
I don't know why it's doing this, and so I was hoping someone could figure it out, also if anyone knows any easier implementation or command that I don't, feel free to advise me, I've never really tried anything with autohotkey before today |
|
| Back to top |
|
 |
DynamiteToast Guest
|
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4652 Location: AHK Forum
|
Posted: Wed Apr 15, 2009 7:37 pm Post subject: |
|
|
This works with Iron
| Code: | #IfWinActive, ahk_class Chrome_WidgetWin_0
:B0:www::
Input, OutputVar, V, {enter}
ControlSetText,Chrome_AutocompleteEditView1,http://bacolicio.us/http://www.%OutputVar%, A
ControlSend,Chrome_AutocompleteEditView1,{ENTER}, A
Return
#IfWinActive |
_________________ AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun  |
|
| Back to top |
|
 |
Slanter
Joined: 28 May 2008 Posts: 739 Location: Minnesota, USA
|
Posted: Wed Apr 15, 2009 7:46 pm Post subject: |
|
|
You should be using a hotstring, not a hotkey.
| Code: | :B0:www:: ; B0 is an option that prevents deletion of the string
; Do Something
Return |
_________________ Unless otherwise stated, all code is untested
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination. |
|
| Back to top |
|
 |
Red Hat Dude Guest
|
Posted: Wed Apr 15, 2009 8:30 pm Post subject: |
|
|
Neat.
ControlSend doesn't seem to work right with Firefox. So I did this:
| Code: | Hotkey, Enter, off
#IfWinActive, ahk_class MozillaUIWindowClass
:B0:www::
Hotkey, Enter, on
Input, OutputVar, V, ^+!q
;ControlSetText,MozillaWindowClass1,http://bacolicio.us/http://www.%OutputVar%, A
clipboard = http://bacolicio.us/http://www.%OutputVar%
Send, {Ctrl down}a{Ctrl up}
Send, {Ctrl down}v{Ctrl up}
; ControlSend,Chrome_AutocompleteEditView1,{ENTER}, A
Hotkey, Enter, off
Send,{ENTER}, A
Return
#IfWinActive
$Enter::Send, ^+!q |
|
|
| Back to top |
|
 |
DynamiteToast Guest
|
Posted: Thu Apr 16, 2009 12:06 am Post subject: |
|
|
| Thanks! This worked well, I had to alter it for IE but given your template it was not hard. It worked like a charm |
|
| Back to top |
|
 |
DynamiteToast Guest
|
Posted: Fri Apr 17, 2009 7:49 am Post subject: |
|
|
So I don't know if anyone else tried to implement this, but I severely over estimated the use of www., and I don't think he's done it yet, so I rewrote it so that it does it after com. Also I made it so that there's no tray icon in case they notice that, press #x to exit it.
#NoTrayIcon
#IfWinActive, ahk_class Chrome_WidgetWin_0
;MozillaUIWindowClass (For Firefox)
;IEFrame (For Internet Explorer)
:B0*:com::
Send, {Ctrl down}{Left}{Left}{Left}{Left}{Ctrl up}
Send, http://bacolicio.us/http://
Send,{ENTER}
Return
#IfWinActive
#x::ExitApp |
|
| 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
|