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 

IfWinExist and Firefox Tabs

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Knowbodynow



Joined: 26 Jun 2007
Posts: 36

PostPosted: Sun Dec 09, 2007 6:18 am    Post subject: IfWinExist and Firefox Tabs Reply with quote

Hello, I have little experience with AutoHotKey or coding. I know how to check if Firefox has been launched so that I can switch to it rather than launching several instances. I would like a hotkey to launch POPfile. Currently I'm using:
Code:
+#p:: Run "http://localhost:8080/"

This will launch the default browser (Firefox) and create a tab entitled "POPfile Control Center". But if I press the key combination a second time I get two tabs. What I want to do is to be able to switch to the tab if it already exists. Is there a way to do this? I tried using IfWinExist but didn't get anywhere.

Thanks

CaH
Back to top
View user's profile Send private message
Andy3
Guest





PostPosted: Sun Dec 09, 2007 11:58 am    Post subject: Reply with quote

Maybe a Firefox extension works for you? You can install iMacros inside Firefox and then open Firefox with

http://run.imacros.net/?m=yourmacro

"yourmacro" is a simple iMacros macro that switches the tabs ("TAB T=2").
Back to top
Knowbodynow



Joined: 26 Jun 2007
Posts: 36

PostPosted: Sun Dec 09, 2007 1:11 pm    Post subject: Reply with quote

Thanks, but I'd like to avoid installing any additional extensions. Right now I have a custom button in Thunderbird that will bring up Firefox and launch an instance of POPfile. As long as I remember to close it I won't get two instances of POPfile running. So what I have is basically OK. I guess I'd like to know if it is possible to switch Firefox tabs using AutoHotKey

Cheers,

CaH
Back to top
View user's profile Send private message
Andy3
Guest





PostPosted: Sun Dec 09, 2007 8:20 pm    Post subject: Reply with quote

Maybe this post works for Firefox, too?

http://www.autohotkey.com/forum/topic25855.html
Back to top
DerRaphael



Joined: 23 Nov 2007
Posts: 508
Location: Heidelberg, Germany

PostPosted: Mon Dec 10, 2007 10:27 am    Post subject: Reply with quote

hi

put this somewhere in autoexecute section of your script:
Code:

SetTitleMatchMode, RegEx


and this one in front of your hotkey
Code:

#IfWinActive, Mozilla Firefox$


first one will switch on RegularExpressions for setTitleMatchMode and the later will check if a window exist, where Mozilla Firefox are the last two words

greets
derRaphael
Back to top
View user's profile Send private message
Knowbodynow



Joined: 26 Jun 2007
Posts: 36

PostPosted: Mon Dec 10, 2007 9:58 pm    Post subject: Reply with quote

Thanks for the reply, derRaphael. How will the code you suggested help me to check if Firefox has a tab of a particular name? Currently I'm using SetTitleMatchMode 2 to identify if Firefox is running. That seems to be working OK.

CaH
Back to top
View user's profile Send private message
DerRaphael



Joined: 23 Nov 2007
Posts: 508
Location: Heidelberg, Germany

PostPosted: Mon Dec 10, 2007 10:30 pm    Post subject: Reply with quote

sorry, misunderstood your question
the code i suggested only checks if a window is open and its title ends with mozilla firefox

to get informations about tabs...

there is an article which describes how msie tab and firefox tab information are retrieved, buts its not too simple. especially the firefox part invokes a custom plugin that allows communication with external apps

may you want to give it a try .... i'd do myself, but right now im focused on other things and dont have too much time for it

http://www.codeproject.com/KB/applications/JWinSearch.aspx?df=100&forumid=467309&exp=0&select=2306648#ffExt

firefox is a multi os application and to have it look the same on multiple operating systems like linux, mac os or windows, the developers created own ways to display informations. so working with these structures requires somewhat special treatment.


probably a workaround for your problem would be to store in the script if the hotkey was pressed and check for that status when its pressed

something like:

Code:

firefoxtab := 0

+#p::
 if !(fireFoxTab) {
    Run "http://localhost:8080/"
    firefoxTab:=1
 }
return



but this only works once util you restarted the script, and there is no control about the tab thing

another solution might be to send ctrl+tab to firefox application, cycle this way through tabs and remember their names (due to changing fireox title bar)

when all names are gathered twice you've cycled through all and repeated a around - you can stop sending the ctrl tab then and check for your desired name

if this one's not in that name bunch open it again ...
this solution is not a real elegant one, but should work


greets
derRaphael
Back to top
View user's profile Send private message
Knowbodynow



Joined: 26 Jun 2007
Posts: 36

PostPosted: Mon Dec 10, 2007 11:28 pm    Post subject: Reply with quote

Thank for the detailed reply, I appreciate it. The problem certainly doesn't warrant trying to use a plugin but I may have a go at one of the workaround methods you suggested.

Thanks again,

CaH
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   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