Sign in to follow this  
Followers 0
Kreol2013

Creating a txt file with the URL from the address bar of any browser (exe, tray)

7 posts in this topic

Gentlemen, good morning

I will be very grateful for your help.

Need a script as exe and au3

1) Minimize to tray and live there, it is possible to disable the functionality without removing from the tray.

2) the ability to:

For one button (middle mouse button, or there F2):

- Select the URL from the address bar of your browser (any: Chrome, IE, Opera, Fox, Safary), the release does not necessarily allocate

- Copy the URL

- Insert a txt file where the script, either locally or in the cloud. (for each link a new line)

- Close the tab from which sucked URL.

'll Just immensely grateful for the executable exe

with HC. Anton

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

Welcome to autoit and the fourm :)

This is not a "make it that for me" forum, so please use the help file and the search form; I'm sure you will find what you need.

Come back when you will have something to work with.

Edit: Plus, we only work with scripts.

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

tell me if you can work the same way with the browser google chrome?

Dim $browsers[3][2]
$browsers[0][0] = 'IExplore'
$browsers[0][1] = '[CLASS:IEFrame]'
$browsers[1][0] = 'Firefox'
$browsers[1][1] = '[CLASS:MozillaWindowClass]'
$browsers[2][0] = 'Opera'
$browsers[2][1] = '[CLASS:OperaWindowClass]'
Edited by Kreol2013

Share this post


Link to post
Share on other sites

how to teach a script to work with google chrome

#include 
#include 
#include 
#include 

HotKeySet('{F2}', '_DD') ; на зажатие F2
_MouseSetOnEvent($MOUSE_WHEELDOWN_EVENT, '_DD') ; на зажатие средней кнопки

HotKeySet('{Esc}', '_WW') ; переключение

Global $x = 1
Dim $browsers[3][2]
$browsers[0][0] = 'IExplore'
$browsers[0][1] = '[CLASS:IEFrame]'
$browsers[1][0] = 'Firefox'
$browsers[1][1] = '[CLASS:MozillaWindowClass]'
$browsers[2][0] = 'Opera'
$browsers[2][1] = '[CLASS:OperaWindowClass]'

While 1
Sleep(30)
WEnd

Func _WW()
If $x = 1 Then
$x = 0
HotKeySet('{F2}')
_MouseSetOnEvent($MOUSE_WHEELDOWN_EVENT)
ToolTip('Выключено')
TrayTip('Выключено', 'Выключено', 5, 1)
Else
$x = 1
HotKeySet('{F2}', '_DD') ; на зажатие F2
_MouseSetOnEvent($MOUSE_WHEELDOWN_EVENT, '_DD') ; на зажатие средней кнопки
ToolTip('Включено')
TrayTip('Включено', 'Включено', 5, 1)
EndIf

EndFunc ;==>_WW

Func _DD()

$hWnd = WinGetHandle('[ACTIVE]', '')

For $i = 0 To UBound($browsers) - 1
If StringInStr($browsers[$i][1], _WinAPI_GetClassName($hWnd)) Then
$szRes = _DDEMLClient_RequestString($browsers[$i][0], 'WWW_GetWindowInfo', '0xFFFFFFFF', $CF_TEXT)
;ConsoleWrite('_DDEMLClient_RequestString(), error=' & @error & ', extended=' & @extended & @CRLF)
$url = StringSplit($szRes, '","', 1)
$url = StringTrimLeft($url[1], 1)
If $url <> '' Then

;MsgBox(0, $browsers[$i][0], $url)

$file = FileOpen('test.txt', 1)
FileWriteLine($file, $url & @CRLF)
FileClose($file)
EndIf
EndIf
Next

EndFunc ;==>_DD

Share this post


Link to post
Share on other sites

I'm back with the code and the silence.

Share this post


Link to post
Share on other sites

AFAIK, most, maybe even all, browsers accept ALT-D to highlight whatever's in the address bar, and CTRL-W to close tabs. Of course, the browser would probably have to have focus, maybe not though (ControlSend comes to mind..) Maybe this helps somehow?


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I have one close to what you want. Here's the AutoIt source for the BBSS part of the program

