Jump to content

Recommended Posts

Posted (edited)

After getting this little function working, I forgot why I was making it.

I use the term "working" lightly, as I've only tried it on my own machine under Win7 32 bit and I little unsure if it works on other setups

I know its not the greatest code and would probably be better with a RegExp, but I'm extremely poor at them.

Thanks to the folks

Improvements and or suggestions are most welcome, I'm already thinking about expanding it to work with other browsers, and perhaps detect the default browser or all open browsers and so forth.

;==================================================================
;Returns an array of open tab urls,
;[0] contains the count of open tabs
;[n] contains the urls
;==================================================================

#include <Array.au3>
#include <String.au3>
#include <File.au3>

$aTabs = _CurrentFFTabs()
_ArrayDisplay($aTabs)

Func _CurrentFFTabs()
    Local $aRtn[1]
    $sPath = @AppDataDir & "\Mozilla\Firefox\Profiles\"
    $aFolder = _FileListToArray($sPath, "*.default", 2)
    $sFolder = $aFolder[1]
    $sFile = FileRead($sPath & $sFolder & "\sessionstore.js")
    $sFile = StringLeft($sFile, StringInStr($sFile, "_closedTabs"))
    $stmp = StringStripWS($sFile, 8)
    $atmp = StringSplit($stmp, '_formDataSaved', 3)
    ReDim $aRtn[UBound($atmp)]
    $aRtn[0] = UBound($atmp) -1
    For $i = 0 To UBound($atmp) - 2
        $atmp2 = _StringBetween($atmp[$i], '"url":"', '","title')
        $aRtn[$i+1] = $atmp2[UBound($atmp2) - 1]
    Next
    Return $aRtn
EndFunc   ;==>_CurrentFFTabs

EDIT: forgot include

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

Using XP Pro SP3 and FF v6.0 I get

Row Col

[0] 0

:mellow:

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted (edited)

_formDataSaved problem, its not in that file (probably its only for xp)

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Posted (edited)

ofc folder and file is located, but i cant locate the _formDataSaved in that file

i reedited the code from chat heare, this works for me on XP

#include <Array.au3>
#include <String.au3>
#include <File.au3>

$aTabs = _CurrentFFTabs()
_ArrayDisplay($aTabs)

Func _CurrentFFTabs()
    $aFolder = _FileListToArray(@AppDataDir & "\Mozilla\Firefox\Profiles\", "*.default", 2)
    $sFile = FileRead(@AppDataDir & "\Mozilla\Firefox\Profiles\" & $aFolder[1] & "\sessionstore.js")
    $TabsCount = StringSplit($sFile,'{"entries":[',1)
    Local $arrReturn[1]
    For $x = 2 To $TabsCount[0]
        $sometab = _StringBetween($TabsCount[$x], '{"url":"', '","title"')
        If IsArray($sometab) Then
            _ArrayAdd($arrReturn, $sometab[UBound($sometab) - 1])
            If StringInStr($TabsCount[$x],"_closedTabs") Then
                $arrReturn[0] = $x- 1
                Return $arrReturn
            EndIf
        Else
            MsgBox(0,"Error","Pages probably in the loading-opening process")
            Return
        EndIf
    Next
EndFunc

edit removed some lines that did not do anything

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Posted

That is better because its also working on Win 7.

Good stuff.

There is no sessionstore.js file in AppData for me. (FF V6.0)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted (edited)

strange, can you hit windows search for it and tell where and if it finde it?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Posted

strange, can you hit windows search for it and tell where and if it finde it?

There is no file called sessionstore.js on my PC.

There is no file with a name containing "session" that is connected with Firefox, nor a file name containing "store" that is connected to Firefox.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

Looks like this whole thing is doomed.

I turned my attentions to Internet Explorer

Found that their version is stored in appdata\local\microsoft\Internet explorer\recovery[\active[\last active]]{guid}.dat

Unfortunately you cannot access it while its in use.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

  • 2 weeks later...
Posted (edited)

It works on ws 2008,xp32,w732

sessionstore.js is in cache folder

Still if i open few tabs in one window and open another window i cant see all urls.Geting tabs from IE is easy i found somewhere around few lines

#include <IE.au3>
Global $avArray[500]
Dim $aIE[1]
$aIE[0] = 0
$i = 1
While 1
$oIE = _IEAttach("", "instance", $i)
If @error = $_IEStatus_NoMatch Then ExitLoop
ReDim $aIE[$i + 1]
$aIE[$i] = $oIE
$aIE[0] = $i
$i += 1
$avArray[$i - 1] = $oIE.LocationURL
WEnd
$avArray[0] = $i - 1
For $s = 1 To $avArray[0]
MsgBox(0, "IE url " & $s & " of " & $avArray[0], $avArray[$s])
Next
If $avArray[0] = 0 Then MsgBox(0, "error", "no urs found,make sure you have some url opened in IE")
Edited by BiBiBi
  • 1 month later...
Posted

Heya, I tryed out

#include 
#include 
#include 

$aTabs = _CurrentFFTabs()
_ArrayDisplay($aTabs)

Func _CurrentFFTabs()
    $aFolder = _FileListToArray(@AppDataDir & "\Mozilla\Firefox\Profiles\", "*.default", 2)
    $sFile = FileRead(@AppDataDir & "\Mozilla\Firefox\Profiles\" & $aFolder[1] & "\sessionstore.js")
    $TabsCount = StringSplit($sFile,'{"entries":[',1)
    Local $arrReturn[1]
    For $x = 2 To $TabsCount[0]
        $sometab = _StringBetween($TabsCount[$x], '{"url":"', '","title"')
        If IsArray($sometab) Then
            _ArrayAdd($arrReturn, $sometab[UBound($sometab) - 1])
            If StringInStr($TabsCount[$x],"_closedTabs") Then
                $arrReturn[0] = $x- 1
                Return $arrReturn
            EndIf
        Else
            MsgBox(0,"Error","Pages probably in the loading-opening process")
            Return
        EndIf
    Next
EndFunc

On Windows 7 Proffesional N - Firefox 7.0.1 and it seams to detect the open tabs correctly "though crashes a bit if i have about:home open :graduated:"

I played around with the code for a hour or two with no luck but is there a way to get this functionaility from that code

if $a=1 and firefox > more then 1 tab then

switch tab

else $=a and firefox > 1 tab switch back to orginal tab

Posted

I played around with the code for a hour or two with no luck but is there a way to get this functionaility from that code

if $a=1 and firefox > more then 1 tab then

switch tab

else $=a and firefox > 1 tab switch back to orginal tab

You would probably need the FF.au3 UDFs with MozRepl installed for that sort of thing.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted (edited)

hmmm i am never a big fan of installing extra software and trying to understand the ff.au3 is prob out of my level atm so for the time being i will prob scale back my idea to something simplier

Is there any way from that code i could detect if more then 1 tab is open

if firefox > 1 tab then

send "crtl+tab"

else

minimize

endif

As the code above lists how many tabs there are open but i couldn't figure out how to use that information for my if statement

P.S Small idea i had in the array box it stores 2 peices of information, a node number and the site address. Could i set it up to detect a address and if it does then remember the node number "is 3". So when it comes to switching back assuming no other websites have been closed i could send-keys "ctrl+tab" node number - 1

Edited by IanN1990

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...