AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Invalid Hotkey

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
DynamiteToast
Guest





PostPosted: Wed Apr 15, 2009 5:26 pm    Post subject: Invalid Hotkey Reply with quote

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





PostPosted: Wed Apr 15, 2009 5:28 pm    Post subject: Reply with quote

That first link didn't work,

http://bacolicio.us/http://www.google.com
Back to top
HotKeyIt



Joined: 18 Jun 2008
Posts: 4652
Location: AHK Forum

PostPosted: Wed Apr 15, 2009 7:37 pm    Post subject: Reply with quote

This works with Iron Smile
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 Wink
Back to top
View user's profile Send private message
Slanter



Joined: 28 May 2008
Posts: 739
Location: Minnesota, USA

PostPosted: Wed Apr 15, 2009 7:46 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Red Hat Dude
Guest





PostPosted: Wed Apr 15, 2009 8:30 pm    Post subject: Reply with quote

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





PostPosted: Thu Apr 16, 2009 12:06 am    Post subject: Reply with quote

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





PostPosted: Fri Apr 17, 2009 7:49 am    Post subject: Reply with quote

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
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group