edit: how BBSS works is you make either chrome or FF browser the active window and hit the hotkey. It cycles through all the tabs saving each url to a text file. For more details see the Readme.txt in the zip download.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=BB.ico
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Description=Browser Bunch Session Save
#AutoIt3Wrapper_Res_Fileversion=1.0.2.0
#AutoIt3Wrapper_Res_LegalCopyright=2012 www.favessoft.com
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_Field=Productname|BBSS
#AutoIt3Wrapper_Res_Field=Productversion|1.02
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; *** Start added by AutoIt3Wrapper ***
#include <Constants.au3>
; *** End added by AutoIt3Wrapper ***
#include <Misc.au3>
#include <MilesAheadMisc.au3>
#include <TrayMenuEx.au3>

Const $ERROR_ALREADY_EXISTS = 183

If _Singleton("{C851C829-C263-49B6-A7D0-3987DFE73712}", 1) = 0 Then
If @error = $ERROR_ALREADY_EXISTS Then Exit
EndIf
AutoItSetOption("TrayMenuMode", 3)
TraySetClick(8)

;flag to prevent windows being open concurrently
Global $windowOpen = False
TraySetToolTip(_ScriptBaseName())
TrayCreateItem("")
$aboutitem = TrayCreateItem("About")
$downloaditem = TrayCreateItem("Visit Hotkey Page")
;$updateitem = TrayCreateItem("Check for Update")
TrayCreateItem("")
$donateitem = TrayCreateItem("Donate")
TrayCreateItem("")
$exititem = TrayCreateItem("Quit")
TrayItemSetState($aboutitem, $TRAY_DEFAULT)
TraySetToolTip("Browser Bunch Session Save")
Global $FFtag = " - Mozilla Firefox"
Global $CRtag = " - Chromium"
Global $iFileName = _ScriptIniFileName()
Global $BBsessionList = ""
Global $BBtitleList = ""
Global $BBsessionFile = IniRead($iFileName, "Settings", "URLFile", @ScriptDir & "BBSessionURLs.txt")
Global $BBtitleFile = IniRead($iFileName, "Settings", "TitleFile", @ScriptDir & "BBSessionTitles.txt")
Global $hotkey = IniRead($iFileName, "Settings", "hotkey", "^+{F10}")
Global $useFileSave = _IniBool(IniRead($iFileName, "Settings", "UseFileSaveDlg", True))
Global $saveTitles = _IniBool(IniRead($iFileName, "Settings", "SaveTitles", False))
If Not HotKeySet($hotkey, "_BBsessionSave") Then
_ShowError("Could Not assign " & $hotkey & " as the Hotkey : Aborting!")
EndIf
_WriteIni()
_ReduceMemory()

; Tray Message Loop

While 1
$msg = TrayGetMsg()
Select
Case $msg = 0
; do any polling here
ContinueLoop

Case $msg = $aboutitem
_About()
_ReduceMemory()

Case $msg = $downloaditem
_VisitHotkeyPage()
_ReduceMemory()

Case $msg = $donateitem
_Donate()
_ReduceMemory()

Case $msg = $exititem
_Quit()

EndSelect
WEnd

Func _BBsessionSave()
$BBsessionList = ""
$BBtitleList = ""
Local $clipSave = ClipGet()
Local $firstURL = "", $thisURL = "", $thisTitle = ""
Local $BBClass = _WinAPI_GetClassName(_WinAPI_GetForegroundWindow())
If $BBClass = "MozillaWindowClass" Or $BBClass = "Chrome_WidgetWin_0" Or $BBClass = "Chrome_WidgetWin_1" Then
ClipPut("")
Send("^l")
Sleep(10)
Send("^c")
Sleep(250)
$firstURL = ClipGet()
$BBsessionList &= $firstURL & @CRLF
If $saveTitles Then
$thisTitle = WinGetTitle("[Active]")
If StringRight($thisTitle, StringLen($FFtag)) = $FFtag Then
$thisTitle = StringLeft($thisTitle, StringLen($thisTitle) - StringLen($FFtag))
ElseIf StringRight($thisTitle, StringLen($CRtag)) = $CRtag Then
$thisTitle = StringLeft($thisTitle, StringLen($thisTitle) - StringLen($CRtag))
EndIf
$BBtitleList &= $thisTitle & @CRLF
EndIf

