X
Thinta lapha ukuze uye kuveshini yamakhalekhukhwini kusayithi.

Isithangami Sabeseki

Lolu chungechunge lwabekwa kunqolobane. Uyacelwa ubuze umbuzo omusha uma udinga usizo.

From a script (e.g. REXX or BAT) how can I tell if Firefox is up and running?

Kuphostiwe

System: Windows 7 Ultimate x64

I'm trying to open Firefox with multiple tabs open at one time using a program, which reads a configuration file (XML). I discovered when using the "-new-tab" command line parameter, I get one windows for each URL instead of one window with multiple tabs.

I can get it to work IF Firefox is already up and fully running. In other words its frames exist and are visible. If Firefox is only running (say in the tasklist) but not yet visible, the user again gets one window for each URL (e.g. 5 URLs = 5 Firefox windows) instead of 1 window with 5 tabs.

Thus I've been wondering is there a method in Windows or using Firefox to tell from a script (e.g. REXX, BAT, Perl, etc) if Firefox is completely visible and running, so when you a script uses the "-new-tab" parameter the tab appears instead of a window (per URL).

System: Windows 7 Ultimate x64 I'm trying to open Firefox with multiple tabs open at one time using a program, which reads a configuration file (XML). I discovered when using the "-new-tab" command line parameter, I get one windows for each URL instead of one window with multiple tabs. I can get it to work IF Firefox is already up and fully running. In other words its frames exist and are visible. If Firefox is only running (say in the tasklist) but not yet visible, the user again gets one window for each URL (e.g. 5 URLs = 5 Firefox windows) instead of 1 window with 5 tabs. Thus I've been wondering is there a method in Windows or using Firefox to tell from a script (e.g. REXX, BAT, Perl, etc) if Firefox is completely visible and running, so when you a script uses the "-new-tab" parameter the tab appears instead of a window (per URL).

Okulungisiwe ngu Bertram_Moshier

Eminye Imininingwane Yohlelo

Fakela amapulagi

  • Shockwave Flash 11.5 r502
  • The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
  • VLC media player Web Plugin 2.0.2
  • NVIDIA 3D Vision plugin for Mozilla browsers
  • NVIDIA 3D Vision Streaming plugin for Mozilla browsers
  • Next Generation Java Plug-in 10.9.2 for Mozilla browsers
  • NPRuntime Script Plug-in Library for Java(TM) Deploy
  • iTunes Detector Plug-in
  • Adobe Shockwave for Director Netscape plug-in, version 11.6.6.636
  • Adobe PDF Plug-In For Firefox and Netscape 10.1.4
  • Adobe Shockwave for Director Netscape plug-in, version 11.6.5.635
  • Yahoo Application State Plugin version 1.0.0.7
  • 5.1.10411.0
  • AmazonMP3DownloaderPlugin 1.0.15
  • Adobe Shockwave for Director Netscape plug-in, version 11.6.1.629
  • PlayStation(R)Network Downloader Check Plug-in
  • 2.0
  • The plug-in allows you to open and edit files using Microsoft Office applications
  • Office Authorization plug-in for NPAPI browsers
  • CANON iMAGE GATEWAY Mycamera Plugin

Isisebenziso

  • I-ejenti Engumsebenzisi: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0

Eminye Imininingwane

