 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
mandiom
Joined: 03 Mar 2008 Posts: 34
|
Posted: Wed Apr 23, 2008 5:08 pm Post subject: Keeping the Fox quiet... |
|
|
Hello.
I recently created a handy script that launches websites in firefox with a delay of some seconds. For the first site, I used (here I put google for the url)
Run, firefox.exe -new-window www.google.com
How on earth do I minimize that window? I tried Run, blah blah, , Min... Tries to minimize but the Fox pops up again. I tried WinMinimize, it goes down and then reopens... I need two WinMinimize to really keep the Fox down... What should I do?
Also, the next links go
Run, firefox.exe www.google.com
1. How can I make absolutely sure that this link opens in the same window (session) as the first one, and not in the Firefox window (different session) that I might be using?
2. How on earth do I make it go to the site without maximizing?
Thanks a lot in advance  |
|
| Back to top |
|
 |
Jaytech
Joined: 11 Dec 2006 Posts: 244 Location: Orlando, FL
|
Posted: Wed Apr 23, 2008 8:59 pm Post subject: |
|
|
Because I slighty crazy, I'm gonna answer your second question first.
Instead of using the "Run" command, try this:
| Code: | WinWait, Firefox
WinActivate, Firefox
SLEEP 300
SEND, ^o
Clipboard = "Your next website here"
WinWait, Open
SLEEP 100
SEND, ^v{ENTER}
|
Secondly (or firstly, whatever), you can minimize the window as soon as it comes up by using the "WinHide" command. So, using your example, your new code would look something like this:
| Code: | Run, firefox.exe www.google.com
WinWaitActive, Firefox
WinHide, A
SLEEP 300
;Random stuffus, aka crap you didn't tell us about
SEND, ^o
Clipboard = "Your next website here"
WinWait, Open
SLEEP 100
SEND, ^v{ENTER}
|
|
|
| Back to top |
|
 |
mandiom
Joined: 03 Mar 2008 Posts: 34
|
Posted: Thu Apr 24, 2008 3:36 pm Post subject: |
|
|
Hi and thanks for the reply. However, how would "Ctrl - O" (OPEN) help me? I got the part about minimizing it with winhide , and I'll try that. (Even though I think it will fail just like WinMinimize). But could you explain the first part of your answer please?
Also, I don't really see how that would keep the sites in the same session - firefox window. I guess you meant ctrl + c (COPY), and then paste the url maybe?? But that does not necessarily tell the script to send that command to that specific FF window.... Kinda confused here..
Thanks |
|
| Back to top |
|
 |
mandiom
Joined: 03 Mar 2008 Posts: 34
|
Posted: Sat Apr 26, 2008 2:24 pm Post subject: |
|
|
No more ideas on this? I would really appreciate some help  |
|
| Back to top |
|
 |
Conquer
Joined: 27 Jun 2006 Posts: 385 Location: Canada
|
Posted: Sat Apr 26, 2008 4:47 pm Post subject: |
|
|
| Code: | QuietFoxLaunch:
Run, firefox.exe http://www.google.ca ,,Hide UseErrorLevel
If ErrorLevel
return ; Script failed to launch the browser/site
Else
goto QuietFoxControl
return
QuietFoxControl:
; You need to use control send, send message, etc. to control the hidden firefox window
return |
Hope that helped. _________________
 |
|
| Back to top |
|
 |
mandiom
Joined: 03 Mar 2008 Posts: 34
|
Posted: Mon Apr 28, 2008 3:43 pm Post subject: |
|
|
Unfortunately that does not seem to work... Firefox is simply ignoring the "Hide" or "Min" command. Try it for yourself.
The idea is good though: I will "try" to control the window with controlsend...
Any idea why the fox is ignoring the above commands? |
|
| Back to top |
|
 |
ggwwtt Guest
|
Posted: Mon Apr 28, 2008 5:44 pm Post subject: |
|
|
Try this
Msgbox, Minimize the Firefox Window then Click OK to Continue |
|
| Back to top |
|
 |
Conquer
Joined: 27 Jun 2006 Posts: 385 Location: Canada
|
Posted: Mon Apr 28, 2008 9:49 pm Post subject: |
|
|
ggwwtt, you are ruining his evil plan with your user-aware "code".
Anyways, I tried to improve the code:
(Failed attempt):
| Code: | #Singleinstance,force
#Persistent
FoxPath = %A_ProgramFiles%\Mozilla Firefox\firefox.exe
gosub QuietFoxLaunch
return
QuietFoxLaunch:
IfExist, %FoxPath%
Run, "%FoxPath%",,UseErrorLevel Min Hide,FoxID
If ErrorLevel
{
Msgbox, Firefox could not be launched. FAIL.
exitapp
}
Else IfNotExist %FoxPath%
{
Msgbox, Firefox could not be found. FAIL.
ExitApp
}
If FoxID
goto Target
Else
{
Msgbox, Failed to get Firefox's PID. FAIL.
ExitApp
}
return
Target:
DetectHiddenWindows,On
Loop
{
If A_Index > 500
{
Msgbox, There must've been a problem detecting Firefox's PID.
ExitApp
}
IfWinNotExist, ahk_pid %FoxID%
{
Sleep 20
continue
}
IfWinExist, ahk_pid %FoxID%
{
WinHide, ahk_pid %FoxID%
Msgbox Press OK to terminate the script & hidden browser.
WinKill, ahk_pid %FoxID%
ExitApp
}
}
return |
But, it appears the PID of the newly launched Firefox can't be detected nor operated on.
Sorry, I tried.
PS. Launched Firefox with the "Min" switch actually works, compared to the "Hide" switch.
It would be possible to make a script that launches firefox then has a loop using WinHide to hide all "Mozilla Firefox" containing windows, but I don't think it would be of much use as:
1. If the user was already running firefox, his browser is going to disappear and he's gonna be pissssed.
2. You might operate on any previous opened browsers, which is also a fail.
3. The newly launched browser's PID doesn't seem to want to co-operate, so I don't think you could control it very well, anyways.
Hope this helped. _________________
 |
|
| Back to top |
|
 |
TimFlash Guest
|
Posted: Tue Apr 29, 2008 12:29 am Post subject: |
|
|
Use Firefox extensions instead:
iMacros + Minimize 2 Tray can do what want. |
|
| Back to top |
|
 |
mandiom
Joined: 03 Mar 2008 Posts: 34
|
Posted: Thu May 01, 2008 5:45 pm Post subject: |
|
|
@Conquer:
haha, not really an evil plan =) just a commodity to have the fox out of the way while it's visiting the sites it should visit. I'll try Min again, but I think I tried and failed...
@TimFlash:
maybe that's the only alternative... But it's strange that AHK can't do something so simple  |
|
| 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
|