JohnOne Posted August 17, 2011 Share Posted August 17, 2011 (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 setupsI 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 ;==>_CurrentFFTabsEDIT: forgot include Edited August 17, 2011 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
martin Posted August 17, 2011 Share Posted August 17, 2011 Using XP Pro SP3 and FF v6.0 I get Row Col [0] 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. Link to comment Share on other sites More sharing options...
bogQ Posted August 17, 2011 Share Posted August 17, 2011 (edited) _formDataSaved problem, its not in that file (probably its only for xp) Edited August 17, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
JohnOne Posted August 17, 2011 Author Share Posted August 17, 2011 It was always a worry it wont work. , I dont have a windows XP to use either in VM I'm still using ff v3.6.18 as 4,5 break my scripts too Is the folder and file even there in in win xp? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
bogQ Posted August 17, 2011 Share Posted August 17, 2011 (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 August 17, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
JohnOne Posted August 17, 2011 Author Share Posted August 17, 2011 That is better because its also working on Win 7. Good stuff. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
martin Posted August 17, 2011 Share Posted August 17, 2011 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. Link to comment Share on other sites More sharing options...
bogQ Posted August 17, 2011 Share Posted August 17, 2011 (edited) strange, can you hit windows search for it and tell where and if it finde it? Edited August 17, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
martin Posted August 18, 2011 Share Posted August 18, 2011 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. Link to comment Share on other sites More sharing options...
JohnOne Posted August 18, 2011 Author Share Posted August 18, 2011 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. Link to comment Share on other sites More sharing options...
BiBiBi Posted August 30, 2011 Share Posted August 30, 2011 (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 September 6, 2011 by BiBiBi Link to comment Share on other sites More sharing options...
JohnOne Posted August 31, 2011 Author Share Posted August 31, 2011 Cant make much out of that code, where does $ufile come from. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
BiBiBi Posted September 6, 2011 Share Posted September 6, 2011 Sory abou that i edited code.Try it now Link to comment Share on other sites More sharing options...
JohnOne Posted September 6, 2011 Author Share Posted September 6, 2011 Ah, I see now, I didnt even think to use IE udf But was ultimately firefox I was after, as I use that mostly, but just cannot get into using the great udfs for it, with that extra install Thanks. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
IanN1990 Posted October 14, 2011 Share Posted October 14, 2011 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 " 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 Link to comment Share on other sites More sharing options...
jaberwacky Posted October 15, 2011 Share Posted October 15, 2011 After getting this little function working, I forgot why I was making it. For some reason this makes me giggle like a school girl. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
JohnOne Posted October 15, 2011 Author Share Posted October 15, 2011 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 thenswitch tabelse $=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. Link to comment Share on other sites More sharing options...
IanN1990 Posted October 15, 2011 Share Posted October 15, 2011 (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 October 15, 2011 by IanN1990 Link to comment Share on other sites More sharing options...
JohnOne Posted October 15, 2011 Author Share Posted October 15, 2011 $aTabs = _CurrentFFTabs() That returns an array (providing the file is present) and its first element holds the index count, so... $aTabs = _CurrentFFTabs() If $aTabs[0] > 1 Then ;...your code EndIf AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
IanN1990 Posted October 15, 2011 Share Posted October 15, 2011 thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now