Application Basics
Name
Firefox
Version
16.0.2
User Agent
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0
Profile Folder
Show Folder
Enabled Plugins
about:plugins
Build Configuration
about:buildconfig
Crash Reports
about:crashes
Memory Use
about:memory
Extensions
Name
Version
Enabled
ID
Adblock Edge
2.0
true
{fe272bd1-5f76-4ea4-8501-a05d35d823fc}
Adblock Plus
2.2.1
true
{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}
Adblock Plus Pop-up Addon
0.5
true
adblockpopups@jessehakanen.net
Ant Video Downloader
2.4.7.4
true
anttoolbar@ant.com
Auto Refresh
1.0.2
true
autorefresh@plugin
Auto Timer
1.7
true
autoTimer@autoTimer.com
avast! WebRep
7.0.1474
true
wrc@avast.com
Beef Taco (Targeted Advertising Cookie Opt-Out)
1.3.7
true
john@velvetcache.org
BrowserProtect
1.1.3
true
browserprotect@browserprotect.com
Customizations for Adblock Plus
1.0.3
true
customization@adblockplus.org
Element Hiding Helper for Adblock Plus
1.2.3
true
elemhidehelper@adblockplus.org
FFXI Helper
2.1
true
{89c9e067-2605-4f75-a608-f6ea31c9d085}
Firebug
1.10.6
true
firebug@software.joehewitt.com
FireFTP
2.0.7
true
{a7c6cf7f-112c-4500-a7ea-39801a327e5f}
firefusk
1.91
true
{fffe0eac-3819-4561-8aa9-178a68450d4f}
Flash and Video Download
1.21
true
{bee6eb20-01e0-ebd1-da83-080329fb9a3a}
FoxClocks
3.1.26
true
{d37dc5d0-431d-44e5-8c91-49419370caa1}
Google Translator for Firefox
2.1.0.3
true
translator@zoli.bod
HttpFox
0.8.11
true
{4093c4de-454a-4329-8aff-c6b0b123c386}
iMacros for Firefox
7.6.0.2
true
{81BF1D23-5F17-408D-AC6B-BD6DF7CAF670}
IP Address and Domain Information
1.0
true
jid0-jJRRRBMgoShUhb07IvnxTBAl29w@jetpack
linkcheck
0.7.6
true
jid1-xB90rdBtLVMKKg@jetpack
LinkChecker
0.6.7
true
{49f3fc85-dcfe-4e42-9301-226ebe658509}
Linky
3.0.0
true
linky@gemal.dk
Memory Restart
1.11
true
memoryrestart@teamextension.com
Password Exporter
1.2.1
true
{B17C1C5A-04B1-11DB-9804-B622A1EF5492}
Password Reuse Visualizer
0.12
true
jid1-bOHVlh4oBvBc7A@jetpack
Protect-Access Free
2.81
true
{68bb078e-8477-41df-b016-118f0482ab60}
Remember Passwords
1.0.2
true
remember-passwords@stanimir-stamenkov.addons.mozilla.org
Remove Google Tracking
1.6
true
jid0-DpogclPgnN9OvqNntEBbPZxBinY@jetpack
ResizeIT
3.6.2
true
resizeit@sonej
RS+MU Downloader
2.4.1
true
rsDownloader@163.com
Search By Image (by Google)
1.1.1
true
{ce7e73df-6a44-4028-8079-5927a588c948}
Show my Password
2.0
true
{cd617372-6743-4ee4-bac4-fbf60f35719e}
Show Password
1.7
true
showpassword@pratikpoddar
Stop YouTube Autoplay
1.0.3
true
jid0-Pm0nbsggUvL00CBoW6YwCaqv8bk@jetpack
StumbleUpon
4.15
true
{AE93811A-5C9A-4d34-8462-F7B864FC4696}
Tab in Textarea
0.10.2
true
{df9815d2-ca91-4e8f-aaa3-066d1de2c7a2}
Tab Scope
1.1.7
true
tabscope@xuldev.org
Tab Utilities
1.2
true
tabutils@ithinc.cn
TACO with Abine
4.49
true
optout@dubfire.net
Text Link
4.0.2011021601
true
{54BB9F3F-07E5-486c-9B39-C7398B99391C}
Textarea Cache
0.8.8
true
{578e7caa-210f-4967-a0d3-88fe5b59a39f}
TrackMeNot
0.6.728
true
trackmenot@mrl.nyu.edu
TryAgain
3.4.6
true
{992791ee-61dc-7b98-a8fd-dc49b7deeee9}
WorldIP
2.2.0
true
{f36c6cd1-da73-491d-b290-8fc9115bfa55}
Xmarks
4.1.3
true
foxmarks@kei.com
Important Modified Preferences
Name
Value
accessibility.blockautorefresh
true
accessibility.typeaheadfind
true
accessibility.typeaheadfind.flashBar
0
browser.cache.disk.capacity
1048576
browser.cache.disk.smart_size.first_run
false
browser.cache.disk.smart_size_cached_value
880640
browser.cache.memory.capacity
-1
browser.places.smartBookmarksVersion
4
browser.search.openintab
true
browser.search.suggest.enabled
false
browser.sessionstore.max_tabs_undo
100
browser.sessionstore.restore_on_demand
false
browser.startup.homepage
http://ac9dfe7fd.livejournal.com/|http://blachubear.livejournal.com/|http://www.cnn.com/|http://community.livejournal.co…
browser.startup.homepage_override.buildID
20121024073032
browser.startup.homepage_override.mstone
16.0.2
browser.tabs.loadBookmarksInBackground
true
browser.tabs.loadDivertedInBackground
true
browser.tabs.loadFolderAndReplace
false
browser.tabs.warnOnClose
false
browser.tabs.warnOnOpen
false
extensions.lastAppVersion
16.0.2
network.cookie.prefsMigrated
true
network.http.max-persistent-connections-per-server
8
network.http.pipelining
true
network.http.pipelining.maxrequests
64
network.http.proxy.pipelining
true
network.http.request.max-start-delay
1
places.database.lastMaintenance
1354131953
places.history.expiration.transient_current_max_pages
104858
places.history.expiration.transient_optimal_database_size
167772160
privacy.donottrackheader.enabled
true
privacy.sanitize.migrateFx3Prefs
true
security.warn_viewing_mixed
false
Graphics
Adapter Description
NVIDIA GeForce 8800 GT
Vendor ID
0x10de
Device ID
0x0611
Adapter RAM
512
Adapter Drivers
nvd3dumx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um
Driver Version
9.18.13.697
Driver Date
10-2-2012
Direct2D Enabled
true
DirectWrite Enabled
true (6.1.7601.17789)
ClearType Parameters
ClearType parameters not found
WebGL Renderer
Google Inc. -- ANGLE (NVIDIA GeForce 8800 GT ) -- OpenGL ES 2.0 (ANGLE 1.0.0.1041)
GPU Accelerated Windows
1/1 Direct3D 10
AzureBackend
direct2d
JavaScript
Incremental GC
1
Accessibility
Activated
0
Prevent Accessibility
0
Library Versions
Expected minimum version
Version in use
NSPR
4.9.2
4.9.2
NSS
3.13.6.0 Basic ECC
3.13.6.0 Basic ECC
NSS Util
3.13.6.0
3.13.6.0
NSS SSL
3.13.6.0 Basic ECC
3.13.6.0 Basic ECC
NSS S/MIME
3.13.6.0 Basic ECC
3.13.6.0 Basic ECC

