AutoHotkey Community

It is currently May 26th, 2012, 5:24 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Invalid Hotkey
PostPosted: April 15th, 2009, 6:26 pm 
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://bacoli ... 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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2009, 6:28 pm 
That first link didn't work,

http://bacolicio.us/http://www.google.com


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2009, 8:37 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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 :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2009, 8:46 pm 
Offline

Joined: May 28th, 2008, 2:11 am
Posts: 739
Location: Minnesota, USA
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2009, 9:30 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2009, 1:06 am 
Thanks! This worked well, I had to alter it for IE but given your template it was not hard. It worked like a charm


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 17th, 2009, 8:49 am 
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


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: batto, BrandonHotkey, mrhobbeys, MSN [Bot], Mtes, perlsmith, rbrtryn, stanman, Yahoo [Bot] and 63 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group