#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=WL_ico.ico #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; los comentarios empiezan por signo ";" no son fin de sentencia como en Java ; autor Aníbal Álvarez Álvarez ; fecha creación: 21-09-18 #include #include #include #include #include #include #include #include #include #include Local $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":false}}' Local Const $sMessage = "Selecciona un fichero TXT." ; MsgBox($MB_SYSTEMMODAL,"",@ScriptDir & @CRLF &_WinAPI_GetCurrentDirectory()) Global $sFile ; Create GUI Global $hGUI = GUICreate("(Pega aquí tu) Listado de páginas web", 1000, 800) Global $idEdit = _GUICtrlEdit_Create($hGUI,"https://www.biomedcentral.com", 2, 2, 1000, 700) _GUICtrlEdit_AppendText($idEdit,@CRLF & 'https://www.reference.com') _GUICtrlEdit_AppendText($idEdit,@CRLF & 'http://www.oup.com') _GUICtrlEdit_AppendText($idEdit,@CRLF & 'https://www.ssa.gov') _GUICtrlEdit_AppendText($idEdit,@CRLF & 'https://www.libsyn.com') _GUICtrlEdit_AppendText($idEdit,@CRLF & 'https://www.windowsphone.com') _GUICtrlEdit_AppendText($idEdit,@CRLF & 'https://www.ny.gov') _GUICtrlEdit_AppendText($idEdit,@CRLF & 'https://www.bigcommerce.com') _GUICtrlEdit_AppendText($idEdit,@CRLF & 'https://www.oreilly.com') _GUICtrlEdit_AppendText($idEdit,@CRLF & 'http://www.domeneshop.no') _GUICtrlEdit_AppendText($idEdit,@CRLF & 'http://www.artisteer.com') _GUICtrlEdit_AppendText($idEdit,@CRLF & 'https://www.arxiv.org') $hStatusBar = _GUICtrlStatusBar_Create($hGUI, -1) _GUICtrlStatusBar_SetIcon($hStatusBar, 0, 97, "shell32.dll") _GUICtrlStatusBar_SetText($hStatusBar, @TAB & "Lines: " & _GUICtrlEdit_GetLineCount($idEdit)) Global $idButton = GUICtrlCreateButton("Abrir links", 10, 720, 250) GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on this button Global $idButton2 = GUICtrlCreateButton("Cargar links desde archivo", 300, 720, 250) GUISetState(@SW_SHOW) Do $idMsg = GUIGetMsg() If $idMsg = $idButton Then SetupGecko() Firefox() EndIf If $idMsg = $idButton2 Then FileLoad() EndIf Until $idMsg = $GUI_EVENT_CLOSE Func FileLoad() ; Create a constant variable in Local scope of the message to display in FileOpenDialog. Local Const $sMessage = "Selecciona un fichero TXT que contenga links web." Local $sFileOpenDialog = FileOpenDialog($sMessage, _WinAPI_GetCurrentDirectory() & "\", "Archivo de texto (*.txt)", $FD_FILEMUSTEXIST) If @error Then MsgBox($MB_SYSTEMMODAL, "", "No se ha selecionado ningún fichero.") FileChangeDir(@ScriptDir) Else FileChangeDir(@ScriptDir) $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF) _GUICtrlEdit_SetText($idEdit, FileRead($sFileOpenDialog)) _GUICtrlStatusBar_SetText($hStatusBar, @TAB & "Lines: " & _GUICtrlEdit_GetLineCount($idEdit)) EndIf EndFunc ;==>FileLoad Func Firefox() $sFFPid = _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, _GUICtrlEdit_GetLine($idEdit, 0)) Local $total = _GUICtrlEdit_GetLineCount($idEdit) For $x = 1 To $total-1 Step +1 _WD_NewTab($sSession,'true') _WD_Navigate($sSession, _GUICtrlEdit_GetLine($idEdit, $x)) Next EndFunc ;==>Firefox Func SetupGecko() _WD_Option('Driver', _WinAPI_GetCurrentDirectory() & '\geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) EndFunc ;==>SetupGecko