Gingerbread Man 403 izisombululo 1537 izimpendulo
Kuphostiwe

You can either send

Either way, the end result is the same: Firefox starts if it wasn't already running, and the links open each in a separate tab.

From your description, it sounds like you're doing the following instead.

This causes Firefox to start if it wasn't already running, open a new tab with Wikipedia in it in the main window, then open a new window with the remaining links, each in their own tab.


To use a batch file to check if Firefox is running,

tasklist /fi "IMAGENAME eq firefox.exe" 2>NUL | find /i /n "firefox.exe">NUL / if %ERRORLEVEL%==1 goto nofirefox

Where the :nofirefox section of your batch file performs whatever actions you want in that case.

You can either send * Several ''firefox.exe '''-new-tab''' http://en.wikipedia.org'' commands. * Or you can send a single ''firefox.exe '''-new-tab''' http://en.wikipedia.org '''-new-tab''' http://wiki.mozilla.org '''-new-tab''' http://blog.mozilla.org'' command. Either way, the end result is the same: Firefox starts if it wasn't already running, and the links open each in a separate tab. From your description, it sounds like you're doing the following instead. * Sending a single ''firefox.exe '''-new-tab''' http://en.wikipedia.org http://wiki.mozilla.org http://blog.mozilla.org'' command. This causes Firefox to start if it wasn't already running, open a new tab with Wikipedia in it in the main window, then open a new window with the remaining links, each in their own tab. ---- To use a batch file to check if Firefox is running, <pre><nowiki>tasklist /fi "IMAGENAME eq firefox.exe" 2>NUL | find /i /n "firefox.exe">NUL / if %ERRORLEVEL%==1 goto nofirefox</nowiki></pre> Where the ''':nofirefox''' section of your batch file performs whatever actions you want in that case.