Do ; cycle thorugh tabs getting URLs

Send("^{Tab}")
Sleep(100)
ClipPut("")
Send("^l")
Sleep(250)
Send("^c")
Sleep(250)
$thisURL = ClipGet()
If $firstURL = $thisURL Then ExitLoop
$BBsessionList &= $thisURL & @CRLF

If $saveTitles Then
$thisTitle = WinGetTitle("[Active]")
If StringRight($thisTitle, StringLen($FFtag)) = $FFtag Then
$thisTitle = StringLeft($thisTitle, StringLen($thisTitle) - StringLen($FFtag))
ElseIf StringRight($thisTitle, StringLen($CRtag)) = $CRtag Then
$thisTitle = StringLeft($thisTitle, StringLen($thisTitle) - StringLen($CRtag))
EndIf
$BBtitleList &= $thisTitle & @CRLF
EndIf

Until 0 ; infinite loop

ClipPut($clipSave)
If $useFileSave Then
$BBsessionFile = FileSaveDialog("Save URL set to Text File", @ScriptDir, "Text Files (*.txt)", 18, $BBsessionFile)
If $saveTitles Then
$BBtitleFile = FileSaveDialog("Save Title set to Text File", @ScriptDir, "Text Files (*.txt)", 18, $BBtitleFile)
EndIf
EndIf
If $saveTitles And FileExists($BBtitleFile) Then FileDelete($BBtitleFile)
If FileExists($BBsessionFile) Then FileDelete($BBsessionFile)
If FileWrite($BBsessionFile, $BBsessionList) Then
_WriteIni()
_ShowUsage("Tab Session Saved to:" & @CRLF & $BBsessionFile, "", False)
Else
_ShowError("Error Writing File: " & $BBsessionFile, "", False)
EndIf
If $saveTitles Then
If FileWrite($BBtitleFile, $BBtitleList) Then
_ShowUsage("Tab Titles Saved to:" & @CRLF & $BBtitleFile, "", False)
Else
_ShowError("Error Writing File: " & $BBtitleFile, "", False)
EndIf
EndIf
EndIf
_ReduceMemory()
EndFunc ;==>_BBsessionSave

Func _About()
Local $about = " Browser Bunch Session Save "
$about &= FileGetVersion(@ScriptFullPath) & @CRLF & @CRLF
$about &= " Copyright (c) " & @YEAR & " www.FavesSoft.com" & @CRLF & @CRLF
$about &= "Press Hotkey " & $hotkey & " to Save Chrome or Firefox Session to File" & @CRLF & @CRLF
$about &= " ( Exit Program and Edit BBSS.ini File to change options )"
_ShowUsage($about, _ScriptBaseName(), False)
EndFunc ;==>_About

Func _VisitHotkeyPage()
ShellExecute("http://www.favessoft.com/hotkeys.html")
EndFunc ;==>_VisitHotkeyPage

Func _Donate()
ShellExecute("http://www.favessoft.com/donate.html")
EndFunc ;==>_Donate

Func _Quit()
Exit
EndFunc ;==>_Quit

Func _WriteIni()
IniWrite($iFileName, "Settings", "hotkey", $hotkey)
IniWrite($iFileName, "Settings", "URLFile", $BBsessionFile)
IniWrite($iFileName, "Settings", "UseFileSaveDlg", $useFileSave)
IniWrite($iFileName, "Settings", "SaveTitles", $saveTitles)
IniWrite($iFileName, "Settings", "TitleFile", $BBtitleFile)
EndFunc ;==>_WriteIni

I didn't include the source in the program download. So I posted here. You can get the rest of the Browser Bunch package here (search the page for Browser Bunch.)

The BBSS hotkey tray app should work with chrome and FF. You can use it as a starting point if you like.

The Readme.txt in the download has usage details.

Edited by MilesAhead

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0