Jump to content

Recommended Posts

Posted

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...

 

mozilla.jpg

Posted

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

 

Posted

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...
 

 

Profile.jpg

yes.jpg

No.jpg

Posted

@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)

 

Posted

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. B) 

error.jpg

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...