Umnikazi wombuzo

Hello and thank you for your reply,

Now I wish I hadn't "cleaned" up my question to make it easier to read, but instead included examples. In my case, the initial firefox.exe command I used was:

cmd /C start "FFXI Firefox" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -new-tab "http://wiki.ffxiclopedia.org/wiki/Main_Page" -new-tab "http://wiki.ffxiclopedia.org/wiki/Category:Combat_Skills" -new-tab "file:///C:/Users/Bertram Moshier/Programs/FFXI/FFXI_Skill_Caps.html" -new-tab "http://wiki.ffxiclopedia.org/wiki/Skill_Ups:_A_Guide_by_Kyrial" -new-tab "http://www.mithrapride.org/vana_time/" -new-tab "http://wiki.ffxiclopedia.org/wiki/Dragoon" "http://ffxi.somepage.com/mobdb/" -new-tab "http://www.ffxiah.com/item/4558/yagudo-drink" -new-tab "http://greatbigsea.guildlaunch.com/forums/index.php?gid=108403" -new-tab "http://guildwork.com/games/ffxi/shouts"

As you can see in this version I put "-new-tab" in front of each URL and the result, since firefox version 9.0.1 has been:

1) If firefox.exe is fully up and running a tab for each URL opens in one window. 2) If firefox.exe is not fully up and running a window for each URL opens with only one tab.

So, ah, I have been trying the -new-tab method from the start. Recently, I tried removing the -new-tab and it has been working, but I think that is more of a fluke than correctly working, as it goes against the documentation.

As for tell if firefox is up and running, thanks! I've been using the following code, which is similar to yours. What I found, though, is simply having firefox.exe up and running in advance (or starting it) is NOT enough. Like your code, mine, tells if it is running in the Window's tasklist. Yet, my experience, thus far, has been until the firefox window appears, you still get the multiple windows for each "-new-tab" you send. Only if firefox.exe is already FULLY up and running with its windows visible does the "-new-tab" work per the documentation.

Here is the core code I've been using (using REXX) -- this is static code on the URL and not the XML configuration version.

NOTE: I think it is basically the same as your code, but longer . . . . My hope was the code would wait till firefox would be up enough for the "-new-tab" to work, which I find to be between 8 and 15 seconds depending upon the system. Again what I discovered is simply having the tasklist command show firefox.exe running is NOT enough. Well, this is true on my Windows 7 x64 system (Firefox 9.0.1 - 16)

firefox_found = 0

FFXI_Website_Queue = 'FFXI_Website' rc = rxqueue('delete',FFXI_Website_Queue) rc = rxqueue('create',FFXI_Website_Queue) rc = rxqueue('set',FFXI_Website_Queue)

rc = !!Firefox_Exists() if rc = 0 then do

 'cmd /C start /D "C:\Program Files (x86)\Mozilla Firefox\" "FFXI Firefox" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"'
 rc = 0
 do until rc = 1
   rc = !!Firefox_Exists()
   call SysSleep(1)
   end
 end

