Sanchopanza888 Posted May 16, 2017 Share Posted May 16, 2017 Hi guys, i expect you´re ok. I have a profile in mozilla firefox that iniciates some tabs automatically. I need to open and close it. i tried with the library ff.au3 but it opens a new tab or window. when i run it must open all the configuration i have in the mozilla start and close everything after i finish my work. Anyone can help me? this is my scrip. i also want i askme if i want to close or no because is a part of other process. #include <Constants.au3> #include <GUIConstants.au3> #include <FF.au3> Switch MsgBox($MB_YESNO, 'Whoa', 'What to do?') Case $IDYES MsgBox(0, 'You pressed...', 'Yes! How cool for you!') _ffstart () Case $IDNO MsgBox(0, 'You pressed...', 'No! How cool for you!') _FFWindowclose() EndSwitch thanks in advance... Link to comment Share on other sites More sharing options...
Danp2 Posted May 16, 2017 Share Posted May 16, 2017 You need to call _FFStart with the correct parameters if you want it to use a specific profile. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Sanchopanza888 Posted May 17, 2017 Author Share Posted May 17, 2017 thanks Danp2, but how can i type the profile? i read; #Include <FF.au3>_FFStart([$sURL = "about:blank"[, $sProfile = "default"[, $iMode = 1[, $bHide = False[, $IP = "127.0.0.1"[, $iPort = 4242]]]]]]) " and i type; _ffstart ("https://gestion-avon.e-pagos.cl/portal/index", "hub") -> "Hub" is my profile name. But it still does not work. I need to open every tab of the profile. Moreover, to close mozilla with every tab it (_FFWindowclose()) must be follow for _ffstar () and i want to decide if i want to close or no the window already open. . I refer to this part; Case $IDNO MsgBox(0, 'You pressed...', 'No! How cool for you!') _FFWindowclose() I know that the question must be silly but I am a beginner, thanks for the help you can give me ... it is my scrip: #include <Constants.au3> #include <GUIConstants.au3> #include <FF.au3> Switch MsgBox($MB_YESNO, 'Hi Samuel', 'Do you want to open mozilla?') Case $IDYES MsgBox(0, 'You pressed...', 'Yes! How cool for you!') _ffstart ("https://gestion-avon.e-pagos.cl/portal/index", "hub") Case $IDNO MsgBox(0, 'You pressed...', 'No! How cool for you!') _FFWindowclose() EndSwitch Link to comment Share on other sites More sharing options...
Danp2 Posted May 17, 2017 Share Posted May 17, 2017 It looks like there's still a bug in FF.au3 that is preventing FF from opening with the designated profile. Sanchopanza888 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Sanchopanza888 Posted May 17, 2017 Author Share Posted May 17, 2017 Danp2 do you know another way to open and close mozilla with a specific profile? any advice? thanks for your time.... Link to comment Share on other sites More sharing options...
Danp2 Posted May 17, 2017 Share Posted May 17, 2017 You can manually launch FF with the proper parameters -- Run('"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "-repl 4242" -P "hub"') or you could try fixing the line in FF.au3 so the the quotations are in the correct location. Sanchopanza888 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted May 18, 2017 Share Posted May 18, 2017 Try this updated version of FF.au3 and let me know if it works better for you. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Sanchopanza888 Posted May 18, 2017 Author Share Posted May 18, 2017 Danp2 hi my friend, thanks so much, i called ff2.au3 the Updated library you give me. When i run the scrip; #include <Constants.au3> #include <GUIConstants.au3> #include <FF2.au3> Switch MsgBox($MB_YESNO, 'Hi Sancho', 'Do you want to open mozilla?') Case $IDYES MsgBox(0, 'You pressed...', 'Yes! How cool for you!') _ffstart ("https://gestion-avon.e-pagos.cl/portal/index", "hub") Case $IDNO Run('"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "-repl 4242" -P "hub"') MsgBox(0, 'You pressed...', 'No! How cool for you!') _FFWindowclose() EndSwitch It show me by selecting yes or no the picture profile.jpg. Yes: When i choose "yes" and then hub; it open mozilla but just the tab with url "https://gestion-avon.e-pagos.cl/portal/index". You can see it in the picture yes.jpg. No: When i choose "no" and then hub; it open mozilla with the profile's tab.You can see it in the picture no.jpg. Now both commands open mozilla thanks to your help. well the _ffstart command does not open the profile. But, 1) How could you i prevent me from asking which profile to open (profile.jpg)? 2) How could i close every tab of mozilla at once? i tried with "ProcessClose(firefox.exe)" but it does not close the window and with "WinClose" i have to type the title of the window and as i have many tabs open, this name is not the same always. Thanks once again... Link to comment Share on other sites More sharing options...
Danp2 Posted May 18, 2017 Share Posted May 18, 2017 @Sanchopanza888 The revised FF.au3 should be correctly opening the designated profile. However, it doesn't automatically display the default home pages. You have a couple of options -- 1) Wait until _FFStart is enhanced to allow for the default home pages to be displayed 2) Launch FF yourself using the Run command like earlier, and then use _FFWindowSelect and _FFTabSetSelected to select the desired tab. 3) Launch FF with _FFStart and then load the tabs yourself. You can read the homepage settings like this: _FFStart(Default, 'hub') ConsoleWrite("Home page = " & _FFPrefGet('browser.startup.homepage') & @CRLF) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted May 18, 2017 Share Posted May 18, 2017 1 hour ago, Sanchopanza888 said: How could i close every tab of mozilla at once? Did you try _FFQuit? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 18, 2017 Moderators Share Posted May 18, 2017 Moved to the appropriate forum, as the Dev forum very clearly states: Quote Do not create AutoIt-related topics here "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Sanchopanza888 Posted May 19, 2017 Author Share Posted May 19, 2017 Danp2 Thanks you my friend. the first part is almost finished. It is my scrip; #include <Constants.au3> #include <Excel.au3> #include <Word.au3> For $i = 1 To 11 ;Script here WinKill("[Class:XLMAIN]", "2017") WinKill("[Class:XLMAIN]", "reporte") WinKill("[Class:XLMAIN]", "Cartola") Next word() Func word() If WinExists("HUB - XX.XX.2017 00.00") Then WinActivate("HUB - XX.XX.2017 00.00") Send ("{CTRLDOWN}{q}{CTRLUP}") WinSetState ( "HUB", "", @SW_MINIMIZE) Else Global $Portal = "HUB - XX.XX.2017 00.00.docx" Global $oword = _Word_Create() Global $Doc = _Word_DocOpen($oWord, @ScriptDir & '\' & $portal) EndIf EndFunc excel() Func excel() If WinExists("Revisiones - Hub de Recaudación 1.2") Then WinActivate("Revisiones - Hub de Recaudación 1.2") WinWait("[Class:XLMAIN]", "Revisiones") Send ("{CTRLDOWN}{s}{CTRLUP}") WinSetState("[Class:XLMAIN]", "Revisiones", @SW_MAXIMIZE) Else Global $oExcel = _Excel_Open() If @error Then Exit MsgBox(16, "Excel UDF: _Excel_BookOpen Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Global $sFilePath = @ScriptDir & "\Otro\Revisiones - Hub de Recaudación 1.2.xlsm" ;This file should already exist If Not FileExists($sFilePath) Then MsgBox(16, '', 'Does NOT exists') Exit EndIf Global $oFilePath = _Excel_BookOpen ($oExcel, $sFilePath) WinActivate("Revisiones - Hub de Recaudación 1.2") WinWait("[Class:XLMAIN]", "Revisiones") WinSetState("[Class:XLMAIN]", "Revisiones", @SW_MAXIMIZE) EndIf EndFunc Question() Func Question() Switch MsgBox($MB_YESNO, 'Hi Samuel', 'Do you want to close n open mozilla?') Case $IDYES ProcessClose ("firefox.exe") Sleep(1000) Run('"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "-repl 4242" -P "hub"') Case $IDNO MsgBox(0, 'You pressed...', 'Termine la basura!') _FFWindowclose() EndSwitch Only a few times when i select "NO" I get the error that I put in the image, but otherwise it does what I want. Link to comment Share on other sites More sharing options...
Sanchopanza888 Posted May 19, 2017 Author Share Posted May 19, 2017 On 2017-5-17 at 9:50 AM, Sanchopanza888 said: _FFWindowclose() Danp2 it was the error. i delated it. 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