'cmd /C start "FFXI Firefox" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -new-tab "http://wiki.ffxiclopedia.org/wiki/Main_Page" -new-tab "http://wiki.ffxiclopedia.org/wiki/Category:Combat_Skills" -new-tab "file:///C:/Users/Bertram Moshier/Programs/FFXI/FFXI_Skill_Caps.html" -new-tab "http://wiki.ffxiclopedia.org/wiki/Skill_Ups:_A_Guide_by_Kyrial" -new-tab "http://www.mithrapride.org/vana_time/" -new-tab "http://wiki.ffxiclopedia.org/wiki/Dragoon" -new-tab "http://ffxi.somepage.com/mobdb/" -new-tab "http://www.ffxiah.com/item/4558/yagudo-drink" -new-tab "http://greatbigsea.guildlaunch.com/forums/index.php?gid=108403" -new-tab "http://guildwork.com/games/ffxi/shouts"'

rc = rxqueue('delete',FFXI_Website_Queue) call !!EOJ 0

/* >>>>>>>>>>>>>>>>>>>> Insert your subroutines here <<<<<<<<<<<<<<<<<<<< */

/*------------------------------------------------------------------------*\ | | | Subroutine section | | | \*------------------------------------------------------------------------*/ !!Firefox_Exists: 'tasklist /V /FI "IMAGENAME eq firefox.exe" | RxQueue' FFXI_Website_Queue '/FIFO'

do while queued() <> 0

 parse pull Image_Name PID Session_Name Session_Number Memory_Usage Status User_Name CPU_Time Window_Title
 if Image_Name = 'firefox.exe' then do
   firefox_found = 1
   leave
   end
 end

return firefox_found

Hello and thank you for your reply, Now I wish I hadn't "cleaned" up my question to make it easier to read, but instead included examples. In my case, the initial firefox.exe command I used was: cmd /C start "FFXI Firefox" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -new-tab "http://wiki.ffxiclopedia.org/wiki/Main_Page" -new-tab "http://wiki.ffxiclopedia.org/wiki/Category:Combat_Skills" -new-tab "file:///C:/Users/Bertram Moshier/Programs/FFXI/FFXI_Skill_Caps.html" -new-tab "http://wiki.ffxiclopedia.org/wiki/Skill_Ups:_A_Guide_by_Kyrial" -new-tab "http://www.mithrapride.org/vana_time/" -new-tab "http://wiki.ffxiclopedia.org/wiki/Dragoon" "http://ffxi.somepage.com/mobdb/" -new-tab "http://www.ffxiah.com/item/4558/yagudo-drink" -new-tab "http://greatbigsea.guildlaunch.com/forums/index.php?gid=108403" -new-tab "http://guildwork.com/games/ffxi/shouts" As you can see in this version I put "-new-tab" in front of each URL and the result, since firefox version 9.0.1 has been: 1) If firefox.exe is fully up and running a tab for each URL opens in one window. 2) If firefox.exe is not fully up and running a window for each URL opens with only one tab. So, ah, I have been trying the -new-tab method from the start. Recently, I tried removing the -new-tab and it has been working, but I think that is more of a fluke than correctly working, as it goes against the documentation. As for tell if firefox is up and running, thanks! I've been using the following code, which is similar to yours. What I found, though, is simply having firefox.exe up and running in advance (or starting it) is NOT enough. Like your code, mine, tells if it is running in the Window's tasklist. Yet, my experience, thus far, has been until the firefox window appears, you still get the multiple windows for each "-new-tab" you send. Only if firefox.exe is already FULLY up and running with its windows visible does the "-new-tab" work per the documentation. Here is the core code I've been using (using REXX) -- this is static code on the URL and not the XML configuration version. NOTE: I think it is basically the same as your code, but longer . . . . My hope was the code would wait till firefox would be up enough for the "-new-tab" to work, which I find to be between 8 and 15 seconds depending upon the system. Again what I discovered is simply having the tasklist command show firefox.exe running is NOT enough. Well, this is true on my Windows 7 x64 system (Firefox 9.0.1 - 16) firefox_found = 0 FFXI_Website_Queue = 'FFXI_Website' rc = rxqueue('delete',FFXI_Website_Queue) rc = rxqueue('create',FFXI_Website_Queue) rc = rxqueue('set',FFXI_Website_Queue) rc = !!Firefox_Exists() if rc = 0 then do 'cmd /C start /D "C:\Program Files (x86)\Mozilla Firefox\" "FFXI Firefox" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"' rc = 0 do until rc = 1 rc = !!Firefox_Exists() call SysSleep(1) end end 'cmd /C start "FFXI Firefox" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -new-tab "http://wiki.ffxiclopedia.org/wiki/Main_Page" -new-tab "http://wiki.ffxiclopedia.org/wiki/Category:Combat_Skills" -new-tab "file:///C:/Users/Bertram Moshier/Programs/FFXI/FFXI_Skill_Caps.html" -new-tab "http://wiki.ffxiclopedia.org/wiki/Skill_Ups:_A_Guide_by_Kyrial" -new-tab "http://www.mithrapride.org/vana_time/" -new-tab "http://wiki.ffxiclopedia.org/wiki/Dragoon" -new-tab "http://ffxi.somepage.com/mobdb/" -new-tab "http://www.ffxiah.com/item/4558/yagudo-drink" -new-tab "http://greatbigsea.guildlaunch.com/forums/index.php?gid=108403" -new-tab "http://guildwork.com/games/ffxi/shouts"' rc = rxqueue('delete',FFXI_Website_Queue) call !!EOJ 0 /* >>>>>>>>>>>>>>>>>>>> Insert your subroutines here <<<<<<<<<<<<<<<<<<<< */ /*------------------------------------------------------------------------*\ | | | Subroutine section | | | \*------------------------------------------------------------------------*/ !!Firefox_Exists: 'tasklist /V /FI "IMAGENAME eq firefox.exe" | RxQueue' FFXI_Website_Queue '/FIFO' do while queued() <> 0 parse pull Image_Name PID Session_Name Session_Number Memory_Usage Status User_Name CPU_Time Window_Title if Image_Name = 'firefox.exe' then do firefox_found = 1 leave end end return firefox_found
Gingerbread Man 403 izisombululo 1537 izimpendulo
Kuphostiwe

Bertram_Moshier wrote:

Only if firefox.exe is already FULLY up and running with its windows visible [...]

I'm pretty sure a simple batch file can't check if the Firefox window is visible, only if the process is running. If you're launching Firefox via the batch file as well, you can add a 15-second delay with timeout /t 15 /nobreak

Bertram_Moshier wrote:

cmd /C start

That's why you get separate windows. When launching firefox.exe directly, it behaves normally. The /b parameter of the start command doesn't help, so I have no suggestions for making your particular method work.

If you detail your exact requirements, we may be able to suggest a different way to do what you want. As it is, I don't see what you have to gain from this convoluted command line method.
If the point is just to open several sites in separate tabs, you can bookmark all the sites into a single folder, then place that folder on the Bookmarks Toolbar. It would then take you 1 left-click on the Firefox icon to launch it, and 1 middle-click on the folder on the Bookmarks Toolbar to open all those bookmarks in separate tabs.

''Bertram_Moshier wrote:'' Only if firefox.exe is already FULLY up and running with its windows visible [...] I'm pretty sure a simple batch file can't check if the Firefox window is visible, only if the process is running. If you're launching Firefox via the batch file as well, you can add a 15-second delay with ''timeout /t 15 /nobreak'' ''Bertram_Moshier wrote:'' cmd /C start That's why you get separate windows. When launching ''firefox.exe'' directly, it behaves normally. The '''/b''' parameter of the ''start'' command doesn't help, so I have no suggestions for making your particular method work. If you detail your exact requirements, we may be able to suggest a different way to do what you want. As it is, I don't see what you have to gain from this convoluted command line method.<br> If the point is just to open several sites in separate tabs, you can bookmark all the sites into a single folder, then place that folder on the Bookmarks Toolbar. It would then take you 1 left-click on the Firefox icon to launch it, and 1 middle-click on the folder on the Bookmarks Toolbar to open all those bookmarks in separate tabs.