Re: Multiple clipboard, with title and URL of web page
Posted: 02 Sep 2021, 12:42
Thanks for your effort!
Generated pdf-s are pretty cool!
Generated pdf-s are pretty cool!
Let's help each other out
https://www.autohotkey.com/boards/
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=92963
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
;#SingleInstance, Force
#Include WinClipAPI.ahk
#Include WinClip.ahk
#Include ViewHtml.ahk
#Persistent
;#InstallKeybdHook
;Menu, Tray, Icon,,, 1
;SetBatchLines, -1
ClipCount := 0
CorpusCount := 0
;FileDelete, Test.xml
if FileExist("HTMLTemp\Text1.html")
MsgBox, 4,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
ClipCount := CorpusCount
;MsgBox, %CorpusCount% - %ClipCount%
^F3::
;MsgBox, %Clipboard%
ClipTemp := Clipboard
;MsgBox, %ClipTemp%
clipboard := "" ;Empty clipboard
Send, ^c ;Copy text select
ClipWait
if Not Clipboard=ClipTemp
{
SoundPlay, Clipboard_Sound.mp3
TrayTip, Timed TrayTip, %Clipboard%, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1500
}
Else
{
SoundPlay, ambiguity2.mp3
TrayTip, Timed TrayTip, REPEATED CLIPBOARD!, 0x2, 0x10, 0x20
SetTimer, HideTrayTip, -1500
return
}
accData:= GetAccData()
FileAppend,
(
<body lang=ES link=blue vlink="#954F72" style='tab-interval:35.4pt;word-wrap:
break-word'>
<p style='margin:0cm'><b><span style='font-size:16.0pt;font-family:"Calibri",sans-serif;
color:#78230C'>Text extracted from:<o:p></o:p></span></b></p>
), % GetAvailableFileName("HTMLTemp\Text##.html"), CP65001
ClipCount++
aData := accData.1
FileaccData := "HTMLTemp\Name" ClipCount ".txt"
FileAppend, %aData%, %FileaccData%
;XmlTemp := "`t<" ClipCount " Name=""" accData.1 """ Type=""Item""/>`n"
;FileAppend, %XmlTemp%, temp.txt
Sleep 300
;MsgBox, %FilExists%
FilExists := "HTMLTemp\Text" ClipCount ".html"
myResult := "<p style='margin:0cm'><span style='font-size:16.0pt;font-family:Calibri,sans-serif;color:#78230C'><a href=" accData.2 ">" accData.1 "</a> <o:p></o:p></span></p>"
FileAppend, %myResult%, %FilExists%, CP65001
ClipboardGet_HTML( Data )
;ReplacedStr := StrReplace(Data, "Â", "")
FileAppend, %Data%, Temp.html
;FileAppend, %ReplacedStr%<br/>, Temp.html
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
Sleep 500
NameCopy := "HTMLTemp\Temp" ClipCount ".html"
FileCopy, TempPDF.html, %NameCopy%
RunWait, conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
CorpusCount++
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Return
+RButton::
FileDelete, SesionName.txt
Loop, %ClipCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
FileAppend, Exit Menu, SesionName.txt
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, Add, Button, x460 y%posy% w20 h20 w20 h20 hwndIcon, %A_Index%
Gui, Add, Button, x0 y%posy% w460 h20 vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "clip_formats.ico")
}
CoordMode, Mouse, Screen
MouseGetPos, xpos1, ypos1
HButton := ClipCount+1
Alto := 16.8*HButton
;Alto := % Floor(16.5*HButton)
;Alto := % Floor(16*ClipCount)
Gui, Show, x%xpos1% y%ypos1% w476 h%Alto%, Window-Title
Gui, -Caption +alwaysontop
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
;OnMessage(0x0201, "WM_LBUTTONDOWN") ;non-programmed event
return
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
}
esc::
Gui, Destroy
Return
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseLeave(){
global
Gui,2: destroy
status_button_old:=""
}
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace( status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
gui,2: -border -caption +toolwindow
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Mxpos := xpos1+720
Gui, Show, x%Mxpos% y%ypos1%,
status_button_old:=status_button
return
Button1:
Gui, Destroy
Sleep, 200
PasteClip := 1
Gosub, Paste
Return
Button2:
Gui, Destroy
Sleep, 200
PasteClip := 2
Gosub, Paste
Return
Button3:
Gui, Destroy
Sleep, 200
PasteClip := 3
Gosub, Paste
Return
Button4:
Gui, Destroy
Sleep, 200
PasteClip := 4
Gosub, Paste
Return
Button5:
Gui, Destroy
Sleep, 200
PasteClip := 5
Gosub, Paste
Return
Button6:
Gui, Destroy
Sleep, 200
PasteClip := 6
Gosub, Paste
Return
Button7:
Gui, Destroy
Sleep, 200
PasteClip := 7
Gosub, Paste
Return
Button8:
Gui, Destroy
Sleep, 200
PasteClip := 8
Gosub, Paste
Return
Button9:
Gui, Destroy
Sleep, 200
PasteClip := 9
Gosub, Paste
Return
Button10:
Gui, Destroy
Sleep, 200
PasteClip := 10
Gosub, Paste
Return
^F6::
MsgBox, 4,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 500
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Clipboard_Sound.mp3
Return
^F10::
MsgBox, 4,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
MsgBox, %CorpusCount% Clipboards will be Converted to a PDF File
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Temp" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, CQLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
RunWait, conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, wkhtmltopdf.exe TempPDF.html Final_Document.pdf,,hide
FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Run, Final_Document.pdf
Return
/*
^F11::
MsgBox, 4,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
TextDelete := "Text" ClipCount ".html"
CorpusDelete := "Corpus" ClipCount ".html"
;MsgBox, %TextDelete% and %URLDelete%
FileDelete, HTMLTemp\%TextDelete%
FileDelete, HTMLTemp\%CorpusDelete%
ClipCount--
CorpusCount--
Return
*/
^F12::
Pause, Toggle
Return
^Esc:: ExitApp
; Funtion thanks to SoLong&Thx4AllTheFish in https://autohotkey.com/board/topic/5894-function-get-nextfree-available-file-name/
GetAvailableFileName( GivenFileName, GivenPath = "", StartID = 1 )
{
StringSplit, NameArray, GivenFileName, #
Loop
{
Number := A_Index + StartID - 1
Loop, % NameArray0 - 10 - StrLen(Number) ;%
Number = 0%Number%
StringSplit, NumberArray, Number
FileName =
Loop, %NameArray0%
FileName := FileName . NameArray%A_Index% . NumberArray%A_Index%
If not FileExist(GivenPath . FileName)
Return GivenPath . FileName
}
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
Return
HideTrayTip() {
TrayTip
}
Return
Borrado:
FileDelete, Test.xml
;Filecopy, temp.xml, temp1.xml
FileDelete, temp.txt
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\Temp*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
Return
Paste:
ExitMenu := Clipcount+1
if PasteClip=ExitMenu
{
Gui, Destroy
Return
}
Else
If Not PasteClip=ExitMenu
{
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" PasteClip ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" PasteClip ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
}
Code: Select all
Is it possible to move GUI while -caption is disabled? - AutoHotkey Community - Vivaldi
How to auto adjust height of GUI to the HTML content - AutoHotkey Community - Vivaldi
.....
Code: Select all
aData := accData.1 ;Text
LenText := StrLen(aData) ;Find out the number of characters
StringGetPos, pos, aData, -, r1 ;Find out the first position on the left of a hyphen
length := pos-1; Subtract 1 number to remove a space on the left
StringLeft, OutText, aData, %length% ;Outcome: Remove the left part on the right
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
#Include WinClipAPI.ahk
#Include WinClip.ahk
#Include ViewHtml.ahk
#Persistent
;Menu, Tray, Icon,,, 1
;SetBatchLines, -1
CorpusCount := 0
if FileExist("HTMLTemp\Text1.html")
MsgBox, 4,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
^F3::
ClipTemp := Clipboard
clipboard := "" ;Empty clipboard
Send, ^c ;Copy text select
ClipWait
CorpusCount++
if Not Clipboard=ClipTemp
{
SoundPlay, Clipboard_Sound.mp3
TrayTip, Timed TrayTip, %Clipboard%, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1500
}
Else
{
SoundPlay, ambiguity2.mp3
TrayTip, Timed TrayTip, REPEATED CLIPBOARD!, 0x2, 0x10, 0x20
SetTimer, HideTrayTip, -1500
return
}
accData:= GetAccData()
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%, CP65001
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
Sleep 500
NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
FileCopy, TempPDF.html, %NameCopy%
RunWait, conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Return
+RButton::
FileDelete, SesionName.txt
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
FileAppend, Exit Menu, SesionName.txt
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, Add, Button, x460 y%posy% w20 h20 w20 h20 hwndIcon, %A_Index%
Gui, Add, Button, x0 y%posy% w460 h20 vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "clip_formats.ico")
}
CoordMode, Mouse, Screen
MouseGetPos, xpos1, ypos1
HButton := CorpusCount+1
Alto := 16.8*HButton
;Alto := % Floor(16.5*HButton)
;Alto := % Floor(16*CorpusCount)
Gui, Show, x%xpos1% y%ypos1% w476 h%Alto%, Window-Title
Gui, -Caption +alwaysontop
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
;OnMessage(0x0201, "WM_LBUTTONDOWN") ;non-programmed event
return
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
}
esc::
Gui, Destroy
Return
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseLeave(){
global
Gui,2: destroy
status_button_old:=""
}
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace( status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
gui,2: -border -caption +toolwindow
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Mxpos := xpos1+720
Gui, Show, x%Mxpos% y%ypos1%,
status_button_old:=status_button
return
Button1:
PasteClip := 1
Gosub, Paste
Return
Button2:
PasteClip := 2
Gosub, Paste
Return
Button3:
PasteClip := 3
Gosub, Paste
Return
Button4:
PasteClip := 4
Gosub, Paste
Return
Button5:
PasteClip := 5
Gosub, Paste
Return
Button6:
PasteClip := 6
Gosub, Paste
Return
Button7:
PasteClip := 7
Gosub, Paste
Return
Button8:
PasteClip := 8
Gosub, Paste
Return
Button9:
PasteClip := 9
Gosub, Paste
Return
Button10:
PasteClip := 10
Gosub, Paste
Return
Button11:
PasteClip := 11
Gosub, Paste
Return
Button12:
PasteClip := 12
Gosub, Paste
Return
^F6::
MsgBox, 4,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 500
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Clipboard_Sound.mp3
Return
^F10::
MsgBox, 4,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
MsgBox, 4,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Temp" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, CQLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
RunWait, conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, wkhtmltopdf.exe TempPDF.html Final_Document.pdf,,hide
FileDelete, ToPDF.html
FileDelete, TempPDF.html
Run, Final_Document.pdf
Return
^F11::
MsgBox, 4,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
FileDelete, HTMLTemp\*%CorpusCount%.*
CorpusCount--
Return
^F12::
Pause, Toggle
Return
^Esc:: ExitApp
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
Return
HideTrayTip() {
TrayTip
}
Return
Borrado:
FileDelete, Test.xml
;Filecopy, temp.xml, temp1.xml
FileDelete, temp.txt
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\Temp*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
Return
Paste:
ExitMenu := CorpusCount+1
if PasteClip=ExitMenu
{
Gui, Destroy
Gui, 2:default
Gui, destroy
Return
}
Else
Gui, Destroy
Gui, 2:default
Gui, destroy
Sleep, 300
If Not PasteClip=ExitMenu
{
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" PasteClip ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" PasteClip ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
Return
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
#Include WinClipAPI.ahk
#Include WinClip.ahk
#Include ViewHtml.ahk
;#Persistent
CoordMode, Mouse, Screen
;Menu, Tray, Icon,,, 1
;SetBatchLines, -1
CorpusCount := 0
if FileExist("HTMLTemp\Text1.html")
MsgBox, 4,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
^F3::
ClipTemp := Clipboard
clipboard := "" ;Empty clipboard
Send, ^c ;Copy text select
ClipWait
CorpusCount++
if Not Clipboard=ClipTemp
{
SoundPlay, Clipboard_Sound.mp3
TrayTip, Timed TrayTip, %Clipboard%, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1500
}
Else
{
SoundPlay, ambiguity2.mp3
TrayTip, Timed TrayTip, REPEATED CLIPBOARD!, 0x2, 0x10, 0x20
SetTimer, HideTrayTip, -1500
return
}
accData:= GetAccData()
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
;FileAppend, %myResult%, %FileTex%, CP65001
;FileAppend, %myResult%, TextTemp.html
;RunWait, conv.exe -b 65001 TextTemp.html TextTemp1.html ,,hide
;TextTempPDF := "HTMLTemp\TextPDF" CorpusCount ".html"
;FileMove, TextTemp1.html, %TextTempPDF%
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
Sleep 500
NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
FileCopy, TempPDF.html, %NameCopy%
RunWait, conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Return
+RButton::
FileDelete, SesionName.txt
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, Add, Button, x460 y%posy% w20 h20 hwndIcon gTxtLabel, %A_Index%
Gui, Add, Button, x0 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "clipboard.ico", 1, "s32")
}
MouseGetPos, xpos1, ypos1
If CorpusCount=1
{
Alto=13
}
Else
{
CorCount := CorpusCount-1
Alto := CorCount*20+13
}
posyExit:=20*CorpusCount
Gui, Add, Button, x0 y%posyExit% w480 h20 gExitLabel, Exit Menu
Gui, Show, x%xpos1% y%ypos1% w476 h%Alto%, Window-Title
Gui, -Caption +alwaysontop
gui,1: color,EEAA99
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
;OnMessage(0x0201, "WM_LBUTTONDOWN") ;non-programmed event
return
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
}
!esc::
Gui, Destroy
Gui, 2:default
Gui, destroy
Return
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseLeave(){
global
Gui,2: destroy
status_button_old:=""
}
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace( status_button,"\D")
;MsgBox, %NumberFile%
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
gui,2: -border -caption +toolwindow
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Mxpos := xpos1+720
Gui, Show, x%Mxpos% y%ypos1%,
status_button_old:=status_button
return
^F6::
MsgBox, 4,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 500
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Clipboard_Sound.mp3
Return
^F10::
MsgBox, 4,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
MsgBox, 4,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Temp" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, CQLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
RunWait, conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, wkhtmltopdf.exe TempPDF.html Final_Document.pdf,,hide
FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Run, Final_Document.pdf
Return
^F11::
MsgBox, 4,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
FileDelete, HTMLTemp\*%CorpusCount%.*
CorpusCount--
Return
^F12::
Pause, Toggle
Return
^Esc:: ExitApp
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
Return
HideTrayTip() {
TrayTip
}
Return
Borrado:
FileDelete, Test.xml
;Filecopy, temp.xml, temp1.xml
FileDelete, temp.txt
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\Temp*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
Return
ButtonLabel:
Gosub, ExitLabel
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
Gui, Destroy
Gui, 2:default
Gui, destroy
Return
TxtLabel:
Gosub, ExitLabel
WinActivate, ahk_id %WinUMID%
Msgbox, %NumberFile%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
;html := ClipBoard
;WinClip.Paste()
Return
ActivateWinUM:
MouseGetPos,,, WinUMID
Return
/*
Gui, Destroy
Gui, 2:default
Gui, destroy
Sleep, 300
If Not PasteClip=ExitMenu
{
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" PasteClip ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" PasteClip ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
Return
*/
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#Persistent
CoordMode, Mouse, Screen
~LButton::
time := A_TickCount
KeyWait, LButton
varTemp := A_TimeSinceThisHotkey
if varTemp>1200
Gosub, Select
Else
return
Select:
MouseGetPos, xpos1, ypos1
Gui,1: color,EEAA99
Gui, Add, Button, x2 y2 w64 h15 gExitMenu, Exit
Gui, Add, Button, x2 y18 w64 h64 hwndIcon gButtonLabel
Gui, Show, x%xpos1% y%ypos1% w68 h84, Window-Title
Gui, -Caption ;+alwaysontop
GuiButtonIcon(Icon, "clipboard.ico", 1, "s90")
Return
ButtonLabel:
ClipTemp := Clipboard
clipboard := ""
Gui, Destroy
SetTimer, ActivateWinUM, 100
;WinActivate, ahk_id %WinUMID%
Send, ^c
;Gosub, OnClipboardChange
ClipWait
if Not Clipboard=ClipTemp
{
SoundPlay, Clipboard_Sound.mp3
TrayTip, Timed TrayTip, %Clipboard%, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1500
}
Else
{
SoundPlay, ambiguity2.mp3
TrayTip, Timed TrayTip, REPEATED CLIPBOARD!, 0x2, 0x10, 0x20
SetTimer, HideTrayTip, -1500
}
Return
ActivateWinUM:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
return
^esc::
Gui, Destroy
Return
ExitMenu:
Gui, Destroy
Return
;GuiClose:
;ExitApp
HideTrayTip() {
TrayTip
}
Return
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
Return
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
#Include WinClipAPI.ahk
#Include WinClip.ahk
#Include ViewHtml.ahk
;#Persistent
CoordMode, Mouse, Screen
;Menu, Tray, Icon,,, 1
;SetBatchLines, -1
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, EEAA99
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, PauseOff.png
GuiButtonIcon(Icon, "clipboard.ico", 1, "s90")
GoSub, Toggle_Switch
CorpusCount := 0
;Toggle := 1
if FileExist("HTMLTemp\Text1.html")
MsgBox, 4,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
^F3::
Gosub, MainProcess
Return
MainProcess:
ClipTemp := Clipboard
clipboard := "" ;Empty clipboard
Send, ^c ;Copy text select
ClipWait
CorpusCount++
if Not Clipboard=ClipTemp
{
SoundPlay, Clipboard_Sound.mp3
TrayTip Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1500
}
Else
{
SoundPlay, ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
SetTimer, HideTrayTip, -1500
return
}
accData:= GetAccData()
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
;FileAppend, %myResult%, %FileTex%, CP65001
;FileAppend, %myResult%, TextTemp.html
;RunWait, conv.exe -b 65001 TextTemp.html TextTemp1.html ,,hide
;TextTempPDF := "HTMLTemp\TextPDF" CorpusCount ".html"
;FileMove, TextTemp1.html, %TextTempPDF%
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
Sleep 500
NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
FileCopy, TempPDF.html, %NameCopy%
RunWait, conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Return
^F8::
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W81 h84
Return
+RButton::
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x460 y%posy% w20 h20 hwndIcon gTxtLabel, %A_Index%
Gui, ContextClip: Add, Button, x0 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "clipboard.ico", 1, "s32")
}
MouseGetPos, xpos1, ypos1
If CorpusCount=1
{
;Alto=13 ;Original
Alto=20
}
Else
{
CorCount := CorpusCount
;CorCount := CorpusCount-1 ;Original
;Alto := CorCount*20+13 ;Original
Alto := CorCount*20+20
}
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
Gui, ContextClip: -Caption +alwaysontop
Gui, ContextClip: color,EEAA99
Gui, ContextClip: Add, Button, x0 y%posyExit% w480 h20 gExitLabel, Exit Menu
;Gui, ContextClip: Show, x%xpos1% y%ypos1% w476 h%Alto%, Window-Title
Gui, ContextClip: Show, x%xpos1% y%ypos1% w480 h%Alto%
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
;OnMessage(0x0201, "WM_LBUTTONDOWN") ;non-programmed event
return
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
}
~LButton::start := A_TickCount
~LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
Return
HideTrayTip:
TrayTip
Return
GuiEscape:
GuiClose:
ExitCopy:
Gui, CopyButtom:Hide
Return
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseLeave(){
global
Gui,2: destroy
status_button_old:=""
}
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace( status_button,"\D")
;MsgBox, %NumberFile%
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Mxpos := xpos1+720
Mypos := ypos1-10
Gui,2: Show, x%Mxpos% y%ypos1%, ;Original
;Gui,2: Show, x%Mxpos% y%Mypos%
status_button_old:=status_button
return
^F6::
MsgBox, 4,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 500
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Clipboard_Sound.mp3
Return
^F10::
MsgBox, 4,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
MsgBox, 4,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Temp" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, CQLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
RunWait, conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, wkhtmltopdf.exe TempPDF.html Final_Document.pdf,,hide
FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Run, Final_Document.pdf
Return
^F11::
MsgBox, 4,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
FileDelete, HTMLTemp\*%CorpusCount%.*
CorpusCount--
Return
^F12::
Suspend, Toggle
Return
^Esc:: ExitApp
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
Return
/*
HideTrayTip() {
TrayTip
}
Return
*/
Borrado:
FileDelete, Test.xml
;Filecopy, temp.xml, temp1.xml
FileDelete, temp.txt
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\Temp*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
Return
ButtonLabel:
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
Gui, Destroy
Gui, 2:default
Gui, destroy
Return
TxtLabel:
Gosub, ExitLabel
WinActivate, ahk_id %WinUMID%
Msgbox, %NumberFile%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
;html := ClipBoard
;WinClip.Paste()
Return
/*
ActivateWinUM:
MouseGetPos,,, WinUMID
Return
*/
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
;last := Clipboard, Clipboard := ""
Gosub, MainProcess
Return
/*
Gui, Destroy
Gui, 2:default
Gui, destroy
Sleep, 300
If Not PasteClip=ExitMenu
{
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" PasteClip ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" PasteClip ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
Return
*/
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
#Include WinClipAPI.ahk
#Include WinClip.ahk
#Include ViewHtml.ahk
;#Persistent
CoordMode, Mouse, Screen
;Menu, Tray, Icon,,, 1
;SetBatchLines, -1
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, EEAA99
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, PauseOff.png
GuiButtonIcon(Icon, "clipboard1.ico", 1, "s90")
GoSub, Toggle_Switch
CorpusCount := 0
Hotkey, LButton Up, off
if FileExist("HTMLTemp\Text1.html")
MsgBox, 4,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
^F3::
Gosub, MainProcess
Return
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
CorpusCount++
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
accData:= GetAccData()
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
;FileAppend, %myResult%, %FileTex%, CP65001
;FileAppend, %myResult%, TextTemp.html
;RunWait, conv.exe -b 65001 TextTemp.html TextTemp1.html ,,hide
;TextTempPDF := "HTMLTemp\TextPDF" CorpusCount ".html"
;FileMove, TextTemp1.html, %TextTempPDF%
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
Sleep 500
NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
FileCopy, TempPDF.html, %NameCopy%
RunWait, conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Return
^F8::
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W81 h84
Return
+RButton::
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x460 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x480 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
;Gui, ContextClip: Add, Button, x480 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x0 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "128.ico", 1, "s32")
}
MouseGetPos, xpos1, ypos1
If CorpusCount=1
{
;Alto=13 ;Original
Alto=20
}
Else
{
CorCount := CorpusCount
;CorCount := CorpusCount-1 ;Original
;Alto := CorCount*20+13 ;Original
Alto := CorCount*20+20
}
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd
Gui, ContextClip: color,EEAA99
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip: Add, Button, x0 y%posyExit% w480 h20 gExitLabel, Exit Menu
Gui, ContextClip: Add, Text, x480 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip: Add, Button, x480 y%posyExit% w20 h20 hwndIcon2
Gui, ContextClip: Show, x%xpos1% y%ypos1% w500 h%Alto%
GuiButtonIcon(Icon2, "Hand9.ico", 1, "s32")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
;OnMessage(0x0201, "WM_LBUTTONDOWN") ;non-programmed event
Gosub, NewWindow
return
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
}
~LButton::start := A_TickCount
~LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
Gui, CopyButtom:Hide
Return
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: destroy
status_button_old:=""
}
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace( status_button,"\D")
;MsgBox, %NumberFile%
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%X% y%Y%
status_button_old:=status_button
return
^F6::
MsgBox, 4,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 500
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Clipboard_Sound.mp3
Return
^F10::
MsgBox, 4,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
MsgBox, 4,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Temp" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, CQLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
RunWait, conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, wkhtmltopdf.exe TempPDF.html Final_Document.pdf,,hide
FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Run, Final_Document.pdf
Return
^F11::
MsgBox, 4,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
FileDelete, HTMLTemp\*%CorpusCount%.*
CorpusCount--
Return
^F12::
Suspend, Toggle
Return
^Esc:: ExitApp
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
Return
Borrado:
FileDelete, Test.xml
;Filecopy, temp.xml, temp1.xml
FileDelete, temp.txt
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\Temp*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
Return
ButtonLabel:
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
Gui, ContextClip: Submit
;Gui, Destroy
Gui, 2: Destroy
;Gui, 2:default
;Gui, destroy
Return
TxtLabel:
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextCopy, a_guicontrol, 5
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
;clipboard=%htmlTx%
;htmlTx := ClipBoard
;WinClip.Paste()
Return
TxtPlane:
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos X, Y, Width, Height, ahk_id %hMainWnd%
X := X + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
X += BorderW + 1
}
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
#Include WinClipAPI.ahk
#Include WinClip.ahk
#Include ViewHtml.ahk
;#Include ToolTipEx.ahk
;#Persistent
CoordMode, Mouse, Screen
;Menu, Tray, Icon,,, 1
;SetBatchLines, -1
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, PauseOff.png
GuiButtonIcon(Icon, "clipboard1.ico", 1, "s90")
GoSub, Toggle_Switch
CorpusCount := 0
;Hotkey, LButton Up, off
if FileExist("HTMLTemp\Text1.html")
MsgBox, 4,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
Return
^F4:: ; Menu1
Gui, OptionMenu: new
Gui, OptionMenu: -Caption
Gui, OptionMenu: Add, Picture, x0 y0 w600 h167, Clipboard Utility_p.png
Gui, OptionMenu: Add, Picture, x553 y0 w48 h35 gExitCopy, ArribaDcha.png
Gui, OptionMenu: Add, Text, x0 y0 w552 h35 GuiMove, `&& Drag
Gui, OptionMenu: Add, Picture, x0 y0 w552 h35, ArribaIzq.png
Gui, OptionMenu: Add, Picture, x16 y36 w141 h115 gPrintPDF, AbajoDcha.png
Gui, OptionMenu: Add, Picture, x158 y36 w141 h115 gControlPaste, AbajoDcha2.png
Gui, OptionMenu: Add, Picture, x444 y36 w141 h115 gHelpButton, AbajoDcha4.png
MouseGetPos, xpos2, ypos2
Gui, OptionMenu: Show, x%xpos2% y%ypos2% W600 h167
Return
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
CorpusCount++
accData:= GetAccData()
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
;FileAppend, %myResult%, %FileTex%, CP65001
;FileAppend, %myResult%, TextTemp.html
;RunWait, conv.exe -b 65001 TextTemp.html TextTemp1.html ,,hide
;TextTempPDF := "HTMLTemp\TextPDF" CorpusCount ".html"
;FileMove, TextTemp1.html, %TextTempPDF%
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
Sleep 500
NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
FileCopy, TempPDF.html, %NameCopy%
RunWait, conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Return
^F8::
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W81 h84
Return
+RButton::
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x480 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
;Gui, ContextClip: Add, Button, x480 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "128.ico", 1, "s32")
GuiButtonIcon(Icon8, "ArrowSmall.ico", 1, "s32")
} ; Menu3
MouseGetPos, xpos1, ypos1
If CorpusCount=1
{
;Alto=13 ;Original
Alto=20
}
Else
{
CorCount := CorpusCount
;CorCount := CorpusCount-1 ;Original
;Alto := CorCount*20+13 ;Original
Alto := CorCount*20+20
}
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd ;Menu3s
Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip: Add, Button, x20 y%posyExit% w480 h20 gExitLabel, Exit Menu
Gui, ContextClip: Add, Text, x500 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip: Add, Button, x500 y%posyExit% w20 h20 hwndIcon2
Gui, ContextClip: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip: Add, Button, x0 y%posyExit% w20 h20 hwndIcon7
Gui, ContextClip: Show, x%xpos1% y%ypos1% w520 h%Alto% ;Menu3s
GuiButtonIcon(Icon2, "Hand9.ico", 1, "s32")
GuiButtonIcon(Icon7, "Hand9.ico", 1, "s32")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
;OnMessage(0x0201, "WM_LBUTTONDOWN") ;non-programmed event
Gosub, NewWindow
return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
Gui, Help: New
Gui, Help: -Caption
Gui, Help: Color, EEAA99
Gui, Help: Margin, 12, 12
Gui, Help: Add, Picture, x2 y2 w640 h250, Help.jpg
Gui, Help: Add, Button, x495 y211 w100 h30 gExitButton, Exit
Gui, Help: Show, w640 h250
Return
ExitButton:
Gui, Help: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
Gui, OptionMenu:Hide
Gui, CopyButtom:Hide
Return
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace( status_button,"\D")
;MsgBox, %NumberFile%
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
;Gui,2: Show, x%X% y%Y%
status_button_old:=status_button
return
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace( status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Informat := "HTMLTemp\TextPlain" NumberPlane ".txt"
FileRead, FileContents, %Informat%
Html =
(
<html><head><Style>
body {background-color: #ffffd6; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui margin, 0, 0
gui add, ActiveX, vWB w320 h220, HTMLfile
;gui add, ActiveX, vWB w700 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
;gui, 3: Show, x%pXm% y%pYm% AutoSize
gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
^F6::
ControlPaste:
MsgBox, 4,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 500
Gui, OptionMenu: -MinimizeBox
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Clipboard_Sound.mp3
Return
^F10::
MsgBox, 4,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
PrintPDF:
MsgBox, 4,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, OptionMenu: -MinimizeBox
Sleep, 1000
Loop, %CorpusCount%
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Temp" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, CQLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
RunWait, conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, wkhtmltopdf.exe TempPDF.html Final_Document.pdf,,hide
Run, Final_Document.pdf
FileDelete, ToPDF.html
FileDelete, TempPDF.html
Return
^F5::
MsgBox, 4,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Temp" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, CQLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
RunWait, conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, wkhtmltopdf.exe TempPDF.html Final_Document.pdf,,hide
FileDelete, ToPDF.html
FileDelete, TempPDF.html
Run, Final_Document.pdf
Return
^F11::
MsgBox, 4,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
FileDelete, HTMLTemp\*%CorpusCount%.*
CorpusCount--
Return
^F12::
Suspend, Toggle
Return
^Esc:: ExitApp
Borrado:
FileDelete, Test.xml
;Filecopy, temp.xml, temp1.xml
FileDelete, temp.txt
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\Temp*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Return
ButtonLabel:
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
Gui, ContextClip: Submit
;Gui, Destroy
Gui, 2: Destroy
;Gui, 2:default
;Gui, destroy
Return
TxtLabel:
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextCopy, a_guicontrol, 5
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
;clipboard=%htmlTx%
;htmlTx := ClipBoard
;WinClip.Paste()
Return
TxtPlane:
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
status_button_old:=""
status_plane_old:=""
}
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
#Include WinClipAPI.ahk
#Include WinClip.ahk
#Include ViewHtml.ahk
;#Include ToolTipEx.ahk
;#Persistent
SetBatchLines, -1
CoordMode, Mouse, Screen
;Menu, Tray, Icon,,, 1
pngFile := "d:\Utilidades\AutoHotkey\Scripts\MultiClipboard Preview\AbajoDchaF.png"
BS_ICON := 0x40
BS_BITMAP := 0x80
IMAGE_BITMAP := 0
IMAGE_ICON := 1
BM_SETIMAGE := 0xF7
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, PauseOff.png
GuiButtonIcon(Icon, "clipboard1.ico", 1, "s90")
GoSub, Toggle_Switch
CorpusCount := 0
;Hotkey, LButton Up, off
if FileExist("HTMLTemp\Text1.html")
MsgBox, 4,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
Return
^F4::
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd
Gui, -Caption HwndHwnd
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Add, Picture, x0 y0 w600 h167, Clipboard Utility_p.png
Gui, Add, Text, x0 y0 w552 h35 GuiMove, `&& Drag
Gui, Add, Picture, x0 y0 w552 h35, ArribaIzq.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "PDFup.png"
Gui1.Button1.HoverImage := "PDFhover.png"
Gui1.Button1.PressedImage := "PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Add, Picture, x16 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "PasteUp.png"
Gui1.Button2.HoverImage := "PasteHover.png"
Gui1.Button2.PressedImage := "PasteDown.png"
Gui1.Button2.Label := "ControlPaste"
Gui, Add, Picture, x158 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "ExitUp.png"
Gui1.Button3.HoverImage := "ExitHover.png"
Gui1.Button3.PressedImage := "ExitDown.png"
Gui1.Button3.Label := "ExitCopy"
Gui, Add, Picture, x553 y0 w48 h35 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "HelpUp.png"
Gui1.Button4.HoverImage := "HelpHover.png"
Gui1.Button4.PressedImage := "HelpDown.png"
Gui1.Button4.Label := "HelpButton"
Gui, Add, Picture, x444 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
CorpusCount++
accData:= GetAccData()
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
Sleep 500
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Return
^F8::
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W81 h84
Return
+RButton::
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x480 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
;Gui, ContextClip: Add, Button, x480 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "128.ico", 1, "s32")
GuiButtonIcon(Icon8, "ArrowSmall.ico", 1, "s32")
} ; Menu3
MouseGetPos, xpos1, ypos1
If CorpusCount=1
{
;Alto=13 ;Original
Alto=20
}
Else
{
CorCount := CorpusCount
;CorCount := CorpusCount-1 ;Original
;Alto := CorCount*20+13 ;Original
Alto := CorCount*20+20
}
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd ;Menu3s
Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip: Add, Button, x20 y%posyExit% w480 h20 gExitLabel, Exit Menu
Gui, ContextClip: Add, Text, x500 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip: Add, Button, x500 y%posyExit% w20 h20 hwndIcon2
Gui, ContextClip: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip: Add, Button, x0 y%posyExit% w20 h20 hwndIcon7
Gui, ContextClip: Show, x%xpos1% y%ypos1% w520 h%Alto% ;Menu3s
GuiButtonIcon(Icon2, "Hand9.ico", 1, "s32")
GuiButtonIcon(Icon7, "Hand9.ico", 1, "s32")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
;OnMessage(0x0201, "WM_LBUTTONDOWN") ;non-programmed event
Gosub, NewWindow
return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
Gui, Help: New
Gui, Help: -Caption
Gui, Help: Color, EEAA99
Gui, Help: Margin, 12, 12
Gui, Help: Add, Picture, x2 y2 w640 h250, Help.jpg
Gui, Help: Add, Button, x495 y211 w100 h30 gExitButton, Exit
Gui, Help: Show, w640 h250
Return
ExitButton:
Gui, Help: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Clipboard_Sound.mp3
Gui, Hide
Gui, CopyButtom:Hide
Return
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace( status_button,"\D")
;MsgBox, %NumberFile%
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
;Gui,2: Show, x%X% y%Y%
status_button_old:=status_button
return
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace( status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Informat := "HTMLTemp\TextPlain" NumberPlane ".txt"
FileRead, FileContents, %Informat%
Html =
(
<html><head><Style>
body {background-color: #ffffd6; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui margin, 0, 0
gui add, ActiveX, vWB w320 h220, HTMLfile
;gui add, ActiveX, vWB w700 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
^F6::
ControlPaste:
MsgBox, 4,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Destroy
;Gui, -MinimizeBox
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Clipboard_Sound.mp3
Return
^F10::
MsgBox, 4,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
SavePDF:
SoundPlay, Clipboard_Sound.mp3
MsgBox, 4,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, -MinimizeBox
Sleep, 1000
Loop, %CorpusCount%
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html5, PDFLine.html
FileAppend, %html5%<br/>, ToPDF.html
}
;RunWait, conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
;RunWait, wkhtmltopdf.exe TempPDF.html Final_Document.pdf,,hide
Run, Final_Document.pdf
FileDelete, ToPDF.html
FileDelete, TempPDF.html
Return
^F5::
MsgBox, 4,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
FileDelete, ToPDF.html
FileDelete, TempPDF.html
Run, Final_Document.pdf
Return
^F11::
MsgBox, 4,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
FileDelete, HTMLTemp\*%CorpusCount%.*
CorpusCount--
Return
^F12::
Suspend, Toggle
Return
^Esc:: ExitApp
Borrado:
FileDelete, Test.xml
;Filecopy, temp.xml, temp1.xml
FileDelete, temp.txt
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\Temp*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Return
ButtonLabel:
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
Gui, ContextClip: Submit
;Gui, Destroy
Gui, 2: Destroy
;Gui, 2:default
;Gui, destroy
Gui, 3: Destroy
Return
TxtLabel:
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextCopy, a_guicontrol, 5
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
;clipboard=%htmlTx%
;htmlTx := ClipBoard
;WinClip.Paste()
Return
TxtPlane:
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
#Include Library\ViewHtml.ahk
;#Include Library\ToolTipEx.ahk
#SingleInstance, Force
#InstallMousehook
;#Persistent
SetBatchLines, -1
Name := "Clipboard Utility - "
Version := "4.0d"
CoordMode, Mouse, Screen
Menu, Tray, Icon, Resources\Scissors.ico
Menu, Tray, NoStandard
Menu, tray, Add, %name% %version%, Nothing
Menu, tray, Icon, %name% %version%, Resources\Clipboard Utility.ico
Menu, tray, Add,
Menu Tray, Add, Open Info, Tray_Open
Menu Tray, Icon, Open Info, %A_ScriptDir%\Resources\Info.ico
Menu, tray, Add, &Reload this script , TrayMenuHandler
Menu, tray, Icon,&Reload this script , shell32.dll, 239
Menu, tray, Add, &Edit this script , TrayMenuHandler
Menu, tray, Icon,&Edit this script , comres.dll, 7
Menu, tray, Add,
Menu, tray, Add, &Suspend Hotkeys , TrayMenuHandler
Menu, tray, Icon,&Suspend Hotkeys , %A_AhkPath%, 3
Menu, tray, Add, &Pause Script , TrayMenuHandler
Menu, tray, Icon,&Pause Script , %A_AhkPath%, 4
;Menu, tray, Add, &Pause clipboard history, TrayMenuHandler
/*
;***********************************************************************
;loop, HTMLTemp\Corpus*.html
;CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
Menu, ClipboardID, add, %A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
Menu, Tray, add, Clipboard, :ClipboardID
Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
;***********************************************************************
Menu, winmanagetID, Add, Clipboard Window, RButtonAlt
Menu, winmanagetID, Add, Utility Window, WUtil
Menu, winmanagetID, Add, Copy Clipboard Window, CopyGui
Menu, winmanagetID, icon, Copy Clipboard Window, Resources\Clipboard Utility 1.ico
Menu, Tray, add, window management, :winmanagetID
Menu, tray, Icon, Window Management, %A_ScriptDir%\Resources\imageres.dll,322
*/
Menu, Tray, Add
Menu, Tray, Add, Save all Clipboard to PDF File, SavePDF
Menu, Tray, Icon, Save all Clipboard to PDF File, %A_ScriptDir%\Resources\PDF.ico
Menu, Tray, Add
Menu, Tray, Add, Extract URL's from clipboard, URLButton
Menu, Tray, Icon, Extract URL's from clipboard, %A_ScriptDir%\Resources\URL.ico
Menu, Tray, Add
Menu, DeleteID, Add, Delete Last Clipboard, DeleteLast
Menu, DeleteID, Add, Delete All Clipboard, DeleteAll
Menu, Tray, add, Delete Options, :DeleteID
Menu, tray, Icon, Delete Options, %A_ScriptDir%\Resources\Recycle 3.ico
Menu, Tray, Add
Menu, Tray, Add, Help, HelpButton
Menu, Tray, Icon, Help, %A_ScriptDir%\Resources\Help.ico
Menu, tray, Add, Exit , Exit
Menu, tray, Icon, Exit , shell32.dll, 132
Menu, Tray, Tip, Clipboard Utility 4.0d
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:+Owner
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, Resources\PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, Resources\PauseOff.png
GuiButtonIcon(Icon, "Resources\Clipboard Utility 1.ico", 1, "s90")
GoSub, Toggle_Switch
CorpusCount := 0
URLCount := 0
;Hotkey, LButton Up, off
/*
if FileExist("HTMLTemp\Text1.html")
MsgBox, 0x1034,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
*/
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
Gosub, RButton
Return
^F4::
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd
Gui, -Caption HwndHwnd
Gui, +Owner
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Add, Picture, x0 y0 w600 h167, Resources\Clipboard Utility_p.png
Gui, Add, Text, x0 y0 w552 h35 GuiMove ; , `&& Drag
Gui, Add, Picture, x0 y0 w552 h35, Resources\ArribaIzq.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "Resources\PDFup.png"
Gui1.Button1.HoverImage := "Resources\PDFhover.png"
Gui1.Button1.PressedImage := "Resources\PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Add, Picture, x16 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "Resources\PasteUp.png"
Gui1.Button2.HoverImage := "Resources\PasteHover.png"
Gui1.Button2.PressedImage := "Resources\PasteDown.png"
Gui1.Button2.Label := "ControlPaste"
Gui, Add, Picture, x158 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "Resources\ExitUp.png"
Gui1.Button3.HoverImage := "Resources\ExitHover.png"
Gui1.Button3.PressedImage := "Resources\ExitDown.png"
;Gui1.Button3.Label := "ExitLabel"
Gui1.Button3.Label := "ExitCopy"
Gui, Add, Picture, x553 y0 w48 h35 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "Resources\HelpUp.png"
Gui1.Button4.HoverImage := "Resources\HelpHover.png"
Gui1.Button4.PressedImage := "Resources\HelpDown.png"
Gui1.Button4.Label := "HelpButton"
Gui, Add, Picture, x444 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 5
;************************************************************************************************************************
Gui1.Button5 := {} ;Button 5
Gui1.Button5.DefaultImage := "Resources\UrlUp.png"
Gui1.Button5.HoverImage := "Resources\UrlHover.png"
Gui1.Button5.PressedImage := "Resources\UrlDown.png"
Gui1.Button5.Label := "URLButton"
Gui, Add, Picture, x300 y36 w141 h115 hwndhwnd, % Gui1.Button5.DefaultImage
Gui1.Handles[ hwnd ] := "Button5" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, Resources\ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
CorpusCount++
accData:= GetAccData()
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
Sleep 500
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Return
^F8::
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W81 h84
Return
+RButton::
RButton:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x520 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x540 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w20 h20 hwndIcon10 gClipDelete vDeleteButton%A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon9 gTitleEditing vEditing%A_Index%
Gui, ContextClip: Add, Button, x40 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "Resources\clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "Resources\128.ico", 1, "s32")
GuiButtonIcon(Icon8, "Resources\ArrowSmall.ico", 1, "s32")
GuiButtonIcon(Icon10, "Resources\recycle 2.ico", 1, "s32")
GuiButtonIcon(Icon9, "Resources\pencil 1.ico", 1, "s24")
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
;Gui, ContextClip: -Caption +ToolWindow +0x400000 +hWndhMainWnd ;Menu3s
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd
Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip:+Owner
Gui, ContextClip: Add, Button, x20 y%posyExit% w480 h20 gExitLabel, Exit Menu
Gui, ContextClip: Add, Button, x500 y%posyExit% w60 h20 hwndIcon11 gReducedM
Gui, ContextClip: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip: Add, Button, x0 y%posyExit% w20 h20 hwndIcon12
MouseGetPos, xpos1, ypos1
xpos1 := xpos1-560
ypos1 := ypos1-alto
Gui, ContextClip: Show, x%xpos1% y%ypos1% w560 h%Alto% ;Menu3s
GuiButtonIcon(Icon12, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon11, "Resources\ArrowRedu.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
TitleEditing:
Gosub, NewWindow
StringTrimLeft, REdit, a_guicontrol, 7
FileChange := "HTMLTemp\Name" REdit ".txt"
FileRead, FileCont, %FileChange%
Gui, Edit: Font, S8 Bold, Verdana
Gui, Edit: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Edit:+Owner
;Gui, Edit: Add, Edit, vMyEdit%REdit% h20 w460, %FileCont%
Gui, Edit: Add, Edit, y8 vMyEdit h20 w544, %FileCont%
Gui Edit:Add, Button, x20 y37 w70 h20 gTitleSave, OK
Gui Edit:Add, Button, x120 y37 w70 h20 gTitleCancel, Cancel
EdXm := pXm-846
EdYm := pYm-96
Gui, Edit: Show, x%EdXm% y%EdYm%
Return
TitleSave:
Gui, Edit: Submit, Destroy
fileAdd := FileOpen(FileChange, "w")
fileAdd.Write(MyEdit)
fileAdd.Close()
MyEdit :=""
Reload
Return
TitleCancel:
;Gui, Edit: Destroy
;Gosub, NewWindow
Reload
Return
ReducedM:
WinGetPos, XAct, YAct,,, A
Gui, ContextClip: Destroy
ControlSize :=1
Gosub, NotifyTrayClick_207
Return
NotifyTrayClick_207:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip1: Add, Button, x0 y%posy% w460 h20 gButtonTwo vNameTwo%A_Index%, %A_LoopReadLine%
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip1: Margin, 2, 2
Gui, ContextClip1: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd ;Menu3s
Gui, ContextClip1: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip1:+Owner
Gui, ContextClip1: Add, Button, x20 y%posyExit% w380 h20 gExitLabel, Exit Menu
Gui, ContextClip1: Add, Button, x400 y%posyExit% w60 h20 hwndIcon20 gExtendedM
Gui, ContextClip1: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip1: Add, Button, x0 y%posyExit% w20 h20 hwndIcon21
XPos:= A_ScreenWidth-(700)
YPos:= A_ScreenHeight-(alto+130)
If ControlSize=1
{
xPos := XAct
yPos := YAct
;MouseGetPos, XPos, YPos
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
return
ExtendedM:
WinGetPos, XActP, YActP,,, A
Gui, ContextClip1: Destroy
ControlSize :=""
ColtrolSizeP :=1
Gosub, RButton
Return
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
;MsgBox, %DelClip%
FileDelete, HTMLTemp\*%DelClip%.*
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
CorpusCount--
Gosub, RButton
}
Return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: New
Gui, Help: -Caption
Gui, Help: Color, EEAA99
Gui, Help: Margin, 12, 12
Gui, Help: Add, Picture, x2 y2 w640 h250, Resources\Help.jpg
Gui, Help: Add, Button, x495 y211 w100 h30 gExitButton, Exit
Gui, Help: Show, w640 h250
Return
ExitButton:
Gui, Help: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Resources\Close Window.mp3
Gui, Hide
Gui, CopyButtom:Hide
Return
;*************************************************************************
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace( status_button,"\D")
;MsgBox, %NumberFile%
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
;Gui,2: Show, x%X% y%Y%
status_button_old:=status_button
return
;*************************************************************************
Deletealert:
if (status_delete=status_delete_old)
return
Gui, 4:default
Gui, destroy
NumberDelete:= RegExReplace( status_delete,"\D")
if !NumberDelete
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Delete Clipboard Number %NumberDelete%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui margin, 0, 0
gui add, ActiveX, vWB w64 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
DelXm := pXm-944
GuiControl, Move, WB, h%maxBottom%
gui, 4: Show, x%DelXm% y%pYm% w64 h60
status_delete_old:=status_delete
Return
;*************************************************************************
Copyalert:
if (status_Copy=status_Copy_old)
return
Gui, 6:default
Gui, destroy
NumberCopy:= RegExReplace( status_Copy,"\D")
if !NumberCopy
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Copy Item %NumberCopy% as Current Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui margin, 0, 0
gui add, ActiveX, vWB w60 h72, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
;DelXm := pXm-953
GuiControl, Move, WB, h%maxBottom%
;gui, 6: Show, x%DelXm% y%pYm% w90 h4
gui, 6: Show, x%pXm% y%pYm% w60 h72
status_Copy_old:=status_Copy
Return
;*************************************************************************
URLalert:
if (status_URL=status_URL_old)
return
Gui, 5:default
Gui, destroy
NumberURL:= RegExReplace( status_URL,"\D")
URL_file := "HTMLTemp\URL" NumberURL ".txt"
if !URL_file
return
;Gui,2:Destroy
;URL_file := "HTMLTemp\URL" NumberURL ".txt"
FileRead, URLContents, %URL_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Go to: %URLContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui margin, 0, 0
gui add, ActiveX, vWB w543 h30, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
DelXm := pXm-817
DelYm := pYm-47
gui, 5: Show, x%DelXm% y%DelYm% w543 h30
status_URL_old:=status_URL
Return
;*************************************************************************
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace( status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Gui,5:Destroy
;Informat := "HTMLTemp\TextPlain" NumberPlane ".txt"
;FileRead, FileContents, %Informat%
FileRead, FileContents, %Text_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui margin, 0, 0
gui add, ActiveX, vWB w320 h220, HTMLfile
;gui add, ActiveX, vWB w700 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
;*************************************************************************
^F6::
ControlPaste:
MsgBox, 0x1034,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Hide
;Gui, Destroy
;Gui, -MinimizeBox
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Resources\Close Window.mp3
Return
^F10::
DeleteAll:
MsgBox, 0x1034,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
SavePDF:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, -MinimizeBox
Sleep, 1000
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, Resources\PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
FormatTime, CurrentDate,, dd-MM-yyyy
Filedate := "Documents\Final_Document_" CurrentDate ".pdf"
Filedateh := "Documents\oPDF_" CurrentDate ".html"
FileMove, Final_Document.pdf, %Filedate%
Run, %Filedate%
FileMove, ToPDF.html, %Filedateh%
;FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Return
^F11::
DeleteLast:
MsgBox, 0x1034,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
FileDelete, HTMLTemp\*%CorpusCount%.*
CorpusCount--
Return
^F12::
Suspend, Toggle
Return
^Esc::
Exit:
ExitApp
Return
Borrado:
FileDelete, Test.xml
;Filecopy, temp.xml, temp1.xml
FileDelete, temp.txt
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\Temp*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Return
ButtonTwo:
StringTrimLeft, NumberFile, a_guicontrol, 7
Gosub, ButtonLabel
Return
ButtonLabel:
;NumberFile:= RegExReplace(NameTwo,"\D")
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
Gui, ContextClip1: Destroy
Gui, ContextClip: Destroy
;Gui, Destroy
Gui,2: Destroy
Gui, Gui1: Destroy
;Gui, 2:default
;Gui, destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
ControlSize :=""
Alto:=""
Return
TxtLabel:
SoundPlay, Resources\Clipboard_Sound.mp3
StringTrimLeft, TextCopy, a_guicontrol, 5
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
Return
TxtPlane:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
global status_Delete ,tme
global status_URL ,tme
global status_Copy ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
status_Delete:=""
status_URL:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
if instr(a_guicontrol,"Delete")
{
status_Delete:=a_guicontrol
SetTimer, Deletealert,-20
}
if instr(a_guicontrol,"URL")
{
status_URL:=a_guicontrol
SetTimer, URLalert,-20
}
if instr(a_guicontrol,"Copy")
{
status_Copy:=a_guicontrol
SetTimer, Copyalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
status_Delete_old:=""
status_URL_old:=""
status_Copy_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
URLButton:
SoundPlay, Resources\Close Window.mp3
MsgBox, 0x1024,, Extract URL's from Clipboards?
IfMsgBox No
Return
Else
;URLCount := 1
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
}
}
Gosub, ExtractURL
FileDelete, ToPDF.html
Return
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
Return True
}
;************************************************************************************************************************
ExtractURL:
;Create header html document
FileAppend,
(
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=AutoHotkey.File>
<meta name=Generator content="AutoHotkey">
</head>
<body lang=es style='font-family:Calibri;font-size:11.0pt'>
), Extracted_Links.html
FormatTime, CurrentDate,, dd-MM-yyyy
DateIncl := "<p style='margin:0in'><span style='font-family:Times New Roman;font-size:11.0pt;color:#1E4D78'>Clipboard Session URLs: </span><span style='font-weight:bold;font-family:Calibri;font-size:12.0pt;color:#860000'>" CurrentDate "</span></p>"
FileAppend, %DateIncl%, Extracted_Links.html
;Add Line
myResult := "<p style='margin:0in;font-family:Calibri;font-size:11.0pt;color:#78230C'><p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>`r
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>`r"
FileAppend, %myResult%, Extracted_Links.html
;Routine loop, origin: https://www.autohotkey.com/docs/commands/LoopReadFile.htm
LinkCount := 0
ImgCount := 0
Loop, read, ToPDF.html, Extracted_Links.html
{
URLSearchString := A_LoopReadLine
Gosub, URLSearch
}
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links.html
Loop, read, Extracted_Links.html
{
If A_Index < 11
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
if A_Index > 11
if RegExMatch(A_LoopReadLine, "\.(jpg<|jpeg<|png<|gif<|svg<)")
{
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
ImgCount++ ; increment by one
}
else If InStr(A_LoopReadLine, "</ul>", True) and A_Index > 17
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links_Img.html
}
;URL number message, Optional
MsgBox %LinkCount% links were found and written to "Extracted_Links.html" `n %ImgCount% Images were found and written to "Extracted_Links_Img.html"
;Opcional, opens the result
FormatTime, CurrentDate,, dd-MM-yyyy
FileURL := "Documents\Extracted_Links_" CurrentDate ".html"
FileURLImg := "Documents\Extracted_Links_Img_" CurrentDate ".html"
FileMove, Extracted_Links.html, %FileURL%
FileMove, Extracted_Links_Img.html, %FileURLImg%
FileDelete, ToPDF.html
Run, %FileURL%
Run, %FileURLImg%
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
URLStart1 := InStr(URLSearchString, "https://")
URLStart2 := InStr(URLSearchString, "http://")
URLStart3 := InStr(URLSearchString, "ftp://")
URLStart4 := InStr(URLSearchString, "www.")
; Find the left-most starting position:
URLStart := URLStart1 ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
ArrayElement := URLStart%A_Index%
if (ArrayElement = "") ; End of the pseudo-array has been reached.
break
if (ArrayElement = 0) ; This element is disqualified.
continue
if (URLStart = 0)
URLStart := ArrayElement
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if (ArrayElement != 0)
if (ArrayElement < URLStart)
URLStart := ArrayElement
}
}
if (URLStart = 0) ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
URL := SubStr(URLSearchString, URLStart) ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%<> ; Find the first space, tab, or angle (if any).
{
URL := A_LoopField
break ; i.e. perform only one loop iteration to fetch the first "field".
}
StringReplace, URLCleansed, URL, ",, All
; Makes a second check to replace extraneous signs.
FixString := % URLCleansed
vList := "
(
%21 !
%23 #
%24 $
%26 &
%27 '
%28 (
%29 )
%2A *
%2B +
%2C ,
%3B ;
%2F /
%3A :
%3D =
%3F ?
%40 @
%5B [
%5D ]
%20
%C2%B4 ´
%2E .
%25 %
%2D -
%3C <
%3E >
%5C \
%5E ^
%5F _
%60 `
%7B {
%7C |
%7D }
%7E ~
%22 ""
\/ \
)"
Loop, Parse, vList, `n
{
oTemp := StrSplit(A_LoopField, "`t")
FixString := StrReplace(FixString, oTemp.1, oTemp.2)
}
oTemp := ""
ClipBoard := "<li style='margin-top:0;margin-bottom:0;vertical-align:middle'><p style='margin:0in;font-family:Calibri;font-size:10.0pt'><a href=" FixString ">" FixString "</a></p></li>"
FileAppend, %ClipBoard%`n
LinkCount += 1
; See if there are any other URLs in this line:
CharactersToOmit := StrLen(URL)
CharactersToOmit += URLStart
URLSearchString := SubStr(URLSearchString, CharactersToOmit)
Gosub, URLSearch ; Recursive call to self.
return
Nothing:
Return
Tray_Open:
ListLines
return
;**********************************************************************************************
TrayMenuHandler:
; Easy & Quick options first
If (A_ThisMenuItem = "&Reload this script")
{
Reload
Return
}
Else If (A_ThisMenuItem = "&Edit this script")
{
Run Edit %A_ScriptName%
Return
}
Else If (A_ThisMenuItem = "&Suspend Hotkeys")
{
Menu, tray, ToggleCheck, &Suspend Hotkeys
Suspend
Return
}
Else If (A_ThisMenuItem = "&Pause Script")
{
Menu, tray, ToggleCheck, &Pause Script
Pause
Return
}
; Settings menu
Else If (Trim(A_ThisMenuItem) = "Exit")
ExitApp
Return
^F1::
CaseMenu:
Menu Case, Add
Menu Case, DeleteAll
Menu Case, Add, &UPPERCASE, CCase
Menu Case, Add, &lowercase, CCase
Menu Case, Add, &Title Case, CCase
Menu Case, Add, &a Title to Case, CCase
Menu Case, Add, &Sentence case, CCase
Menu Case, Add
Menu Case, Add, &Remove Spaces, CCase
GetText(Txt)
If NOT ERRORLEVEL
Menu Case, Show
Return
CCase:
p:=A_ThisMenuItemPos
If (p=1)
StringUpper, Txt, Txt
Else If (p=2)
StringLower, Txt, Txt
Else If (p=3)
StringLower, Txt, Txt, T
Else If (p=4)
{
StringLower, Txt, Txt
;IMPORTANT! Change short words to be replaced in the following list according to each language or add more
lowers := ["a", "ha", "el", "y", "pero", "o", "para", "las", "es", "para", "por", "los", "con", "en", "que", "un", "de", "del", "la", "una", "cada", "en", "al", "por", "uno", "mi", "tu", "tú", "no", "ni", "sin", "se", "lo", "e", "su", "sí", "ser", "hay"]
for k, v in lowers
low .= (k = 1 ? "" : "|") . v
;Txt := RegExReplace(Txt, "(*UCP)(^\b|\b(?!(" . low . ")\b))\w+\b|\b\w+\b$", "$T0")
;Txt := RegExReplace(Txt, "((?:^|[.!?-]\s+)[a-z])", "$u1")
Txt := RegExReplace(Txt, "(*UCP)(^|\b(?!(" . low . ")\b))\w|(\.|\?|!)\s*\K\w|-\K\w", "$T0")
}
Else If (p=5)
{
StringLower, Txt, Txt
Txt := RegExReplace(Txt, "((?:^|[.!?]\s+)[a-z])", "$u1")
}
Else If (p=7)
{
Loop
{
StringReplace, Txt, Txt, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0
break
}
}
PutText(Txt)
Return
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^{vk43} ;Ctrl C
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard =
Sleep 20
Clipboard := MyText
Send ^{vk56} ;Ctrl V
Sleep 100
Clipboard := SavedClip
Return
}
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
#Include Library\ViewHtml.ahk
;#Include Library\ToolTipEx.ahk
#SingleInstance, Force
#InstallMousehook
;#Persistent
SetBatchLines, -1
Name := "Clipboard Utility - "
Version := "4.0d"
CoordMode, Mouse, Screen
Menu, Tray, Icon, Resources\Scissors.ico
Menu, Tray, NoStandard
Menu, tray, Add, %name% %version%, Nothing
Menu, tray, Icon, %name% %version%, Resources\Clipboard Utility.ico
Menu, tray, Add,
Menu Tray, Add, Open Info, Tray_Open
Menu Tray, Icon, Open Info, %A_ScriptDir%\Resources\Info.ico
Menu, tray, Add, &Reload this script , TrayMenuHandler
Menu, tray, Icon,&Reload this script , shell32.dll, 239
Menu, tray, Add, &Edit this script , TrayMenuHandler
Menu, tray, Icon,&Edit this script , comres.dll, 7
Menu, tray, Add,
Menu, tray, Add, &Suspend Hotkeys , TrayMenuHandler
Menu, tray, Icon,&Suspend Hotkeys , %A_AhkPath%, 3
Menu, tray, Add, &Pause Script , TrayMenuHandler
Menu, tray, Icon,&Pause Script , %A_AhkPath%, 4
;Menu, tray, Add, &Pause clipboard history, TrayMenuHandler
/*
;***********************************************************************
;loop, HTMLTemp\Corpus*.html
;CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
Menu, ClipboardID, add, %A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
Menu, Tray, add, Clipboard, :ClipboardID
Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
;***********************************************************************
Menu, winmanagetID, Add, Clipboard Window, RButtonAlt
Menu, winmanagetID, Add, Utility Window, WUtil
Menu, winmanagetID, Add, Copy Clipboard Window, CopyGui
Menu, winmanagetID, icon, Copy Clipboard Window, Resources\Clipboard Utility 1.ico
Menu, Tray, add, window management, :winmanagetID
Menu, tray, Icon, Window Management, %A_ScriptDir%\Resources\imageres.dll,322
*/
Menu, Tray, Add
Menu, Tray, Add, Save all Clipboard to PDF File, SavePDF
Menu, Tray, Icon, Save all Clipboard to PDF File, %A_ScriptDir%\Resources\PDF.ico
Menu, Tray, Add
Menu, Tray, Add, Extract URL's from clipboard, URLButton
Menu, Tray, Icon, Extract URL's from clipboard, %A_ScriptDir%\Resources\URL.ico
Menu, Tray, Add
Menu, DeleteID, Add, Delete Last Clipboard, DeleteLast
Menu, DeleteID, Add, Delete All Clipboard, DeleteAll
Menu, Tray, add, Delete Options, :DeleteID
Menu, tray, Icon, Delete Options, %A_ScriptDir%\Resources\Recycle 3.ico
Menu, Tray, Add
Menu, Tray, Add, Help, HelpButton
Menu, Tray, Icon, Help, %A_ScriptDir%\Resources\Help.ico
Menu, tray, Add, Exit , Exit
Menu, tray, Icon, Exit , shell32.dll, 132
Menu, Tray, Tip, Clipboard Utility 4.0d
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:+Owner
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, Resources\PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, Resources\PauseOff.png
GuiButtonIcon(Icon, "Resources\Clipboard Utility 1.ico", 1, "s90")
GoSub, Toggle_Switch
;CorpusCount := 0
;URLCount := 0
;Hotkey, LButton Up, off
/*
if FileExist("HTMLTemp\Text1.html")
MsgBox, 0x1034,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
*/
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
Gosub, RButton
Return
^F4::
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd
Gui, -Caption HwndHwnd
Gui, +Owner
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Add, Picture, x0 y0 w600 h167, Resources\Clipboard Utility_p.png
Gui, Add, Text, x0 y0 w552 h35 GuiMove ; , `&& Drag
Gui, Add, Picture, x0 y0 w552 h35, Resources\ArribaIzq.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "Resources\PDFup.png"
Gui1.Button1.HoverImage := "Resources\PDFhover.png"
Gui1.Button1.PressedImage := "Resources\PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Add, Picture, x16 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "Resources\PasteUp.png"
Gui1.Button2.HoverImage := "Resources\PasteHover.png"
Gui1.Button2.PressedImage := "Resources\PasteDown.png"
Gui1.Button2.Label := "ControlPaste"
Gui, Add, Picture, x158 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "Resources\ExitUp.png"
Gui1.Button3.HoverImage := "Resources\ExitHover.png"
Gui1.Button3.PressedImage := "Resources\ExitDown.png"
;Gui1.Button3.Label := "ExitLabel"
Gui1.Button3.Label := "ExitCopy"
Gui, Add, Picture, x553 y0 w48 h35 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "Resources\HelpUp.png"
Gui1.Button4.HoverImage := "Resources\HelpHover.png"
Gui1.Button4.PressedImage := "Resources\HelpDown.png"
Gui1.Button4.Label := "HelpButton"
Gui, Add, Picture, x444 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 5
;************************************************************************************************************************
Gui1.Button5 := {} ;Button 5
Gui1.Button5.DefaultImage := "Resources\UrlUp.png"
Gui1.Button5.HoverImage := "Resources\UrlHover.png"
Gui1.Button5.PressedImage := "Resources\UrlDown.png"
Gui1.Button5.Label := "URLButton"
Gui, Add, Picture, x300 y36 w141 h115 hwndhwnd, % Gui1.Button5.DefaultImage
Gui1.Handles[ hwnd ] := "Button5" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, Resources\ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
CorpusCount++
accData:= GetAccData()
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
Sleep 500
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Return
^F8::
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W81 h84
Return
+RButton::
RButton:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x520 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x540 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w20 h20 hwndIcon10 gClipDelete vDeleteButton%A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon9 gTitleEditing vEditing%A_Index%
Gui, ContextClip: Add, Button, x40 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "Resources\clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "Resources\128.ico", 1, "s32")
GuiButtonIcon(Icon8, "Resources\ArrowSmall.ico", 1, "s32")
GuiButtonIcon(Icon10, "Resources\recycle 2.ico", 1, "s32")
GuiButtonIcon(Icon9, "Resources\pencil 1.ico", 1, "s24")
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
;Gui, ContextClip: -Caption +ToolWindow +0x400000 +hWndhMainWnd ;Menu3s
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd
Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip:+Owner
Gui, ContextClip: Add, Button, x20 y%posyExit% w480 h20 gExitLabel, Exit Menu
Gui, ContextClip: Add, Button, x500 y%posyExit% w60 h20 hwndIcon11 gReducedM
Gui, ContextClip: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip: Add, Button, x0 y%posyExit% w20 h20 hwndIcon12
MouseGetPos, xpos1, ypos1
If ControlTwo=1
{
xpos1 := XActTwo-140
ypos1 := yActTwo
}
;xpos1 := xpos1-560
;ypos1 := ypos1-alto
Gui, ContextClip: Show, x%xpos1% y%ypos1% w560 h%Alto% ;Menu3s
GuiButtonIcon(Icon12, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon11, "Resources\ArrowRedu.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
TitleEditing:
Gosub, NewWindow
StringTrimLeft, REdit, a_guicontrol, 7
FileChange := "HTMLTemp\Name" REdit ".txt"
FileRead, FileCont, %FileChange%
Gui, Edit: Font, S8 Bold, Verdana
Gui, Edit: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Edit:+Owner
;Gui, Edit: Add, Edit, vMyEdit%REdit% h20 w460, %FileCont%
Gui, Edit: Add, Edit, y8 vMyEdit h20 w544, %FileCont%
Gui Edit:Add, Button, x20 y37 w70 h20 gTitleSave, OK
Gui Edit:Add, Button, x120 y37 w70 h20 gTitleCancel, Cancel
EdXm := pXm-846
EdYm := pYm-96
Gui, Edit: Show, x%EdXm% y%EdYm%
Return
TitleSave:
Gui, Edit: Submit, Destroy
fileAdd := FileOpen(FileChange, "w")
fileAdd.Write(MyEdit)
fileAdd.Close()
MyEdit :=""
Reload
Return
TitleCancel:
;Gui, Edit: Destroy
;Gosub, NewWindow
Reload
Return
ReducedM:
WinGetPos, XActOne, YActOne,,, A
Gui, ContextClip: Destroy
ControlOne :=1
ControlTwo :=0
Gosub, NotifyTrayClick_207
Return
NotifyTrayClick_207:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip1: Add, Button, x0 y%posy% w460 h20 gButtonTwo vNameTwo%A_Index%, %A_LoopReadLine%
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip1: Margin, 2, 2
Gui, ContextClip1: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd ;Menu3s
Gui, ContextClip1: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip1:+Owner
Gui, ContextClip1: Add, Button, x20 y%posyExit% w380 h20 gExitLabel, Exit Menu
Gui, ContextClip1: Add, Button, x400 y%posyExit% w60 h20 hwndIcon20 gExtendedM
Gui, ContextClip1: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip1: Add, Button, x0 y%posyExit% w20 h20 hwndIcon21
XPos:= A_ScreenWidth-(700)
YPos:= A_ScreenHeight-(alto+130)
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
return
ExtendedM:
WinGetPos, XActTwo, YActTwo,,, A
Gui, ContextClip1: Destroy
ControlOne :=0
ControlTwo :=1
Gosub, RButton
Return
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
;MsgBox, %DelClip%
FileDelete, HTMLTemp\*%DelClip%.*
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
CorpusCount--
Gosub, RButton
}
Return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: New
Gui, Help: -Caption
Gui, Help: Color, EEAA99
Gui, Help: Margin, 12, 12
Gui, Help: Add, Picture, x2 y2 w640 h250, Resources\Help.jpg
Gui, Help: Add, Button, x495 y211 w100 h30 gExitButton, Exit
Gui, Help: Show, w640 h250
Return
ExitButton:
Gui, Help: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Resources\Close Window.mp3
Gui, Hide
Gui, CopyButtom:Hide
Return
;*************************************************************************
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace(status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
Gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
status_button_old:=status_button
return
;*************************************************************************
Deletealert:
if (status_delete=status_delete_old)
return
Gui, 4:default
Gui, destroy
NumberDelete:= RegExReplace(status_delete,"\D")
if !NumberDelete
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Delete Clipboard Number %NumberDelete%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 4:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 4:margin, 0, 0
Gui, 4:add, ActiveX, vWB w64 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
DelXm := pXm-944
GuiControl, Move, WB, h%maxBottom%
Gui, 4: Show, x%DelXm% y%pYm% w64 h60
status_delete_old:=status_delete
Return
;*************************************************************************
Copyalert:
if (status_Copy=status_Copy_old)
return
Gui, 6:default
Gui, destroy
NumberCopy:= RegExReplace(status_Copy,"\D")
if !NumberCopy
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Copy Item %NumberCopy% as Current Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 6:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 6:margin, 0, 0
Gui, 6:add, ActiveX, vWB w60 h72, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 6: Show, x%pXm% y%pYm% w60 h72
status_Copy_old:=status_Copy
Return
;*************************************************************************
URLalert:
if (status_URL=status_URL_old)
return
Gui, 5:default
Gui, destroy
NumberURL:= RegExReplace(status_URL,"\D")
URL_file := "HTMLTemp\URL" NumberURL ".txt"
if !URL_file
return
;Gui,2:Destroy
;URL_file := "HTMLTemp\URL" NumberURL ".txt"
FileRead, URLContents, %URL_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Go to: %URLContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 5:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 5:margin, 0, 0
Gui, 5:add, ActiveX, vWB w543 h30, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
DelXm := pXm-817
DelYm := pYm-47
Gui, 5: Show, x%DelXm% y%DelYm% w543 h30
status_URL_old:=status_URL
Return
;*************************************************************************
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace(status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Gui,5:Destroy
FileRead, FileContents, %Text_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 3:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 3:margin, 0, 0
Gui, 3:add, ActiveX, vWB w320 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
;*************************************************************************
Editingalert:
if (status_Editing=status_Editing_old)
return
Gui, 6:default
Gui, destroy
EditingNumber:= RegExReplace(status_Editing,"\D")
if !EditingNumber
return
Gui,2:Destroy
Gui,5:Destroy
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Edit Title of the %EditingNumber%th Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 7: +AlwaysOnTop -Caption +ToolWindow Border
;Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui, 7:margin, 0, 0
gui, 7:add, ActiveX, vWB w62 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
;DelXm := pXm-953
GuiControl, Move, WB, h%maxBottom%
gui, 7: Show, x%pXm% y%pYm% w62 h60
status_Editing_old:=status_Editing
Return
;*************************************************************************
^F6::
ControlPaste:
MsgBox, 0x1034,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Hide
;Gui, Destroy
;Gui, -MinimizeBox
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Resources\Close Window.mp3
Return
^F10::
DeleteAll:
MsgBox, 0x1034,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
SavePDF:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, -MinimizeBox
Sleep, 1000
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, Resources\PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
FormatTime, CurrentDate,, dd-MM-yyyy
Filedate := "Documents\Final_Document_" CurrentDate ".pdf"
Filedateh := "Documents\oPDF_" CurrentDate ".html"
FileMove, Final_Document.pdf, %Filedate%
Run, %Filedate%
FileMove, ToPDF.html, %Filedateh%
;FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Return
^F11::
DeleteLast:
MsgBox, 0x1034,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
FileDelete, HTMLTemp\*%CorpusCount%.*
CorpusCount--
Return
^F12::
Suspend, Toggle
Return
^Esc::
Exit:
ExitApp
Return
Borrado:
FileDelete, Test.xml
;Filecopy, temp.xml, temp1.xml
FileDelete, temp.txt
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\Temp*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Return
ButtonTwo:
StringTrimLeft, NumberFile, a_guicontrol, 7
Gosub, ButtonLabel
Return
ButtonLabel:
;NumberFile:= RegExReplace(NameTwo,"\D")
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
Gui, ContextClip1: Destroy
Gui, ContextClip: Destroy
;Gui, Destroy
Gui,2: Destroy
Gui, Gui1: Destroy
;Gui, 2:default
;Gui, destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
ControlOne :=0
ControlTwo :=0
Alto:=0
Return
TxtLabel:
SoundPlay, Resources\Clipboard_Sound.mp3
StringTrimLeft, TextCopy, a_guicontrol, 5
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
Return
TxtPlane:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
global status_Delete ,tme
global status_URL ,tme
global status_Copy ,tme
global status_Editing ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
status_Delete:=""
status_URL:=""
status_Copy:=""
status_Editing:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
if instr(a_guicontrol,"Delete")
{
status_Delete:=a_guicontrol
SetTimer, Deletealert,-20
}
if instr(a_guicontrol,"URL")
{
status_URL:=a_guicontrol
SetTimer, URLalert,-20
}
if instr(a_guicontrol,"Copy")
{
status_Copy:=a_guicontrol
SetTimer, Copyalert,-20
}
if instr(a_guicontrol,"Editing")
{
status_Editing:=a_guicontrol
SetTimer, Editingalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
status_Delete_old:=""
status_URL_old:=""
status_Copy_old:=""
status_Editing_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
URLButton:
SoundPlay, Resources\Close Window.mp3
MsgBox, 0x1024,, Extract URL's from Clipboards?
IfMsgBox No
Return
Else
;URLCount := 1
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
}
}
Gosub, ExtractURL
FileDelete, ToPDF.html
Return
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
Return True
}
;************************************************************************************************************************
ExtractURL:
;Create header html document
FileAppend,
(
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=AutoHotkey.File>
<meta name=Generator content="AutoHotkey">
</head>
<body lang=es style='font-family:Calibri;font-size:11.0pt'>
), Extracted_Links.html
FormatTime, CurrentDate,, dd-MM-yyyy
DateIncl := "<p style='margin:0in'><span style='font-family:Times New Roman;font-size:11.0pt;color:#1E4D78'>Clipboard Session URLs: </span><span style='font-weight:bold;font-family:Calibri;font-size:12.0pt;color:#860000'>" CurrentDate "</span></p>"
FileAppend, %DateIncl%, Extracted_Links.html
;Add Line
myResult := "<p style='margin:0in;font-family:Calibri;font-size:11.0pt;color:#78230C'><p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>`r
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>`r"
FileAppend, %myResult%, Extracted_Links.html
;Routine loop, origin: https://www.autohotkey.com/docs/commands/LoopReadFile.htm
LinkCount := 0
ImgCount := 0
Loop, read, ToPDF.html, Extracted_Links.html
{
URLSearchString := A_LoopReadLine
Gosub, URLSearch
}
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links.html
Loop, read, Extracted_Links.html
{
If A_Index < 11
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
if A_Index > 11
if RegExMatch(A_LoopReadLine, "\.(jpg<|jpeg<|png<|gif<|svg<)")
{
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
ImgCount++ ; increment by one
}
else If InStr(A_LoopReadLine, "</ul>", True) and A_Index > 17
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links_Img.html
}
;URL number message, Optional
MsgBox %LinkCount% links were found and written to "Extracted_Links.html" `n %ImgCount% Images were found and written to "Extracted_Links_Img.html"
;Opcional, opens the result
FormatTime, CurrentDate,, dd-MM-yyyy
FileURL := "Documents\Extracted_Links_" CurrentDate ".html"
FileURLImg := "Documents\Extracted_Links_Img_" CurrentDate ".html"
FileMove, Extracted_Links.html, %FileURL%
FileMove, Extracted_Links_Img.html, %FileURLImg%
FileDelete, ToPDF.html
Run, %FileURL%
Run, %FileURLImg%
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
URLStart1 := InStr(URLSearchString, "https://")
URLStart2 := InStr(URLSearchString, "http://")
URLStart3 := InStr(URLSearchString, "ftp://")
URLStart4 := InStr(URLSearchString, "www.")
; Find the left-most starting position:
URLStart := URLStart1 ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
ArrayElement := URLStart%A_Index%
if (ArrayElement = "") ; End of the pseudo-array has been reached.
break
if (ArrayElement = 0) ; This element is disqualified.
continue
if (URLStart = 0)
URLStart := ArrayElement
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if (ArrayElement != 0)
if (ArrayElement < URLStart)
URLStart := ArrayElement
}
}
if (URLStart = 0) ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
URL := SubStr(URLSearchString, URLStart) ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%<> ; Find the first space, tab, or angle (if any).
{
URL := A_LoopField
break ; i.e. perform only one loop iteration to fetch the first "field".
}
StringReplace, URLCleansed, URL, ",, All
; Makes a second check to replace extraneous signs.
FixString := % URLCleansed
vList := "
(
%21 !
%23 #
%24 $
%26 &
%27 '
%28 (
%29 )
%2A *
%2B +
%2C ,
%3B ;
%2F /
%3A :
%3D =
%3F ?
%40 @
%5B [
%5D ]
%20
%C2%B4 ´
%2E .
%25 %
%2D -
%3C <
%3E >
%5C \
%5E ^
%5F _
%60 `
%7B {
%7C |
%7D }
%7E ~
%22 ""
\/ \
)"
Loop, Parse, vList, `n
{
oTemp := StrSplit(A_LoopField, "`t")
FixString := StrReplace(FixString, oTemp.1, oTemp.2)
}
oTemp := ""
ClipBoard := "<li style='margin-top:0;margin-bottom:0;vertical-align:middle'><p style='margin:0in;font-family:Calibri;font-size:10.0pt'><a href=" FixString ">" FixString "</a></p></li>"
FileAppend, %ClipBoard%`n
LinkCount += 1
; See if there are any other URLs in this line:
CharactersToOmit := StrLen(URL)
CharactersToOmit += URLStart
URLSearchString := SubStr(URLSearchString, CharactersToOmit)
Gosub, URLSearch ; Recursive call to self.
return
Nothing:
Return
Tray_Open:
ListLines
return
;**********************************************************************************************
TrayMenuHandler:
; Easy & Quick options first
If (A_ThisMenuItem = "&Reload this script")
{
Reload
Return
}
Else If (A_ThisMenuItem = "&Edit this script")
{
Run Edit %A_ScriptName%
Return
}
Else If (A_ThisMenuItem = "&Suspend Hotkeys")
{
Menu, tray, ToggleCheck, &Suspend Hotkeys
Suspend
Return
}
Else If (A_ThisMenuItem = "&Pause Script")
{
Menu, tray, ToggleCheck, &Pause Script
Pause
Return
}
; Settings menu
Else If (Trim(A_ThisMenuItem) = "Exit")
ExitApp
Return
^F1::
CaseMenu:
Menu Case, Add
Menu Case, DeleteAll
Menu Case, Add, &UPPERCASE, CCase
Menu Case, Add, &lowercase, CCase
Menu Case, Add, &Title Case, CCase
Menu Case, Add, &a Title to Case, CCase
Menu Case, Add, &Sentence case, CCase
Menu Case, Add
Menu Case, Add, &Remove Spaces, CCase
GetText(Txt)
If NOT ERRORLEVEL
Menu Case, Show
Return
CCase:
p:=A_ThisMenuItemPos
If (p=1)
StringUpper, Txt, Txt
Else If (p=2)
StringLower, Txt, Txt
Else If (p=3)
StringLower, Txt, Txt, T
Else If (p=4)
{
StringLower, Txt, Txt
;IMPORTANT! Change short words to be replaced in the following list according to each language or add more
lowers := ["a", "ha", "el", "y", "pero", "o", "para", "las", "es", "para", "por", "los", "con", "en", "que", "un", "de", "del", "la", "una", "cada", "en", "al", "por", "uno", "mi", "tu", "tú", "no", "ni", "sin", "se", "lo", "e", "su", "sí", "ser", "hay"]
for k, v in lowers
low .= (k = 1 ? "" : "|") . v
;Txt := RegExReplace(Txt, "(*UCP)(^\b|\b(?!(" . low . ")\b))\w+\b|\b\w+\b$", "$T0")
;Txt := RegExReplace(Txt, "((?:^|[.!?-]\s+)[a-z])", "$u1")
Txt := RegExReplace(Txt, "(*UCP)(^|\b(?!(" . low . ")\b))\w|(\.|\?|!)\s*\K\w|-\K\w", "$T0")
}
Else If (p=5)
{
StringLower, Txt, Txt
Txt := RegExReplace(Txt, "((?:^|[.!?]\s+)[a-z])", "$u1")
}
Else If (p=7)
{
Loop
{
StringReplace, Txt, Txt, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0
break
}
}
PutText(Txt)
Return
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^{vk43} ;Ctrl C
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard =
Sleep 20
Clipboard := MyText
Send ^{vk56} ;Ctrl V
Sleep 100
Clipboard := SavedClip
Return
}
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
#Include Library\ViewHtml.ahk
;#Include Library\ToolTipEx.ahk
#SingleInstance, Force
#InstallMousehook
;#Persistent
SetBatchLines, -1
Name := "Clipboard Utility - "
Version := "4.0e"
CoordMode, Mouse, Screen
;loop, HTMLTemp\Corpus*.html
;CorpusCount := % Floor(A_Index)
Menu, Tray, Icon, Resources\Scissors.ico
Menu, Tray, NoStandard
Menu, tray, Add, %name% %version%, Nothing
Menu, tray, Icon, %name% %version%, Resources\Clipboard Utility.ico
Menu, tray, Add,
Menu Tray, Add, Open Info, Tray_Open
Menu Tray, Icon, Open Info, %A_ScriptDir%\Resources\Info.ico
Menu, tray, Add, &Reload this script , TrayMenuHandler
Menu, tray, Icon,&Reload this script , shell32.dll, 239
Menu, tray, Add, &Edit this script , TrayMenuHandler
Menu, tray, Icon,&Edit this script , comres.dll, 7
Menu, tray, Add,
Menu, tray, Add, &Suspend Hotkeys , TrayMenuHandler
Menu, tray, Icon,&Suspend Hotkeys , %A_ScriptDir%\Resources\Scissors_Red.ico
;Menu, tray, Icon,&Suspend Hotkeys , %A_AhkPath%, 3
Menu, tray, Add, &Pause Script , TrayMenuHandler
;Menu, tray, Icon,&Pause Script , %A_AhkPath%, 4
Menu, tray, Icon,&Pause Script , %A_ScriptDir%\Resources\Scissors_Green.ico
;Menu, tray, Add, &Pause clipboard history, TrayMenuHandler
Menu, Tray, Add
;***********************************************************************
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
Menu, ClipboardID, add, %A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
Menu, Tray, add, Clipboard, :ClipboardID
Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
}
;***********************************************************************;
Menu, winmanagetID, Add, Clipboard Window, RButtonAlt
Menu, winmanagetID, icon, Clipboard Window, %A_ScriptDir%\Resources\Clipboard Utility.ico
Menu, winmanagetID, Add, Utility Window, WUtil
Menu, winmanagetID, icon, Utility Window, %A_ScriptDir%\Resources\75a.ico
Menu, winmanagetID, Add, Copy Clipboard Window, CopyGui
Menu, winmanagetID, icon, Copy Clipboard Window, Resources\Clipboard Utility 5.ico
Menu, Tray, add, Window Management, :winmanagetID
Menu, tray, Icon, Window Management, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add, Save all Clipboard to PDF File, SavePDF
Menu, Tray, Icon, Save all Clipboard to PDF File, %A_ScriptDir%\Resources\PDF.ico
;Menu, Tray, Add
Menu, Tray, Add, Extract URL's from clipboard, URLButton
Menu, Tray, Icon, Extract URL's from clipboard, %A_ScriptDir%\Resources\URL.ico
;Menu, Tray, Add
Menu, DeleteID, Add, Delete Last Clipboard, DeleteLast
Menu, DeleteID, Add, Delete All Clipboard, DeleteAll
Menu, Tray, add, Delete Options, :DeleteID
Menu, tray, Icon, Delete Options, %A_ScriptDir%\Resources\Recycle 3.ico
Menu, Tray, Add
Menu, Tray, Add, Help, HelpButton
Menu, Tray, Icon, Help, %A_ScriptDir%\Resources\Help.ico
Menu, Tray, Add
Menu, tray, Add, Exit , Exit
Menu, tray, Icon, Exit , shell32.dll, 132
Menu, Tray, Tip, Clipboard Utility 4.0d
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:+Owner
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, Resources\PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, Resources\PauseOff.png
GuiButtonIcon(Icon, "Resources\Clipboard Utility 5.ico", 1, "s90")
GoSub, Toggle_Switch
CorpusCount := 0
;Hotkey, LButton Up, off
/*
if FileExist("HTMLTemp\Text1.html")
MsgBox, 0x1034,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
*/
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
threeRButton=1
Gosub, RButton
Return
^F4::
GuiUtily:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd
Gui, -Caption HwndHwnd
Gui, +Owner
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Add, Picture, x0 y0 w600 h167, Resources\Clipboard Utility_p.png
Gui, Add, Text, x0 y0 w552 h35 GuiMove ; , `&& Drag
Gui, Add, Picture, x0 y0 w552 h35, Resources\ArribaIzq.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "Resources\PDFup.png"
Gui1.Button1.HoverImage := "Resources\PDFhover.png"
Gui1.Button1.PressedImage := "Resources\PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Add, Picture, x16 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "Resources\PasteUp.png"
Gui1.Button2.HoverImage := "Resources\PasteHover.png"
Gui1.Button2.PressedImage := "Resources\PasteDown.png"
Gui1.Button2.Label := "ControlPaste"
Gui, Add, Picture, x158 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "Resources\ExitUp.png"
Gui1.Button3.HoverImage := "Resources\ExitHover.png"
Gui1.Button3.PressedImage := "Resources\ExitDown.png"
;Gui1.Button3.Label := "ExitLabel"
Gui1.Button3.Label := "GuiClose"
Gui, Add, Picture, x553 y0 w48 h35 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "Resources\HelpUp.png"
Gui1.Button4.HoverImage := "Resources\HelpHover.png"
Gui1.Button4.PressedImage := "Resources\HelpDown.png"
Gui1.Button4.Label := "HelpButton"
Gui, Add, Picture, x444 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 5
;************************************************************************************************************************
Gui1.Button5 := {} ;Button 5
Gui1.Button5.DefaultImage := "Resources\UrlUp.png"
Gui1.Button5.HoverImage := "Resources\UrlHover.png"
Gui1.Button5.PressedImage := "Resources\UrlDown.png"
Gui1.Button5.Label := "URLButton"
Gui, Add, Picture, x300 y36 w141 h115 hwndhwnd, % Gui1.Button5.DefaultImage
Gui1.Handles[ hwnd ] := "Button5" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
/*
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
*/
MouseGetPos, xposUtil, yposUtil
If UtilButton=1
{
xposUtil := Floor((A_ScreenWidth/2)-450)
yposUtil := Floor((A_ScreenHeight/2)-200)
}
Gui, Show, x%xposUtil% y%yposUtil% W600 h167, Hover
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
WUtil:
UtilButton:=1
Gosub, GuiUtily
Return
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, Resources\ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
CorpusCount++
accData:= GetAccData()
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
Sleep 500
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Return
CopyGui:
CopyButton:=1
;GoSub, Toggle_Switch
Gosub, Menu2
Return
^F8::
Menu2:
;MouseGetPos, xpos1, ypos1
MouseGetPos, xposMen, yposMen
If CopyButton=1
{
xposMen := Floor(A_ScreenWidth/2)
yposMen := Floor(A_ScreenHeight/2-100)
}
Gui, CopyButtom:Show, x%xposMen% y%yposMen% W81 h84
Return
+RButton::
RButton:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x520 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x540 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w20 h20 hwndIcon10 gClipDelete vDeleteButton%A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon9 gTitleEditing vEditing%A_Index%
Gui, ContextClip: Add, Button, x40 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "Resources\clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "Resources\128.ico", 1, "s32")
GuiButtonIcon(Icon8, "Resources\ArrowSmall.ico", 1, "s32")
GuiButtonIcon(Icon10, "Resources\recycle 2.ico", 1, "s32")
GuiButtonIcon(Icon9, "Resources\pencil 1.ico", 1, "s24")
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
;Gui, ContextClip: -Caption +ToolWindow +0x400000 +hWndhMainWnd ;Menu3s
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd
Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip:+Owner
Gui, ContextClip: Add, Button, x20 y%posyExit% w480 h20 gExitLabel, Exit Menu
Gui, ContextClip: Add, Button, x500 y%posyExit% w60 h20 hwndIcon11 gReducedM
Gui, ContextClip: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip: Add, Button, x0 y%posyExit% w20 h20 hwndIcon12
MouseGetPos, xpos1, ypos1
If threeRButton=1
{
xpos1 := Floor((A_ScreenWidth/2)-450)
ypos1 := Floor((A_ScreenHeight/2)-200)
}
If ControlTwo=1
{
xpos1 := XActTwo-140
ypos1 := yActTwo
}
;xpos1 := xpos1-560
;ypos1 := ypos1-alto
Gui, ContextClip: Show, x%xpos1% y%ypos1% w560 h%Alto% ;Menu3s
GuiButtonIcon(Icon12, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon11, "Resources\ArrowRedu.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
RButtonAlt:
threeRButton :=1
Gosub, RButton
Return
TitleEditing:
Gosub, NewWindow
StringTrimLeft, REdit, a_guicontrol, 7
FileChange := "HTMLTemp\Name" REdit ".txt"
FileRead, FileCont, %FileChange%
Gui, Edit: Font, S8 Bold, Verdana
Gui, Edit: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Edit:+Owner
;Gui, Edit: Add, Edit, vMyEdit%REdit% h20 w460, %FileCont%
Gui, Edit: Add, Edit, y8 vMyEdit h20 w544, %FileCont%
Gui Edit:Add, Button, x20 y37 w70 h20 gTitleSave, OK
Gui Edit:Add, Button, x120 y37 w70 h20 gTitleCancel, Cancel
EdXm := pXm-846
EdYm := pYm-96
Gui, Edit: Show, x%EdXm% y%EdYm%
Return
TitleSave:
Gui, Edit: Submit, Destroy
fileAdd := FileOpen(FileChange, "w")
fileAdd.Write(MyEdit)
fileAdd.Close()
MyEdit :=""
Reload
Return
TitleCancel:
;Gui, Edit: Destroy
;Gosub, NewWindow
Reload
Return
ReducedM:
WinGetPos, XActOne, YActOne,,, A
Gui, ContextClip: Destroy
ControlOne :=1
ControlTwo :=0
Gosub, NotifyTrayClick_207
Return
NotifyTrayClick_207:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip1: Add, Button, x0 y%posy% w460 h20 gButtonTwo vTwoButton%A_Index%, %A_LoopReadLine%
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip1: Margin, 2, 2
Gui, ContextClip1: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd ;Menu31s
Gui, ContextClip1: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip1:+Owner
Gui, ContextClip1: Add, Button, x20 y%posyExit% w380 h20 gExitLabel, Exit Menu
Gui, ContextClip1: Add, Button, x400 y%posyExit% w60 h20 hwndIcon20 gExtendedM
Gui, ContextClip1: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip1: Add, Button, x0 y%posyExit% w20 h20 hwndIcon21
AltoT := Floor((CorpusCount+1)*31.5)
XPos:= A_ScreenWidth-(700)
YPos:= A_ScreenHeight-AltoT-60
;YPos:= A_ScreenHeight-(alto+130)
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
/*
;AltoT := Floor((CorpusCount+1)*31.5)
;AltoT := (CorpusCount+1)*31.5
XPos:= A_ScreenWidth-696
Ypos:= A_ScreenHigh-126
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
;WinGetPos, XTwo, YTwo, WTwo, HTwo, A
;MsgBox, %XTwo% %YTwo% %WTwo% %HTwo%
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
*/
ExtendedM:
WinGetPos, XActTwo, YActTwo,,, A
Gui, ContextClip1: Destroy
ControlOne :=0
ControlTwo :=1
Gosub, RButton
Return
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
FileDelete, HTMLTemp\Corpus%DelClip%.html
FileDelete, HTMLTemp\image%DelClip%.jpg
FileDelete, HTMLTemp\Name%DelClip%.txt
FileDelete, HTMLTemp\Text%DelClip%.html
FileDelete, HTMLTemp\TextPlain%DelClip%.txt
FileDelete, HTMLTemp\URL%DelClip%.txt
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
;CorpusCount--
;Gosub, RButton
Reload
}
Return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: New
Gui, Help: -Caption
Gui, Help: +Owner
Gui, Help: Color, EEAA99
Gui, Help: Margin, 0, 0
Gui, Help: Add, Picture, x0 y0 w640 h250, Resources\Help.jpg
Gui, Help: Add, Button, x495 y209 w100 h30 gNextButton, More...
Gui, Help: Show, w640 h250
Return
NextButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: Destroy
Gui, Help2: New
Gui, Help2: -Caption
Gui, Help2: +Owner
Gui, Help2: Color, EEAA99
Gui, Help2: Margin, 0, 0
Gui, Help2: Add, Picture, x0 y0 w800 h397, Resources\Clipboard Utility Screenshot.jpg
Gui, Help2: Add, Button, x10 y340 w100 h30 gExitButton, Exit
Gui, Help2: Show, w800 h397
Return
ExitButton:
Gui, Help2: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Resources\Close Window.mp3
CopyButton=0
UtilButton :=0
Gui, Hide
Gui, CopyButtom:Hide
Return
;*************************************************************************
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace(status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
Gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
status_button_old:=status_button
return
;*************************************************************************
Deletealert:
if (status_delete=status_delete_old)
return
Gui, 4:default
Gui, destroy
NumberDelete:= RegExReplace(status_delete,"\D")
if !NumberDelete
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Delete Clipboard Number %NumberDelete%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 4:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 4:margin, 0, 0
Gui, 4:add, ActiveX, vWB w64 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
DelXm := pXm-944
GuiControl, Move, WB, h%maxBottom%
Gui, 4: Show, x%DelXm% y%pYm% w64 h60
status_delete_old:=status_delete
Return
;*************************************************************************
Copyalert:
if (status_Copy=status_Copy_old)
return
Gui, 6:default
Gui, destroy
NumberCopy:= RegExReplace(status_Copy,"\D")
if !NumberCopy
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Copy Item %NumberCopy% as Current Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 6:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 6:margin, 0, 0
Gui, 6:add, ActiveX, vWB w60 h72, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 6: Show, x%pXm% y%pYm% w60 h72
status_Copy_old:=status_Copy
Return
;*************************************************************************
URLalert:
if (status_URL=status_URL_old)
return
Gui, 5:default
Gui, destroy
NumberURL:= RegExReplace(status_URL,"\D")
URL_file := "HTMLTemp\URL" NumberURL ".txt"
if !URL_file
return
;Gui,2:Destroy
;URL_file := "HTMLTemp\URL" NumberURL ".txt"
FileRead, URLContents, %URL_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Go to: %URLContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 5:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 5:margin, 0, 0
Gui, 5:add, ActiveX, vWB w562 h30, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
DelXm := pXm-845
;DelXm := pXm-819
DelYm := pYm-47
;Gui, 5: Show, x%DelXm% y%DelYm% w543 h30
Gui, 5: Show, x%DelXm% y%DelYm% w562 h30
status_URL_old:=status_URL
Return
;*************************************************************************
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace(status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Gui,5:Destroy
FileRead, FileContents, %Text_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 3:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 3:margin, 0, 0
Gui, 3:add, ActiveX, vWB w320 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
;*************************************************************************
Editingalert:
if (status_Editing=status_Editing_old)
return
Gui, 6:default
Gui, destroy
EditingNumber:= RegExReplace(status_Editing,"\D")
if !EditingNumber
return
Gui,2:Destroy
Gui,5:Destroy
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Edit Title of the %EditingNumber%th Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 7: +AlwaysOnTop -Caption +ToolWindow Border
;Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui, 7:margin, 0, 0
gui, 7:add, ActiveX, vWB w62 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
;DelXm := pXm-953
GuiControl, Move, WB, h%maxBottom%
gui, 7: Show, x%pXm% y%pYm% w62 h60
status_Editing_old:=status_Editing
Return
;*************************************************************************
^F6::
ControlPaste:
MsgBox, 0x1034,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Hide
;Gui, Destroy
;Gui, -MinimizeBox
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Resources\Close Window.mp3
Return
^F10::
DeleteAll:
MsgBox, 0x1034,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
SavePDF:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, -MinimizeBox
Sleep, 1000
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, Resources\PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
FormatTime, CurrentDate,, dd-MM-yyyy
Filedate := "Documents\Final_Document_" CurrentDate ".pdf"
Filedateh := "Documents\oPDF_" CurrentDate ".html"
FileMove, Final_Document.pdf, %Filedate%
Run, %Filedate%
FileMove, ToPDF.html, %Filedateh%
;FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Return
^F11::
DeleteLast:
MsgBox, 0x1034,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
FileDelete, HTMLTemp\*%CorpusCount%.*
CorpusCount--
Return
^F12::
Suspend, Toggle
Return
^Esc::
Exit:
ExitApp
Return
Borrado:
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Reload
Return
ButtonTwo:
StringTrimLeft, NumberFile, a_guicontrol, 9
;Gui, 2: Destroy
;Gui, ContextClip: Destroy
Gosub, ButtonLabel
Return
ButtonLabelTray:
If CorpusCount=0
Return
NumberFile:=A_ThisMenuItemPos
Gosub, ButtonLabel
Return
ButtonLabel:
;NumberFile:= RegExReplace(NameTwo,"\D")
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
SoundPlay, Resources\Close Window.mp3
Gui, ContextClip1: Destroy
Gui, ContextClip: Destroy
;Gui, Destroy
Gui,2: Destroy
Gui, Gui1: Destroy
;Gui, 2:default
;Gui, destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
ControlOne :=0
ControlTwo :=0
threeRButton :=0
Alto:=0
Return
TxtLabel:
SoundPlay, Resources\Clipboard_Sound.mp3
StringTrimLeft, TextCopy, a_guicontrol, 5
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
Return
TxtPlane:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
global status_Delete ,tme
global status_URL ,tme
global status_Copy ,tme
global status_Editing ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
status_Delete:=""
status_URL:=""
status_Copy:=""
status_Editing:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
if instr(a_guicontrol,"Delete")
{
status_Delete:=a_guicontrol
SetTimer, Deletealert,-20
}
if instr(a_guicontrol,"URL")
{
status_URL:=a_guicontrol
SetTimer, URLalert,-20
}
if instr(a_guicontrol,"Copy")
{
status_Copy:=a_guicontrol
SetTimer, Copyalert,-20
}
if instr(a_guicontrol,"Editing")
{
status_Editing:=a_guicontrol
SetTimer, Editingalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
status_Delete_old:=""
status_URL_old:=""
status_Copy_old:=""
status_Editing_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
URLButton:
SoundPlay, Resources\Close Window.mp3
MsgBox, 0x1024,, Extract URL's from Clipboards?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
}
}
Gosub, ExtractURL
FileDelete, ToPDF.html
Return
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
Return True
}
;************************************************************************************************************************
ExtractURL:
;Create header html document
FileAppend,
(
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=AutoHotkey.File>
<meta name=Generator content="AutoHotkey">
</head>
<body lang=es style='font-family:Calibri;font-size:11.0pt'>
), Extracted_Links.html
FormatTime, CurrentDate,, dd-MM-yyyy
DateIncl := "<p style='margin:0in'><span style='font-family:Times New Roman;font-size:11.0pt;color:#1E4D78'>Clipboard Session URLs: </span><span style='font-weight:bold;font-family:Calibri;font-size:12.0pt;color:#860000'>" CurrentDate "</span></p>"
FileAppend, %DateIncl%, Extracted_Links.html
;Add Line
myResult := "<p style='margin:0in;font-family:Calibri;font-size:11.0pt;color:#78230C'><p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>`r
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>`r"
FileAppend, %myResult%, Extracted_Links.html
;Routine loop, origin: https://www.autohotkey.com/docs/commands/LoopReadFile.htm
LinkCount := 0
ImgCount := 0
Loop, read, ToPDF.html, Extracted_Links.html
{
URLSearchString := A_LoopReadLine
Gosub, URLSearch
}
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links.html
Loop, read, Extracted_Links.html
{
If A_Index < 11
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
if A_Index > 11
if RegExMatch(A_LoopReadLine, "\.(jpg<|jpeg<|png<|gif<|svg<)")
{
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
ImgCount++ ; increment by one
}
else If InStr(A_LoopReadLine, "</ul>", True) and A_Index > 17
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links_Img.html
}
;URL number message, Optional
MsgBox %LinkCount% links were found and written to "Extracted_Links.html" `n %ImgCount% Images were found and written to "Extracted_Links_Img.html"
;Opcional, opens the result
FormatTime, CurrentDate,, dd-MM-yyyy
FileURL := "Documents\Extracted_Links_" CurrentDate ".html"
FileURLImg := "Documents\Extracted_Links_Img_" CurrentDate ".html"
FileMove, Extracted_Links.html, %FileURL%
FileMove, Extracted_Links_Img.html, %FileURLImg%
FileDelete, ToPDF.html
Run, %FileURL%
Run, %FileURLImg%
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
URLStart1 := InStr(URLSearchString, "https://")
URLStart2 := InStr(URLSearchString, "http://")
URLStart3 := InStr(URLSearchString, "ftp://")
URLStart4 := InStr(URLSearchString, "www.")
; Find the left-most starting position:
URLStart := URLStart1 ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
ArrayElement := URLStart%A_Index%
if (ArrayElement = "") ; End of the pseudo-array has been reached.
break
if (ArrayElement = 0) ; This element is disqualified.
continue
if (URLStart = 0)
URLStart := ArrayElement
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if (ArrayElement != 0)
if (ArrayElement < URLStart)
URLStart := ArrayElement
}
}
if (URLStart = 0) ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
URL := SubStr(URLSearchString, URLStart) ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%<> ; Find the first space, tab, or angle (if any).
{
URL := A_LoopField
break ; i.e. perform only one loop iteration to fetch the first "field".
}
StringReplace, URLCleansed, URL, ",, All
; Makes a second check to replace extraneous signs.
FixString := % URLCleansed
vList := "
(
%21 !
%23 #
%24 $
%26 &
%27 '
%28 (
%29 )
%2A *
%2B +
%2C ,
%3B ;
%2F /
%3A :
%3D =
%3F ?
%40 @
%5B [
%5D ]
%20
%C2%B4 ´
%2E .
%25 %
%2D -
%3C <
%3E >
%5C \
%5E ^
%5F _
%60 `
%7B {
%7C |
%7D }
%7E ~
%22 ""
\/ \
)"
Loop, Parse, vList, `n
{
oTemp := StrSplit(A_LoopField, "`t")
FixString := StrReplace(FixString, oTemp.1, oTemp.2)
}
oTemp := ""
ClipBoard := "<li style='margin-top:0;margin-bottom:0;vertical-align:middle'><p style='margin:0in;font-family:Calibri;font-size:10.0pt'><a href=" FixString ">" FixString "</a></p></li>"
FileAppend, %ClipBoard%`n
LinkCount += 1
; See if there are any other URLs in this line:
CharactersToOmit := StrLen(URL)
CharactersToOmit += URLStart
URLSearchString := SubStr(URLSearchString, CharactersToOmit)
Gosub, URLSearch ; Recursive call to self.
return
Nothing:
Return
Tray_Open:
ListLines
return
;**********************************************************************************************
TrayMenuHandler:
; Easy & Quick options first
If (A_ThisMenuItem = "&Reload this script")
{
Reload
Return
}
Else If (A_ThisMenuItem = "&Edit this script")
{
Run Edit %A_ScriptName%
Return
}
Else If (A_ThisMenuItem = "&Suspend Hotkeys")
{
Menu, tray, ToggleCheck, &Suspend Hotkeys
Suspend
Return
}
Else If (A_ThisMenuItem = "&Pause Script")
{
Menu, tray, ToggleCheck, &Pause Script
Pause
Return
}
; Settings menu
Else If (Trim(A_ThisMenuItem) = "Exit")
ExitApp
Return
^F1::
CaseMenu:
Menu Case, Add
Menu Case, DeleteAll
Menu Case, Add, &UPPERCASE, CCase
Menu Case, Add, &lowercase, CCase
Menu Case, Add, &Title Case, CCase
Menu Case, Add, &a Title to Case, CCase
Menu Case, Add, &Sentence case, CCase
Menu Case, Add
Menu Case, Add, &Remove Spaces, CCase
GetText(Txt)
If NOT ERRORLEVEL
Menu Case, Show
Return
CCase:
p:=A_ThisMenuItemPos
If (p=1)
StringUpper, Txt, Txt
Else If (p=2)
StringLower, Txt, Txt
Else If (p=3)
StringLower, Txt, Txt, T
Else If (p=4)
{
StringLower, Txt, Txt
;IMPORTANT! Change short words to be replaced in the following list according to each language or add more
lowers := ["a", "ha", "el", "y", "pero", "o", "para", "las", "es", "para", "por", "los", "con", "en", "que", "un", "de", "del", "la", "una", "cada", "en", "al", "por", "uno", "mi", "tu", "tú", "no", "ni", "sin", "se", "lo", "e", "su", "sí", "ser", "hay"]
for k, v in lowers
low .= (k = 1 ? "" : "|") . v
;Txt := RegExReplace(Txt, "(*UCP)(^\b|\b(?!(" . low . ")\b))\w+\b|\b\w+\b$", "$T0")
;Txt := RegExReplace(Txt, "((?:^|[.!?-]\s+)[a-z])", "$u1")
Txt := RegExReplace(Txt, "(*UCP)(^|\b(?!(" . low . ")\b))\w|(\.|\?|!)\s*\K\w|-\K\w", "$T0")
}
Else If (p=5)
{
StringLower, Txt, Txt
Txt := RegExReplace(Txt, "((?:^|[.!?]\s+)[a-z])", "$u1")
}
Else If (p=7)
{
Loop
{
StringReplace, Txt, Txt, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0
break
}
}
PutText(Txt)
Return
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^{vk43} ;Ctrl C
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard =
Sleep 20
Clipboard := MyText
Send ^{vk56} ;Ctrl V
Sleep 100
Clipboard := SavedClip
Return
}
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
#Include Library\ViewHtml.ahk
;#Include Library\ToolTipEx.ahk
#SingleInstance, Force
#InstallMousehook
;#Persistent
SetBatchLines, -1
Name := "Clipboard Utility - "
Version := "4.0e1"
CoordMode, Mouse, Screen
CoordMode, Mouse, Screen
CorpusCount := 0
Iniciate:= 0
;Hotkey, LButton Up, off
;loop, HTMLTemp\Corpus*.html
;CorpusCount := % Floor(A_Index)
Menu, Tray, Icon, Resources\Scissors.ico
Menu, Tray, NoStandard
Menu, tray, Add, %name% %version%, Nothing
Menu, tray, Icon, %name% %version%, Resources\Clipboard Utility.ico
Menu, Tray, Add
Menu, tray, Add, Exit , Exit
Menu, tray, Icon, Exit , shell32.dll, 132
Menu, Tray, Add
Menu, Tray, Add, Help, HelpButton
Menu, Tray, Icon, Help, %A_ScriptDir%\Resources\Help.ico
Menu, Tray, Add
Menu Tray, Add, Open Info, Tray_Open
Menu Tray, Icon, Open Info, %A_ScriptDir%\Resources\Info.ico
Menu, tray, Add, &Reload this script , TrayMenuHandler
Menu, tray, Icon,&Reload this script , shell32.dll, 239
Menu, tray, Add, &Edit this script , TrayMenuHandler
Menu, tray, Icon,&Edit this script , comres.dll, 7
Menu, tray, Add,
Menu, tray, Add, &Suspend Hotkeys , TrayMenuHandler
Menu, tray, Icon,&Suspend Hotkeys , %A_ScriptDir%\Resources\Scissors_Red.ico
;Menu, tray, Icon,&Suspend Hotkeys , %A_AhkPath%, 3
Menu, tray, Add, &Pause Script , TrayMenuHandler
;Menu, tray, Icon,&Pause Script , %A_AhkPath%, 4
Menu, tray, Icon,&Pause Script , %A_ScriptDir%\Resources\Scissors_Green.ico
;Menu, tray, Add, &Pause clipboard history, TrayMenuHandler
Menu, Tray, Add
Menu, winmanagetID, Add, Clipboard Window, RButtonAlt
Menu, winmanagetID, icon, Clipboard Window, %A_ScriptDir%\Resources\Clipboard Utility.ico
Menu, winmanagetID, Add, Utility Window, WUtil
Menu, winmanagetID, icon, Utility Window, %A_ScriptDir%\Resources\75a.ico
Menu, winmanagetID, Add, Copy Clipboard Window, CopyGui
Menu, winmanagetID, icon, Copy Clipboard Window, Resources\Clipboard Utility 5.ico
Menu, Tray, add, Window Management, :winmanagetID
Menu, tray, Icon, Window Management, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add, Save all Clipboard to PDF File, SavePDF
Menu, Tray, Icon, Save all Clipboard to PDF File, %A_ScriptDir%\Resources\PDF.ico
;Menu, Tray, Add
Menu, Tray, Add, Extract URL's from clipboard, URLButton
Menu, Tray, Icon, Extract URL's from clipboard, %A_ScriptDir%\Resources\URL.ico
;Menu, Tray, Add
Menu, DeleteID, Add, Delete Last Clipboard, DeleteLast
Menu, DeleteID, Add, Delete All Clipboard, DeleteAll
Menu, Tray, add, Delete Options, :DeleteID
Menu, tray, Icon, Delete Options, %A_ScriptDir%\Resources\Recycle 3.ico
Menu, Tray, Add
ReloadMenu:
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
Menu, ClipboardID, add, %A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
Menu, Tray, add, Clipboard, :ClipboardID
Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
}
Menu, Tray, Tip, Clipboard Utility 4.0e1
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:+Owner
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, Resources\PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, Resources\PauseOff.png
GuiButtonIcon(Icon, "Resources\Clipboard Utility 5.ico", 1, "s90")
GoSub, Toggle_Switch
;CorpusCount := 0
/*
if FileExist("HTMLTemp\Text1.html")
MsgBox, 0x1034,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
*/
if !FileExist(HTMLTemp)
{
FileCreateDir, HTMLTemp
}
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
threeRButton=1
If !Iniciate=1
Gosub, RButton
Return
^F4::
GuiUtily:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd
Gui, -Caption HwndHwnd
Gui, +Owner
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Add, Picture, x0 y0 w600 h167, Resources\Clipboard Utility_p.png
Gui, Add, Text, x0 y0 w552 h35 GuiMove ; , `&& Drag
Gui, Add, Picture, x0 y0 w552 h35, Resources\ArribaIzq.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "Resources\PDFup.png"
Gui1.Button1.HoverImage := "Resources\PDFhover.png"
Gui1.Button1.PressedImage := "Resources\PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Add, Picture, x16 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "Resources\PasteUp.png"
Gui1.Button2.HoverImage := "Resources\PasteHover.png"
Gui1.Button2.PressedImage := "Resources\PasteDown.png"
Gui1.Button2.Label := "ControlPaste"
Gui, Add, Picture, x158 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "Resources\ExitUp.png"
Gui1.Button3.HoverImage := "Resources\ExitHover.png"
Gui1.Button3.PressedImage := "Resources\ExitDown.png"
;Gui1.Button3.Label := "ExitLabel"
Gui1.Button3.Label := "GuiClose"
Gui, Add, Picture, x553 y0 w48 h35 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "Resources\HelpUp.png"
Gui1.Button4.HoverImage := "Resources\HelpHover.png"
Gui1.Button4.PressedImage := "Resources\HelpDown.png"
Gui1.Button4.Label := "HelpButton"
Gui, Add, Picture, x444 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 5
;************************************************************************************************************************
Gui1.Button5 := {} ;Button 5
Gui1.Button5.DefaultImage := "Resources\UrlUp.png"
Gui1.Button5.HoverImage := "Resources\UrlHover.png"
Gui1.Button5.PressedImage := "Resources\UrlDown.png"
Gui1.Button5.Label := "URLButton"
Gui, Add, Picture, x300 y36 w141 h115 hwndhwnd, % Gui1.Button5.DefaultImage
Gui1.Handles[ hwnd ] := "Button5" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
/*
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
*/
MouseGetPos, xposUtil, yposUtil
If UtilButton=1
{
xposUtil := Floor((A_ScreenWidth/2)-450)
yposUtil := Floor((A_ScreenHeight/2)-200)
}
Gui, Show, x%xposUtil% y%yposUtil% W600 h167, Hover
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
WUtil:
UtilButton:=1
Gosub, GuiUtily
Return
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, Resources\ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
CorpusCount++
accData:= GetAccData()
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
Sleep 500
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Iniciate:=1
Gosub, ReloadMenu
Return
CopyGui:
CopyButton:=1
;GoSub, Toggle_Switch
Gosub, Menu2
Return
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
FileDelete, HTMLTemp\Corpus%DelClip%.html
FileDelete, HTMLTemp\image%DelClip%.jpg
FileDelete, HTMLTemp\Name%DelClip%.txt
FileDelete, HTMLTemp\Text%DelClip%.html
FileDelete, HTMLTemp\TextPlain%DelClip%.txt
FileDelete, HTMLTemp\URL%DelClip%.txt
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
;CorpusCount--
;Gosub, RButton
Iniciate:=0
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
}
Return
^F8::
Menu2:
;MouseGetPos, xpos1, ypos1
MouseGetPos, xposMen, yposMen
If CopyButton=1
{
xposMen := Floor(A_ScreenWidth/2)
yposMen := Floor(A_ScreenHeight/2-100)
}
Gui, CopyButtom:Show, x%xposMen% y%yposMen% W81 h84
Return
+RButton::
RButton:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x520 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x540 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w20 h20 hwndIcon10 gClipDelete vDeleteButton%A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon9 gTitleEditing vEditing%A_Index%
Gui, ContextClip: Add, Button, x40 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "Resources\clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "Resources\128.ico", 1, "s32")
GuiButtonIcon(Icon8, "Resources\ArrowSmall.ico", 1, "s32")
GuiButtonIcon(Icon10, "Resources\recycle 2.ico", 1, "s32")
GuiButtonIcon(Icon9, "Resources\pencil 1.ico", 1, "s24")
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
;Gui, ContextClip: -Caption +ToolWindow +0x400000 +hWndhMainWnd ;Menu3s
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd
Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip:+Owner
Gui, ContextClip: Add, Button, x20 y%posyExit% w480 h20 gExitLabel, Exit Menu
Gui, ContextClip: Add, Button, x500 y%posyExit% w60 h20 hwndIcon11 gReducedM
Gui, ContextClip: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip: Add, Button, x0 y%posyExit% w20 h20 hwndIcon12
MouseGetPos, xpos1, ypos1
If threeRButton=1
{
xpos1 := Floor((A_ScreenWidth/2)-450)
ypos1 := Floor((A_ScreenHeight/2)-200)
}
If ControlTwo=1
{
xpos1 := XActTwo-140
ypos1 := yActTwo
}
;xpos1 := xpos1-560
;ypos1 := ypos1-alto
Gui, ContextClip: Show, x%xpos1% y%ypos1% w560 h%Alto% ;Menu3s
GuiButtonIcon(Icon12, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon11, "Resources\ArrowRedu.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
RButtonAlt:
threeRButton :=1
Gosub, RButton
Return
TitleEditing:
Gosub, NewWindow
StringTrimLeft, REdit, a_guicontrol, 7
FileChange := "HTMLTemp\Name" REdit ".txt"
FileRead, FileCont, %FileChange%
Gui, Edit: Font, S8 Bold, Verdana
Gui, Edit: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Edit:+Owner
;Gui, Edit: Add, Edit, vMyEdit%REdit% h20 w460, %FileCont%
Gui, Edit: Add, Edit, y8 vMyEdit h20 w544, %FileCont%
Gui Edit:Add, Button, x20 y37 w70 h20 gTitleSave, OK
Gui Edit:Add, Button, x120 y37 w70 h20 gTitleCancel, Cancel
EdXm := pXm-846
EdYm := pYm-96
Gui, Edit: Show, x%EdXm% y%EdYm%
Return
TitleSave:
Gui, Edit: Submit, Destroy
fileAdd := FileOpen(FileChange, "w")
fileAdd.Write(MyEdit)
fileAdd.Close()
MyEdit :=""
Reload
Return
TitleCancel:
;Gui, Edit: Destroy
;Gosub, NewWindow
Reload
Return
ReducedM:
WinGetPos, XActOne, YActOne,,, A
Gui, ContextClip: Destroy
ControlOne :=1
ControlTwo :=0
Gosub, NotifyTrayClick_207
Return
NotifyTrayClick_207:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip1: Add, Button, x0 y%posy% w460 h20 gButtonTwo vTwoButton%A_Index%, %A_LoopReadLine%
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip1: Margin, 2, 2
Gui, ContextClip1: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd ;Menu31s
Gui, ContextClip1: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip1:+Owner
Gui, ContextClip1: Add, Button, x20 y%posyExit% w380 h20 gExitLabel, Exit Menu
Gui, ContextClip1: Add, Button, x400 y%posyExit% w60 h20 hwndIcon20 gExtendedM
Gui, ContextClip1: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip1: Add, Button, x0 y%posyExit% w20 h20 hwndIcon21
AltoT := Floor((CorpusCount+1)*31.5)
XPos:= A_ScreenWidth-(700)
YPos:= A_ScreenHeight-AltoT-60
;YPos:= A_ScreenHeight-(alto+130)
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
/*
;AltoT := Floor((CorpusCount+1)*31.5)
;AltoT := (CorpusCount+1)*31.5
XPos:= A_ScreenWidth-696
Ypos:= A_ScreenHigh-126
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
;WinGetPos, XTwo, YTwo, WTwo, HTwo, A
;MsgBox, %XTwo% %YTwo% %WTwo% %HTwo%
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
*/
ExtendedM:
WinGetPos, XActTwo, YActTwo,,, A
Gui, ContextClip1: Destroy
ControlOne :=0
ControlTwo :=1
Gosub, RButton
Return
/*
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
FileDelete, HTMLTemp\Corpus%DelClip%.html
FileDelete, HTMLTemp\image%DelClip%.jpg
FileDelete, HTMLTemp\Name%DelClip%.txt
FileDelete, HTMLTemp\Text%DelClip%.html
FileDelete, HTMLTemp\TextPlain%DelClip%.txt
FileDelete, HTMLTemp\URL%DelClip%.txt
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
;CorpusCount--
;Gosub, RButton
Reload
}
Return
*/
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: New
Gui, Help: -Caption
Gui, Help: +Owner
Gui, Help: Color, EEAA99
Gui, Help: Margin, 0, 0
Gui, Help: Add, Picture, x0 y0 w640 h250, Resources\Help.jpg
Gui, Help: Add, Button, x495 y209 w100 h30 gNextButton, More...
Gui, Help: Show, w640 h250
Return
NextButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: Destroy
Gui, Help2: New
Gui, Help2: -Caption
Gui, Help2: +Owner
Gui, Help2: Color, EEAA99
Gui, Help2: Margin, 0, 0
Gui, Help2: Add, Picture, x0 y0 w800 h397, Resources\Clipboard Utility Screenshot.jpg
Gui, Help2: Add, Button, x10 y340 w100 h30 gExitButton, Exit
Gui, Help2: Show, w800 h397
Return
ExitButton:
Gui, Help2: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Resources\Close Window.mp3
CopyButton=0
UtilButton :=0
Gui, Hide
Gui, CopyButtom:Hide
Return
;*************************************************************************
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace(status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
Gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
status_button_old:=status_button
return
;*************************************************************************
Deletealert:
if (status_delete=status_delete_old)
return
Gui, 4:default
Gui, destroy
NumberDelete:= RegExReplace(status_delete,"\D")
if !NumberDelete
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Delete Clipboard Number %NumberDelete%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 4:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 4:margin, 0, 0
Gui, 4:add, ActiveX, vWB w64 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
DelXm := pXm-944
GuiControl, Move, WB, h%maxBottom%
Gui, 4: Show, x%DelXm% y%pYm% w64 h60
status_delete_old:=status_delete
Return
;*************************************************************************
Copyalert:
if (status_Copy=status_Copy_old)
return
Gui, 6:default
Gui, destroy
NumberCopy:= RegExReplace(status_Copy,"\D")
if !NumberCopy
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Copy Item %NumberCopy% as Current Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 6:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 6:margin, 0, 0
Gui, 6:add, ActiveX, vWB w60 h72, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 6: Show, x%pXm% y%pYm% w60 h72
status_Copy_old:=status_Copy
Return
;*************************************************************************
URLalert:
if (status_URL=status_URL_old)
return
Gui, 5:default
Gui, destroy
NumberURL:= RegExReplace(status_URL,"\D")
URL_file := "HTMLTemp\URL" NumberURL ".txt"
if !URL_file
return
;Gui,2:Destroy
;URL_file := "HTMLTemp\URL" NumberURL ".txt"
FileRead, URLContents, %URL_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Go to: %URLContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 5:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 5:margin, 0, 0
Gui, 5:add, ActiveX, vWB w562 h30, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
DelXm := pXm-845
;DelXm := pXm-819
DelYm := pYm-47
;Gui, 5: Show, x%DelXm% y%DelYm% w543 h30
Gui, 5: Show, x%DelXm% y%DelYm% w562 h30
status_URL_old:=status_URL
Return
;*************************************************************************
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace(status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Gui,5:Destroy
FileRead, FileContents, %Text_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 3:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 3:margin, 0, 0
Gui, 3:add, ActiveX, vWB w320 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
;*************************************************************************
Editingalert:
if (status_Editing=status_Editing_old)
return
Gui, 6:default
Gui, destroy
EditingNumber:= RegExReplace(status_Editing,"\D")
if !EditingNumber
return
Gui,2:Destroy
Gui,5:Destroy
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Edit Title of the %EditingNumber%th Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 7: +AlwaysOnTop -Caption +ToolWindow Border
;Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui, 7:margin, 0, 0
gui, 7:add, ActiveX, vWB w62 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
;DelXm := pXm-953
GuiControl, Move, WB, h%maxBottom%
gui, 7: Show, x%pXm% y%pYm% w62 h60
status_Editing_old:=status_Editing
Return
;*************************************************************************
^F6::
ControlPaste:
MsgBox, 0x1034,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Hide
;Gui, Destroy
;Gui, -MinimizeBox
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Resources\Close Window.mp3
Return
^F10::
DeleteAll:
MsgBox, 0x1034,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
SavePDF:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, -MinimizeBox
Sleep, 1000
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, Resources\PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
FormatTime, CurrentDate,, dd-MM-yyyy
Filedate := "Documents\Final_Document_" CurrentDate ".pdf"
Filedateh := "Documents\oPDF_" CurrentDate ".html"
FileMove, Final_Document.pdf, %Filedate%
Run, %Filedate%
FileMove, ToPDF.html, %Filedateh%
;FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Return
^F11::
DeleteLast:
MsgBox, 0x1034,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
;FileDelete, HTMLTemp\*%CorpusCount%.*
FileDelete, HTMLTemp\Corpus%CorpusCount%.html
FileDelete, HTMLTemp\image%CorpusCount%.jpg
FileDelete, HTMLTemp\Name%CorpusCount%.txt
FileDelete, HTMLTemp\Text%CorpusCount%.html
FileDelete, HTMLTemp\TextPlain%CorpusCount%.txt
FileDelete, HTMLTemp\URL%CorpusCount%.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
;CorpusCount--
Return
^F12::
Suspend, Toggle
Return
^Esc::
Exit:
ExitApp
Return
Borrado:
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
Return
ButtonTwo:
StringTrimLeft, NumberFile, a_guicontrol, 9
;Gui, 2: Destroy
;Gui, ContextClip: Destroy
Gosub, ButtonLabel
Return
ButtonLabelTray:
If CorpusCount=0
Return
NumberFile:=A_ThisMenuItemPos
Gosub, ButtonLabel
Return
ButtonLabel:
;NumberFile:= RegExReplace(NameTwo,"\D")
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
SoundPlay, Resources\Close Window.mp3
Gui, ContextClip1: Destroy
Gui, ContextClip: Destroy
;Gui, Destroy
Gui,2: Destroy
Gui, Gui1: Destroy
;Gui, 2:default
;Gui, destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
ControlOne :=0
ControlTwo :=0
threeRButton :=0
Alto:=0
Return
TxtLabel:
SoundPlay, Resources\Clipboard_Sound.mp3
StringTrimLeft, TextCopy, a_guicontrol, 5
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
Return
TxtPlane:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
global status_Delete ,tme
global status_URL ,tme
global status_Copy ,tme
global status_Editing ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
status_Delete:=""
status_URL:=""
status_Copy:=""
status_Editing:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
if instr(a_guicontrol,"Delete")
{
status_Delete:=a_guicontrol
SetTimer, Deletealert,-20
}
if instr(a_guicontrol,"URL")
{
status_URL:=a_guicontrol
SetTimer, URLalert,-20
}
if instr(a_guicontrol,"Copy")
{
status_Copy:=a_guicontrol
SetTimer, Copyalert,-20
}
if instr(a_guicontrol,"Editing")
{
status_Editing:=a_guicontrol
SetTimer, Editingalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
status_Delete_old:=""
status_URL_old:=""
status_Copy_old:=""
status_Editing_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
URLButton:
SoundPlay, Resources\Close Window.mp3
MsgBox, 0x1024,, Extract URL's from Clipboards?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
}
}
Gosub, ExtractURL
FileDelete, ToPDF.html
Return
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
Return True
}
;************************************************************************************************************************
ExtractURL:
;Create header html document
FileAppend,
(
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=AutoHotkey.File>
<meta name=Generator content="AutoHotkey">
</head>
<body lang=es style='font-family:Calibri;font-size:11.0pt'>
), Extracted_Links.html
FormatTime, CurrentDate,, dd-MM-yyyy
DateIncl := "<p style='margin:0in'><span style='font-family:Times New Roman;font-size:11.0pt;color:#1E4D78'>Clipboard Session URLs: </span><span style='font-weight:bold;font-family:Calibri;font-size:12.0pt;color:#860000'>" CurrentDate "</span></p>"
FileAppend, %DateIncl%, Extracted_Links.html
;Add Line
myResult := "<p style='margin:0in;font-family:Calibri;font-size:11.0pt;color:#78230C'><p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>`r
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>`r"
FileAppend, %myResult%, Extracted_Links.html
;Routine loop, origin: https://www.autohotkey.com/docs/commands/LoopReadFile.htm
LinkCount := 0
ImgCount := 0
Loop, read, ToPDF.html, Extracted_Links.html
{
URLSearchString := A_LoopReadLine
Gosub, URLSearch
}
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links.html
Loop, read, Extracted_Links.html
{
If A_Index < 11
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
if A_Index > 11
if RegExMatch(A_LoopReadLine, "\.(jpg<|jpeg<|png<|gif<|svg<)")
{
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
ImgCount++ ; increment by one
}
else If InStr(A_LoopReadLine, "</ul>", True) and A_Index > 17
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links_Img.html
}
;URL number message, Optional
MsgBox %LinkCount% links were found and written to "Extracted_Links.html" `n %ImgCount% Images were found and written to "Extracted_Links_Img.html"
;Opcional, opens the result
FormatTime, CurrentDate,, dd-MM-yyyy
FileURL := "Documents\Extracted_Links_" CurrentDate ".html"
FileURLImg := "Documents\Extracted_Links_Img_" CurrentDate ".html"
FileMove, Extracted_Links.html, %FileURL%
FileMove, Extracted_Links_Img.html, %FileURLImg%
FileDelete, ToPDF.html
Run, %FileURL%
Run, %FileURLImg%
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
URLStart1 := InStr(URLSearchString, "https://")
URLStart2 := InStr(URLSearchString, "http://")
URLStart3 := InStr(URLSearchString, "ftp://")
URLStart4 := InStr(URLSearchString, "www.")
; Find the left-most starting position:
URLStart := URLStart1 ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
ArrayElement := URLStart%A_Index%
if (ArrayElement = "") ; End of the pseudo-array has been reached.
break
if (ArrayElement = 0) ; This element is disqualified.
continue
if (URLStart = 0)
URLStart := ArrayElement
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if (ArrayElement != 0)
if (ArrayElement < URLStart)
URLStart := ArrayElement
}
}
if (URLStart = 0) ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
URL := SubStr(URLSearchString, URLStart) ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%<> ; Find the first space, tab, or angle (if any).
{
URL := A_LoopField
break ; i.e. perform only one loop iteration to fetch the first "field".
}
StringReplace, URLCleansed, URL, ",, All
; Makes a second check to replace extraneous signs.
FixString := % URLCleansed
vList := "
(
%21 !
%23 #
%24 $
%26 &
%27 '
%28 (
%29 )
%2A *
%2B +
%2C ,
%3B ;
%2F /
%3A :
%3D =
%3F ?
%40 @
%5B [
%5D ]
%20
%C2%B4 ´
%2E .
%25 %
%2D -
%3C <
%3E >
%5C \
%5E ^
%5F _
%60 `
%7B {
%7C |
%7D }
%7E ~
%22 ""
\/ \
)"
Loop, Parse, vList, `n
{
oTemp := StrSplit(A_LoopField, "`t")
FixString := StrReplace(FixString, oTemp.1, oTemp.2)
}
oTemp := ""
ClipBoard := "<li style='margin-top:0;margin-bottom:0;vertical-align:middle'><p style='margin:0in;font-family:Calibri;font-size:10.0pt'><a href=" FixString ">" FixString "</a></p></li>"
FileAppend, %ClipBoard%`n
LinkCount += 1
; See if there are any other URLs in this line:
CharactersToOmit := StrLen(URL)
CharactersToOmit += URLStart
URLSearchString := SubStr(URLSearchString, CharactersToOmit)
Gosub, URLSearch ; Recursive call to self.
return
Nothing:
Return
Tray_Open:
ListLines
return
;**********************************************************************************************
TrayMenuHandler:
; Easy & Quick options first
If (A_ThisMenuItem = "&Reload this script")
{
Reload
Return
}
Else If (A_ThisMenuItem = "&Edit this script")
{
Run Edit %A_ScriptName%
Return
}
Else If (A_ThisMenuItem = "&Suspend Hotkeys")
{
Menu, tray, ToggleCheck, &Suspend Hotkeys
Suspend
Return
}
Else If (A_ThisMenuItem = "&Pause Script")
{
Menu, tray, ToggleCheck, &Pause Script
Pause
Return
}
; Settings menu
Else If (Trim(A_ThisMenuItem) = "Exit")
ExitApp
Return
^F1::
CaseMenu:
Menu Case, Add
Menu Case, DeleteAll
Menu Case, Add, &UPPERCASE, CCase
Menu Case, Add, &lowercase, CCase
Menu Case, Add, &Title Case, CCase
Menu Case, Add, &a Title to Case, CCase
Menu Case, Add, &Sentence case, CCase
Menu Case, Add
Menu Case, Add, &Remove Spaces, CCase
GetText(Txt)
If NOT ERRORLEVEL
Menu Case, Show
Return
CCase:
p:=A_ThisMenuItemPos
If (p=1)
StringUpper, Txt, Txt
Else If (p=2)
StringLower, Txt, Txt
Else If (p=3)
StringLower, Txt, Txt, T
Else If (p=4)
{
StringLower, Txt, Txt
;IMPORTANT! Change short words to be replaced in the following list according to each language or add more
lowers := ["a", "ha", "el", "y", "pero", "o", "para", "las", "es", "para", "por", "los", "con", "en", "que", "un", "de", "del", "la", "una", "cada", "en", "al", "por", "uno", "mi", "tu", "tú", "no", "ni", "sin", "se", "lo", "e", "su", "sí", "ser", "hay"]
for k, v in lowers
low .= (k = 1 ? "" : "|") . v
;Txt := RegExReplace(Txt, "(*UCP)(^\b|\b(?!(" . low . ")\b))\w+\b|\b\w+\b$", "$T0")
;Txt := RegExReplace(Txt, "((?:^|[.!?-]\s+)[a-z])", "$u1")
Txt := RegExReplace(Txt, "(*UCP)(^|\b(?!(" . low . ")\b))\w|(\.|\?|!)\s*\K\w|-\K\w", "$T0")
}
Else If (p=5)
{
StringLower, Txt, Txt
Txt := RegExReplace(Txt, "((?:^|[.!?]\s+)[a-z])", "$u1")
}
Else If (p=7)
{
Loop
{
StringReplace, Txt, Txt, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0
break
}
}
PutText(Txt)
Return
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^{vk43} ;Ctrl C
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard =
Sleep 20
Clipboard := MyText
Send ^{vk56} ;Ctrl V
Sleep 100
Clipboard := SavedClip
Return
}
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
;EnvSet, SD, %A_ScriptDir%
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
#Include Library\ViewHtml.ahk
;#Include Library\ToolTipEx.ahk
#SingleInstance, Force
#InstallMousehook
;#Persistent
SetBatchLines, -1
Name := "Clipboard Utility - "
Version := "4.1f"
CoordMode, Mouse, Screen
CoordMode, Mouse, Screen
CorpusCount := 0
DirectoryCount := 0
Iniciate:= 0
;Hotkey, LButton Up, off
;loop, HTMLTemp\Corpus*.html
;CorpusCount := % Floor(A_Index)
Menu, Tray, Icon, Resources\Scissors_Green.ico
Menu, Tray, NoStandard
Menu, tray, Add, %name% %version%, Nothing
Menu, tray, Icon, %name% %version%, Resources\Clipboard Utility.ico
Menu, Tray, Add
Menu, tray, Add, Exit , Exit
Menu, tray, Icon, Exit , shell32.dll, 132
Menu, Tray, Add
Menu, tray, Add, &Suspend Hotkeys , Stanby
Menu, tray, Icon,&Suspend Hotkeys , %A_ScriptDir%\Resources\Scissors_Red.ico
Menu, Tray, Add
Menu, Tray, Add, Help, HelpButton
Menu, Tray, Icon, Help, %A_ScriptDir%\Resources\Help.ico
Menu, Tray, Add
Menu Tray, Add, Open Info, Tray_Open
Menu Tray, Icon, Open Info, %A_ScriptDir%\Resources\Info.ico
Menu, tray, Add, &Reload this script , Reloaded
Menu, tray, Icon,&Reload this script , %A_ScriptDir%\Resources\2488.ico
Menu, tray, Add, &Edit this script , EditScript
Menu, tray, Icon,&Edit this script , comres.dll, 7
Menu, tray, Add,
Menu, winmanagetID, Add, Clipboard Window, RButtonAlt
Menu, winmanagetID, icon, Clipboard Window, %A_ScriptDir%\Resources\Clipboard Utility.ico
Menu, winmanagetID, Add, Utility Window, WUtil
Menu, winmanagetID, icon, Utility Window, %A_ScriptDir%\Resources\75a.ico
Menu, winmanagetID, Add, Copy Clipboard Window, CopyGui
Menu, winmanagetID, icon, Copy Clipboard Window, Resources\Clipboard Utility 5.ico
Menu, Tray, add, Window Management, :winmanagetID
Menu, tray, Icon, Window Management, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add, Save all Clipboard to PDF File, SavePDF
Menu, Tray, Icon, Save all Clipboard to PDF File, %A_ScriptDir%\Resources\PDF.ico
Menu, Tray, Add, Extract URL's from clipboard, URLButton
Menu, Tray, Icon, Extract URL's from clipboard, %A_ScriptDir%\Resources\URL.ico
Menu, DeleteID, Add, Delete Last Clipboard, DeleteLast
Menu, DeleteID, Add, Delete All Clipboard, DeleteAll
Menu, Tray, add, Delete Options, :DeleteID
Menu, tray, Icon, Delete Options, %A_ScriptDir%\Resources\Recycle 3.ico
Menu, Tray, Add
;**********************************************************************************************
ReloadSession:
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal := A_Index-1
FileDelete, SessionNumber.txt
;If !CorpusCount=0
;{
NumberSessTemp := "HTMLTemp\Session.txt"
FileRead, Session1, %NumberSessTemp%
; Fileappend, %Session1% `n, SessionNumber.txt
;Menu, SessionID, add, %Session1%, LabelSessionAct
;Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2293.ico
;Menu, SessionID, add
Menu, SessionID, add, Create New Session, NewSession
Menu, SessionID, Icon, Create New Session, %A_ScriptDir%\Resources\178.ico
Menu, SessionID, add
Menu, SessionID, add, 0: %Session1%, LabelSessionAct
Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2478.ico
;Menu, SessionID, add, Current Session, LabelSessionAct
;Menu, SessionID, Icon, Current Session, %A_ScriptDir%\Resources\2478.ico
;************************************************************************
loop, %SessionTotal%
{
FileDelete, SessionCount.txt
FileAppend, %A_ScriptDir%, SessionCount.txt
FullFile:="\HTMLTemp" A_Index "\*.*"
FileAppend, %FullFile%, SessionCount.txt
FileRead, CountFiles, SessionCount.txt
;MsgBox, %CountFiles%
loop, %CountFiles%
FilesCount := % Floor(A_Index/6)
NameTemp := "HTMLTemp" A_Index "\Session.txt"
FileRead, Session1, %NameTemp%
Fileappend, %Session1% |·| %FilesCount% Clipboards`n, SessionNumber.txt
;MsgBox, %FilesCount%
}
Loop, read, SessionNumber.txt
{
Menu, SessionID, add, %A_Index%: %A_LoopReadLine%, LabelSession
}
Menu, Tray, add, Clipboard Sessions, :SessionID
Menu, Tray, Icon, Clipboard Sessions, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add
Menu, Tray, Default, Clipboard Sessions
;**********************************************************************
ReloadMenu:
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
Menu, ClipboardID, add, %A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
Menu, Tray, add, Clipboard, :ClipboardID
Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
}
Menu, Tray, Tip, Clipboard Utility 4.1f
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:+Owner
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, Resources\PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, Resources\PauseOff.png
GuiButtonIcon(Icon, "Resources\Clipboard Utility 5.ico", 1, "s90")
GoSub, Toggle_Switch
;CorpusCount := 0
/*
if FileExist("HTMLTemp\Text1.html")
MsgBox, 0x1034,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
*/
if !FileExist(HTMLTemp)
{
FileCreateDir, HTMLTemp
}
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
DirectoryCount := A_Index-1
;MsgBox, %DirectoryCount%
threeRButton=1
If !Iniciate=1
Gosub, RButton
Return
^F4::
GuiUtily:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd
Gui, -Caption HwndHwnd
Gui, +Owner
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Add, Picture, x0 y0 w600 h167, Resources\Clipboard Utility_p.png
Gui, Add, Text, x0 y0 w552 h35 GuiMove ; , `&& Drag
Gui, Add, Picture, x0 y0 w552 h35, Resources\ArribaIzq.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "Resources\PDFup.png"
Gui1.Button1.HoverImage := "Resources\PDFhover.png"
Gui1.Button1.PressedImage := "Resources\PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Add, Picture, x16 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "Resources\PasteUp.png"
Gui1.Button2.HoverImage := "Resources\PasteHover.png"
Gui1.Button2.PressedImage := "Resources\PasteDown.png"
Gui1.Button2.Label := "ControlPaste"
Gui, Add, Picture, x158 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "Resources\ExitUp.png"
Gui1.Button3.HoverImage := "Resources\ExitHover.png"
Gui1.Button3.PressedImage := "Resources\ExitDown.png"
;Gui1.Button3.Label := "ExitLabel"
Gui1.Button3.Label := "GuiClose"
Gui, Add, Picture, x553 y0 w48 h35 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "Resources\HelpUp.png"
Gui1.Button4.HoverImage := "Resources\HelpHover.png"
Gui1.Button4.PressedImage := "Resources\HelpDown.png"
Gui1.Button4.Label := "HelpButton"
Gui, Add, Picture, x444 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 5
;************************************************************************************************************************
Gui1.Button5 := {} ;Button 5
Gui1.Button5.DefaultImage := "Resources\UrlUp.png"
Gui1.Button5.HoverImage := "Resources\UrlHover.png"
Gui1.Button5.PressedImage := "Resources\UrlDown.png"
Gui1.Button5.Label := "URLButton"
Gui, Add, Picture, x300 y36 w141 h115 hwndhwnd, % Gui1.Button5.DefaultImage
Gui1.Handles[ hwnd ] := "Button5" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
/*
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
*/
MouseGetPos, xposUtil, yposUtil
If UtilButton=1
{
xposUtil := Floor((A_ScreenWidth/2)-450)
yposUtil := Floor((A_ScreenHeight/2)-200)
}
Gui, Show, x%xposUtil% y%yposUtil% W600 h167, Hover
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
WUtil:
UtilButton:=1
Gosub, GuiUtily
Return
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, Resources\ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
CorpusCount++
accData:= GetAccData()
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
Sleep 500
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Iniciate:=1
Gosub, ReloadMenu
Return
CopyGui:
CopyButton:=1
;GoSub, Toggle_Switch
Gosub, Menu2
Return
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
FileDelete, HTMLTemp\Corpus%DelClip%.html
FileDelete, HTMLTemp\image%DelClip%.jpg
FileDelete, HTMLTemp\Name%DelClip%.txt
FileDelete, HTMLTemp\Text%DelClip%.html
FileDelete, HTMLTemp\TextPlain%DelClip%.txt
FileDelete, HTMLTemp\URL%DelClip%.txt
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
;CorpusCount--
;Gosub, RButton
Iniciate:=0
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
}
Return
^F8::
Menu2:
;MouseGetPos, xpos1, ypos1
MouseGetPos, xposMen, yposMen
If CopyButton=1
{
xposMen := Floor(A_ScreenWidth/2)
yposMen := Floor(A_ScreenHeight/2-100)
}
Gui, CopyButtom:Show, x%xposMen% y%yposMen% W81 h84
Return
+RButton::
RButton:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x520 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x540 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w20 h20 hwndIcon10 gClipDelete vDeleteButton%A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon9 gTitleEditing vEditing%A_Index%
Gui, ContextClip: Add, Button, x40 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "Resources\clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "Resources\128.ico", 1, "s32")
GuiButtonIcon(Icon8, "Resources\ArrowSmall.ico", 1, "s32")
GuiButtonIcon(Icon10, "Resources\recycle 2.ico", 1, "s32")
GuiButtonIcon(Icon9, "Resources\pencil 1.ico", 1, "s24")
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
;Gui, ContextClip: -Caption +ToolWindow +0x400000 +hWndhMainWnd ;Menu3s
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd
Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip:+Owner
Gui, ContextClip: Add, Button, x20 y%posyExit% w480 h20 gExitLabel, Exit Menu
Gui, ContextClip: Add, Button, x500 y%posyExit% w60 h20 hwndIcon11 gReducedM
Gui, ContextClip: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip: Add, Button, x0 y%posyExit% w20 h20 hwndIcon12
MouseGetPos, xpos1, ypos1
If threeRButton=1
{
xpos1 := Floor((A_ScreenWidth/2)-450)
ypos1 := Floor((A_ScreenHeight/2)-200)
}
If ControlTwo=1
{
xpos1 := XActTwo-140
ypos1 := yActTwo
}
;xpos1 := xpos1-560
;ypos1 := ypos1-alto
Gui, ContextClip: Show, x%xpos1% y%ypos1% w560 h%Alto% ;Menu3s
GuiButtonIcon(Icon12, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon11, "Resources\ArrowRedu.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
RButtonAlt:
threeRButton :=1
Gosub, RButton
Return
TitleEditing:
Gosub, NewWindow
StringTrimLeft, REdit, a_guicontrol, 7
FileChange := "HTMLTemp\Name" REdit ".txt"
FileRead, FileCont, %FileChange%
Gui, Edit: Font, S8 Bold, Verdana
Gui, Edit: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Edit:+Owner
;Gui, Edit: Add, Edit, vMyEdit%REdit% h20 w460, %FileCont%
Gui, Edit: Add, Edit, y8 vMyEdit h20 w544, %FileCont%
Gui Edit:Add, Button, x20 y37 w70 h20 gTitleSave, OK
Gui Edit:Add, Button, x120 y37 w70 h20 gTitleCancel, Cancel
EdXm := pXm-846
EdYm := pYm-96
Gui, Edit: Show, x%EdXm% y%EdYm%
Return
TitleSave:
Gui, Edit: Submit, Destroy
fileAdd := FileOpen(FileChange, "w")
fileAdd.Write(MyEdit)
fileAdd.Close()
MyEdit :=""
Reload
Return
TitleCancel:
;Gui, Edit: Destroy
;Gosub, NewWindow
Reload
Return
ReducedM:
WinGetPos, XActOne, YActOne,,, A
Gui, ContextClip: Destroy
ControlOne :=1
ControlTwo :=0
Gosub, NotifyTrayClick_207
Return
NotifyTrayClick_207:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip1: Add, Button, x0 y%posy% w460 h20 gButtonTwo vTwoButton%A_Index%, %A_LoopReadLine%
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip1: Margin, 2, 2
Gui, ContextClip1: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd ;Menu31s
Gui, ContextClip1: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip1:+Owner
Gui, ContextClip1: Add, Button, x20 y%posyExit% w380 h20 gExitLabel, Exit Menu
Gui, ContextClip1: Add, Button, x400 y%posyExit% w60 h20 hwndIcon20 gExtendedM
Gui, ContextClip1: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip1: Add, Button, x0 y%posyExit% w20 h20 hwndIcon21
AltoT := Floor((CorpusCount+1)*31.5)
XPos:= A_ScreenWidth-(700)
YPos:= A_ScreenHeight-AltoT-60
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
ExtendedM:
WinGetPos, XActTwo, YActTwo,,, A
Gui, ContextClip1: Destroy
ControlOne :=0
ControlTwo :=1
Gosub, RButton
Return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: New
Gui, Help: -Caption
Gui, Help: +Owner
Gui, Help: Color, EEAA99
Gui, Help: Margin, 0, 0
Gui, Help: Add, Picture, x0 y0 w640 h250, Resources\Help.jpg
Gui, Help: Add, Button, x495 y209 w100 h30 gNextButton, More...
Gui, Help: Show, w640 h250
Return
NextButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: Destroy
Gui, Help2: New
Gui, Help2: -Caption
Gui, Help2: +Owner
Gui, Help2: Color, EEAA99
Gui, Help2: Margin, 0, 0
Gui, Help2: Add, Picture, x0 y0 w800 h397, Resources\Clipboard Utility Screenshot.jpg
Gui, Help2: Add, Button, x10 y340 w100 h30 gExitButton, Exit
Gui, Help2: Show, w800 h397
Return
ExitButton:
Gui, Help2: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Resources\Close Window.mp3
CopyButton=0
UtilButton :=0
Gui, Hide
Gui, CopyButtom:Hide
Return
;*************************************************************************
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace(status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
Gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
status_button_old:=status_button
return
;*************************************************************************
Deletealert:
if (status_delete=status_delete_old)
return
Gui, 4:default
Gui, destroy
NumberDelete:= RegExReplace(status_delete,"\D")
if !NumberDelete
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Delete Clipboard Number %NumberDelete%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 4:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 4:margin, 0, 0
Gui, 4:add, ActiveX, vWB w64 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
DelXm := pXm-944
GuiControl, Move, WB, h%maxBottom%
Gui, 4: Show, x%DelXm% y%pYm% w64 h60
status_delete_old:=status_delete
Return
;*************************************************************************
Copyalert:
if (status_Copy=status_Copy_old)
return
Gui, 6:default
Gui, destroy
NumberCopy:= RegExReplace(status_Copy,"\D")
if !NumberCopy
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Copy Item %NumberCopy% as Current Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 6:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 6:margin, 0, 0
Gui, 6:add, ActiveX, vWB w60 h72, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 6: Show, x%pXm% y%pYm% w60 h72
status_Copy_old:=status_Copy
Return
;*************************************************************************
URLalert:
if (status_URL=status_URL_old)
return
Gui, 5:default
Gui, destroy
NumberURL:= RegExReplace(status_URL,"\D")
URL_file := "HTMLTemp\URL" NumberURL ".txt"
if !URL_file
return
;Gui,2:Destroy
;URL_file := "HTMLTemp\URL" NumberURL ".txt"
FileRead, URLContents, %URL_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Go to: %URLContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 5:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 5:margin, 0, 0
Gui, 5:add, ActiveX, vWB w562 h30, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
DelXm := pXm-845
;DelXm := pXm-819
DelYm := pYm-47
;Gui, 5: Show, x%DelXm% y%DelYm% w543 h30
Gui, 5: Show, x%DelXm% y%DelYm% w562 h30
status_URL_old:=status_URL
Return
;*************************************************************************
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace(status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Gui,5:Destroy
FileRead, FileContents, %Text_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 3:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 3:margin, 0, 0
Gui, 3:add, ActiveX, vWB w320 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
;*************************************************************************
Editingalert:
if (status_Editing=status_Editing_old)
return
Gui, 6:default
Gui, destroy
EditingNumber:= RegExReplace(status_Editing,"\D")
if !EditingNumber
return
Gui,2:Destroy
Gui,5:Destroy
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Edit Title of the %EditingNumber%th Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 7: +AlwaysOnTop -Caption +ToolWindow Border
;Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui, 7:margin, 0, 0
gui, 7:add, ActiveX, vWB w62 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
;DelXm := pXm-953
GuiControl, Move, WB, h%maxBottom%
gui, 7: Show, x%pXm% y%pYm% w62 h60
status_Editing_old:=status_Editing
Return
;*************************************************************************
^F6::
ControlPaste:
MsgBox, 0x1034,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Hide
;Gui, Destroy
;Gui, -MinimizeBox
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Resources\Close Window.mp3
Return
^F10::
DeleteAll:
MsgBox, 0x1034,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
SavePDF:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, -MinimizeBox
Sleep, 1000
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, Resources\PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
FormatTime, CurrentDate,, dd-MM-yyyy
Filedate := "Documents\Final_Document_" CurrentDate ".pdf"
Filedateh := "Documents\oPDF_" CurrentDate ".html"
FileMove, Final_Document.pdf, %Filedate%
Run, %Filedate%
FileMove, ToPDF.html, %Filedateh%
;FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Return
^F11::
DeleteLast:
MsgBox, 0x1034,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
;FileDelete, HTMLTemp\*%CorpusCount%.*
FileDelete, HTMLTemp\Corpus%CorpusCount%.html
FileDelete, HTMLTemp\image%CorpusCount%.jpg
FileDelete, HTMLTemp\Name%CorpusCount%.txt
FileDelete, HTMLTemp\Text%CorpusCount%.html
FileDelete, HTMLTemp\TextPlain%CorpusCount%.txt
FileDelete, HTMLTemp\URL%CorpusCount%.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
;CorpusCount--
Return
^Esc::
Exit:
ExitApp
Return
Borrado:
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
FileDelete, HTMLTemp\Session.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
Return
ButtonTwo:
StringTrimLeft, NumberFile, a_guicontrol, 9
;Gui, 2: Destroy
;Gui, ContextClip: Destroy
Gosub, ButtonLabel
Return
LabelSession:
;NumberFile:=A_ThisMenuItemPos
;Menu, tray, ToggleCheck, &Suspend Hotkeys
;Menu, tray, ToggleCheck, Clipboard Sessions
MsgBox, 0x1024,, You want the session %A_ThisMenuItem% to be the default session?
IfMsgBox No
Return
;Loop, %DirectoryCount%
/*
if !FileExist("HTMLTemp" A_Index)
{
;NumberDir : %A_Index%
MoveDir := "HTMLTemp" A_Index
}
MsgBox, %MoveDir%
*/
FileDelete, SessionTemp*.txt
FileDelete, SessionTemp00.txt
FileDelete, SessionTemp01.txt
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
NumSess := A_Index-1
NumberPos:= A_ThisMenuItemPos-3
;MsgBox, %NumberPos%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp"
FileAppend, %FileSession%, SessionTemp.txt
FileAppend, %A_ScriptDir%, SessionTemp00.txt
FileSession2 := "\HTMLTemp00"
FileAppend, %FileSession2%, SessionTemp00.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;FileMove %DirectorySess%, %DirectorySess00%
FileMoveDir %DirectorySess%, %DirectorySess00%, R
;DirectorySess :=""
;DirectorySess00 :=""
FileAppend, %A_ScriptDir%, SessionTemp01.txt
FileSession3 := "\HTMLTemp" NumberPos
FileAppend, %FileSession3%, SessionTemp01.txt
FileRead, DirectorySess01, SessionTemp01.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;MsgBox, %DirectorySess01%`n%DirectorySess%
FileMoveDir %DirectorySess01%, %DirectorySess%, R
FileMoveDir %DirectorySess00%, %DirectorySess01%, R
Menu, SessionID, DeleteAll
Menu, ClipboardID, DeleteAll
Iniciate:=0
Gosub, ReloadSession
Return
/*
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
*/
ButtonLabelTray:
If CorpusCount=0
Return
NumberFile:=A_ThisMenuItemPos
Gosub, ButtonLabel
Return
ButtonLabel:
;NumberFile:= RegExReplace(NameTwo,"\D")
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
SoundPlay, Resources\Close Window.mp3
Gui, ContextClip1: Destroy
Gui, ContextClip: Destroy
;Gui, Destroy
Gui,2: Destroy
Gui, Gui1: Destroy
;Gui, 2:default
;Gui, destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
ControlOne :=0
ControlTwo :=0
threeRButton :=0
Alto:=0
Return
TxtLabel:
SoundPlay, Resources\Clipboard_Sound.mp3
StringTrimLeft, TextCopy, a_guicontrol, 5
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
Return
TxtPlane:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
global status_Delete ,tme
global status_URL ,tme
global status_Copy ,tme
global status_Editing ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
status_Delete:=""
status_URL:=""
status_Copy:=""
status_Editing:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
if instr(a_guicontrol,"Delete")
{
status_Delete:=a_guicontrol
SetTimer, Deletealert,-20
}
if instr(a_guicontrol,"URL")
{
status_URL:=a_guicontrol
SetTimer, URLalert,-20
}
if instr(a_guicontrol,"Copy")
{
status_Copy:=a_guicontrol
SetTimer, Copyalert,-20
}
if instr(a_guicontrol,"Editing")
{
status_Editing:=a_guicontrol
SetTimer, Editingalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
status_Delete_old:=""
status_URL_old:=""
status_Copy_old:=""
status_Editing_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
URLButton:
SoundPlay, Resources\Close Window.mp3
MsgBox, 0x1024,, Extract URL's from Clipboards?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
}
}
Gosub, ExtractURL
FileDelete, ToPDF.html
Return
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
Return True
}
;************************************************************************************************************************
ExtractURL:
;Create header html document
FileAppend,
(
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=AutoHotkey.File>
<meta name=Generator content="AutoHotkey">
</head>
<body lang=es style='font-family:Calibri;font-size:11.0pt'>
), Extracted_Links.html
FormatTime, CurrentDate,, dd-MM-yyyy
DateIncl := "<p style='margin:0in'><span style='font-family:Times New Roman;font-size:11.0pt;color:#1E4D78'>Clipboard Session URLs: </span><span style='font-weight:bold;font-family:Calibri;font-size:12.0pt;color:#860000'>" CurrentDate "</span></p>"
FileAppend, %DateIncl%, Extracted_Links.html
;Add Line
myResult := "<p style='margin:0in;font-family:Calibri;font-size:11.0pt;color:#78230C'><p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>`r
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>`r"
FileAppend, %myResult%, Extracted_Links.html
;Routine loop, origin: https://www.autohotkey.com/docs/commands/LoopReadFile.htm
LinkCount := 0
ImgCount := 0
Loop, read, ToPDF.html, Extracted_Links.html
{
URLSearchString := A_LoopReadLine
Gosub, URLSearch
}
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links.html
Loop, read, Extracted_Links.html
{
If A_Index < 11
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
if A_Index > 11
if RegExMatch(A_LoopReadLine, "\.(jpg<|jpeg<|png<|gif<|svg<)")
{
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
ImgCount++ ; increment by one
}
else If InStr(A_LoopReadLine, "</ul>", True) and A_Index > 17
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links_Img.html
}
;URL number message, Optional
MsgBox %LinkCount% links were found and written to "Extracted_Links.html" `n %ImgCount% Images were found and written to "Extracted_Links_Img.html"
;Opcional, opens the result
FormatTime, CurrentDate,, dd-MM-yyyy
FileURL := "Documents\Extracted_Links_" CurrentDate ".html"
FileURLImg := "Documents\Extracted_Links_Img_" CurrentDate ".html"
FileMove, Extracted_Links.html, %FileURL%
FileMove, Extracted_Links_Img.html, %FileURLImg%
FileDelete, ToPDF.html
Run, %FileURL%
Run, %FileURLImg%
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
URLStart1 := InStr(URLSearchString, "https://")
URLStart2 := InStr(URLSearchString, "http://")
URLStart3 := InStr(URLSearchString, "ftp://")
URLStart4 := InStr(URLSearchString, "www.")
; Find the left-most starting position:
URLStart := URLStart1 ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
ArrayElement := URLStart%A_Index%
if (ArrayElement = "") ; End of the pseudo-array has been reached.
break
if (ArrayElement = 0) ; This element is disqualified.
continue
if (URLStart = 0)
URLStart := ArrayElement
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if (ArrayElement != 0)
if (ArrayElement < URLStart)
URLStart := ArrayElement
}
}
if (URLStart = 0) ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
URL := SubStr(URLSearchString, URLStart) ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%<> ; Find the first space, tab, or angle (if any).
{
URL := A_LoopField
break ; i.e. perform only one loop iteration to fetch the first "field".
}
StringReplace, URLCleansed, URL, ",, All
; Makes a second check to replace extraneous signs.
FixString := % URLCleansed
vList := "
(
%21 !
%23 #
%24 $
%26 &
%27 '
%28 (
%29 )
%2A *
%2B +
%2C ,
%3B ;
%2F /
%3A :
%3D =
%3F ?
%40 @
%5B [
%5D ]
%20
%C2%B4 ´
%2E .
%25 %
%2D -
%3C <
%3E >
%5C \
%5E ^
%5F _
%60 `
%7B {
%7C |
%7D }
%7E ~
%22 ""
\/ \
)"
Loop, Parse, vList, `n
{
oTemp := StrSplit(A_LoopField, "`t")
FixString := StrReplace(FixString, oTemp.1, oTemp.2)
}
oTemp := ""
ClipBoard := "<li style='margin-top:0;margin-bottom:0;vertical-align:middle'><p style='margin:0in;font-family:Calibri;font-size:10.0pt'><a href=" FixString ">" FixString "</a></p></li>"
FileAppend, %ClipBoard%`n
LinkCount += 1
; See if there are any other URLs in this line:
CharactersToOmit := StrLen(URL)
CharactersToOmit += URLStart
URLSearchString := SubStr(URLSearchString, CharactersToOmit)
Gosub, URLSearch ; Recursive call to self.
return
;**********************************************************************************************
^F1::
CaseMenu:
Menu Case, Add
Menu Case, DeleteAll
Menu Case, Add, &UPPERCASE, CCase
Menu Case, Add, &lowercase, CCase
Menu Case, Add, &Title Case, CCase
Menu Case, Add, &a Title to Case, CCase
Menu Case, Add, &Sentence case, CCase
Menu Case, Add
Menu Case, Add, &Remove Spaces, CCase
GetText(Txt)
If NOT ERRORLEVEL
Menu Case, Show
Return
CCase:
p:=A_ThisMenuItemPos
If (p=1)
StringUpper, Txt, Txt
Else If (p=2)
StringLower, Txt, Txt
Else If (p=3)
StringLower, Txt, Txt, T
Else If (p=4)
{
StringLower, Txt, Txt
;IMPORTANT! Change short words to be replaced in the following list according to each language or add more
lowers := ["a", "ha", "el", "y", "pero", "o", "para", "las", "es", "para", "por", "los", "con", "en", "que", "un", "de", "del", "la", "una", "cada", "en", "al", "por", "uno", "mi", "tu", "tú", "no", "ni", "sin", "se", "lo", "e", "su", "sí", "ser", "hay"]
for k, v in lowers
low .= (k = 1 ? "" : "|") . v
;Txt := RegExReplace(Txt, "(*UCP)(^\b|\b(?!(" . low . ")\b))\w+\b|\b\w+\b$", "$T0")
;Txt := RegExReplace(Txt, "((?:^|[.!?-]\s+)[a-z])", "$u1")
Txt := RegExReplace(Txt, "(*UCP)(^|\b(?!(" . low . ")\b))\w|(\.|\?|!)\s*\K\w|-\K\w", "$T0")
}
Else If (p=5)
{
StringLower, Txt, Txt
Txt := RegExReplace(Txt, "((?:^|[.!?]\s+)[a-z])", "$u1")
}
Else If (p=7)
{
Loop
{
StringReplace, Txt, Txt, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0
break
}
}
PutText(Txt)
Return
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^{vk43} ;Ctrl C
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard =
Sleep 20
Clipboard := MyText
Send ^{vk56} ;Ctrl V
Sleep 100
Clipboard := SavedClip
Return
}
;*******************************************************************************
Nothing:
Return
Tray_Open:
ListLines
return
^!F4::
NewSession:
Gui, Session: Font, S8 Bold, Verdana
Gui, Session: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Session:+Owner
Gui, Session: Add, Edit, y8 vSessEdit h20 w544, New Session
Gui Session:Add, Button, x20 y37 w70 h20 gSessionSave, OK
Gui Session:Add, Button, x120 y37 w70 h20 gSessCancel, Cancel
xSess := Floor((A_ScreenWidth/2)-450)
ySess := Floor((A_ScreenHeight/2)-200)
Gui, Session: Show, x%xSess% y%ySess%
Return
SessionSave:
FileDelete, SessionTemp.txt
Gui, Session: Submit
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal1 := A_Index
FileCreateDir, HTMLTemp%SessionTotal1%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp" SessionTotal1 "\Session.txt"
FileAppend, %FileSession%, SessionTemp.txt
;Sleep, 3500
FileRead, Directory, SessionTemp.txt
FileAppend, %SessEdit%, %Directory%
Menu, SessionID, DeleteAll
Iniciate:=1
Gosub, ReloadSession
Return
SessCancel:
Gui, Session:Destroy
Return
LabelSessionAct:
NumberSessTemp := "HTMLTemp\Session.txt"
FileRead, Session1, %NumberSessTemp%
xSplash := A_ScreenWidth-506
ySplash := A_ScreenHeight-140
SplashTextOn, 500, 40, Name of the Current Session, %Session1%
WinMove, Name of the Current Session,, xSplash, ySplash
Sleep, 2500
SplashTextOff
Return
/*
Paused:
Paused:=!Paused
IfEqual,Paused,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Orange.ico
IfEqual,Paused,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Pause Script
Menu,Tray,Icon,,,1
Pause,Toggle,1
Return
*/
^F12::
Stanby:
Suspend:=!Suspend
IfEqual,Suspend,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Red.ico
IfEqual,Suspend,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Suspend Hotkeys
Menu,Tray,Icon,,,1
Suspend,Toggle
Return
EditScript:
Run Edit %A_ScriptName%
Return
Reloaded:
Reload
Return
/*
^!F3::
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
^!F3::
Loop, read, SesionName.txt
{
Menu, MyMenu, add,%A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
;Menu, MyMenu, add, Clipboard, ButtonLabelTray
;Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
Menu, MyMenu, Color, FFFFFF
Menu, MyMenu, show
;}
Return
*/
^!F3::
;Loop, Parse, MyListBox, |
;Loop, read, SesionName.txt
;{
Gui, -Caption
Gui, Color, ffffd6
;Gui, Font, S12 Bold, Verdana
Gui, Font, s9, Segoe UI
Gui, Add, ListBox, vsesion w470 h225
;Gui, Add, ListBox, r5, Red|Green|Blue|Black|White
;Gui, MiListBox:Add, ListBox, r5 vColorChoice, %A_LoopReadLine%
;MsgBox Selection number %A_Index% is %A_LoopField%.
;}
Loop, read, SesionName.txt
{
GuiControl,, sesion, %A_LoopReadLine%
}
Gui, Show
/*
;To cancel, press ESCAPE or close this window.
Gui, Add, ListBox, vListBox_pdf x16 y10 w370 h125,
Gui, Add, ListBox, vListBox_ini x16 y145 w370 h125,
Gui, Add, Button, Default, OK
;----------------------------- Start Fill Listboxs
Loop, C:\temp\*.pdf
{
GuiControl,, ListBox_pdf, %A_LoopFileFullPath%
}
Loop, C:\*.ini
{
GuiControl,, ListBox_ini, %A_LoopFileFullPath%
}
Gui, Show
*/
NotifyTrayClick_201:
;xSplash := Floor((A_ScreenWidth/2)-450)
;ySplash := Floor((A_ScreenHeight/2)-200)
xSplash := A_ScreenWidth-506
ySplash := A_ScreenHeight-180
SplashTextOn, 500, 80, Content of the current clipboard, %Clipboard%
WinMove, Content of the current clipboard,, xSplash, ySplash
;SplashTextOn,,, Displays only a title bar.
Sleep, 1000
SplashTextOff
;SplashTextOn,,, %Clipboard%
;WinMove,,, xSplash, ySplash
;Sleep, 1000
;SplashTextOff
Return
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
;EnvSet, SD, %A_ScriptDir%
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
#Include Library\ViewHtml.ahk
;#Include Library\ToolTipEx.ahk
#SingleInstance, Force
#InstallMousehook
;#Persistent
SetBatchLines, -1
Name := "Clipboard Utility - "
Version := "4.1f"
CoordMode, Mouse, Screen
CoordMode, Mouse, Screen
CorpusCount := 0
DirectoryCount := 0
Iniciate:= 0
;Hotkey, LButton Up, off
;loop, HTMLTemp\Corpus*.html
;CorpusCount := % Floor(A_Index)
Menu, Tray, Icon, Resources\Scissors_Green.ico
Menu, Tray, NoStandard
Menu, tray, Add, %name% %version%, Nothing
Menu, tray, Icon, %name% %version%, Resources\Clipboard Utility.ico
Menu, Tray, Add
Menu, tray, Add, Exit , Exit
Menu, tray, Icon, Exit , shell32.dll, 132
Menu, Tray, Add
Menu, tray, Add, &Suspend Hotkeys , Stanby
Menu, tray, Icon,&Suspend Hotkeys , %A_ScriptDir%\Resources\Scissors_Red.ico
Menu, Tray, Add
Menu, Tray, Add, Help, HelpButton
Menu, Tray, Icon, Help, %A_ScriptDir%\Resources\Help.ico
Menu, Tray, Add
Menu Tray, Add, Open Info, Tray_Open
Menu Tray, Icon, Open Info, %A_ScriptDir%\Resources\Info.ico
Menu, tray, Add, &Reload this script , Reloaded
Menu, tray, Icon,&Reload this script , %A_ScriptDir%\Resources\2488.ico
Menu, tray, Add, &Edit this script , EditScript
Menu, tray, Icon,&Edit this script , comres.dll, 7
Menu, tray, Add,
Menu, winmanagetID, Add, Clipboard Window, RButtonAlt
Menu, winmanagetID, icon, Clipboard Window, %A_ScriptDir%\Resources\Clipboard Utility.ico
Menu, winmanagetID, Add, Utility Window, WUtil
Menu, winmanagetID, icon, Utility Window, %A_ScriptDir%\Resources\75a.ico
Menu, winmanagetID, Add, Copy Clipboard Window, CopyGui
Menu, winmanagetID, icon, Copy Clipboard Window, Resources\Clipboard Utility 5.ico
Menu, Tray, add, Window Management, :winmanagetID
Menu, tray, Icon, Window Management, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add, Save all Clipboard to PDF File, SavePDF
Menu, Tray, Icon, Save all Clipboard to PDF File, %A_ScriptDir%\Resources\PDF.ico
Menu, Tray, Add, Extract URL's from clipboard, URLButton
Menu, Tray, Icon, Extract URL's from clipboard, %A_ScriptDir%\Resources\URL.ico
Menu, DeleteID, Add, Delete Last Clipboard, DeleteLast
Menu, DeleteID, Add, Delete All Clipboard, DeleteAll
Menu, Tray, add, Delete Options, :DeleteID
Menu, tray, Icon, Delete Options, %A_ScriptDir%\Resources\Recycle 3.ico
Menu, Tray, Add
;**********************************************************************************************
ReloadSession:
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal := A_Index-1
FileDelete, SessionNumber.txt
;If !CorpusCount=0
;{
NumberSessTemp := "HTMLTemp\Session.txt"
FileRead, Session1, %NumberSessTemp%
; Fileappend, %Session1% `n, SessionNumber.txt
;Menu, SessionID, add, %Session1%, LabelSessionAct
;Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2293.ico
;Menu, SessionID, add
Menu, SessionID, add, Create New Session, NewSession
Menu, SessionID, Icon, Create New Session, %A_ScriptDir%\Resources\178.ico
Menu, SessionID, add
Menu, SessionID, add, 0: %Session1%, LabelSessionAct
Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2478.ico
;Menu, SessionID, add, Current Session, LabelSessionAct
;Menu, SessionID, Icon, Current Session, %A_ScriptDir%\Resources\2478.ico
;************************************************************************
loop, %SessionTotal%
{
FileDelete, SessionCount.txt
FileAppend, %A_ScriptDir%, SessionCount.txt
FullFile:="\HTMLTemp" A_Index "\*.*"
FileAppend, %FullFile%, SessionCount.txt
FileRead, CountFiles, SessionCount.txt
;MsgBox, %CountFiles%
loop, %CountFiles%
FilesCount := % Floor(A_Index/6)
NameTemp := "HTMLTemp" A_Index "\Session.txt"
FileRead, Session1, %NameTemp%
Fileappend, %Session1% |·| %FilesCount% Clipboards`n, SessionNumber.txt
;MsgBox, %FilesCount%
}
Loop, read, SessionNumber.txt
{
Menu, SessionID, add, %A_Index%: %A_LoopReadLine%, LabelSession
}
Menu, Tray, add, Clipboard Sessions, :SessionID
Menu, Tray, Icon, Clipboard Sessions, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add
;**********************************************************************
ReloadMenu:
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
Menu, ClipboardID, add, %A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
Menu, Tray, add, Clipboard, :ClipboardID
Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
}
Menu, Tray, Default, Clipboard
Menu, Tray, Tip, Clipboard Utility 4.1f
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:+Owner
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, Resources\PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, Resources\PauseOff.png
GuiButtonIcon(Icon, "Resources\Clipboard Utility 5.ico", 1, "s90")
GoSub, Toggle_Switch
;CorpusCount := 0
/*
if FileExist("HTMLTemp\Text1.html")
MsgBox, 0x1034,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
*/
if !FileExist(HTMLTemp)
{
FileCreateDir, HTMLTemp
}
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
DirectoryCount := A_Index-1
;MsgBox, %DirectoryCount%
Filedelete, WorkingDir.txt
FileAppend, %A_ScriptDir%\, WorkingDir.txt
FileRead, ScriptDir, Workingdir.txt
threeRButton=1
If !Iniciate=1
Gosub, RButton
Return
^F4::
GuiUtily:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd
Gui, -Caption HwndHwnd
Gui, +Owner
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Add, Picture, x0 y0 w600 h167, Resources\Clipboard Utility_p.png
Gui, Add, Text, x0 y0 w552 h35 GuiMove ; , `&& Drag
Gui, Add, Picture, x0 y0 w552 h35, Resources\ArribaIzq.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "Resources\PDFup.png"
Gui1.Button1.HoverImage := "Resources\PDFhover.png"
Gui1.Button1.PressedImage := "Resources\PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Add, Picture, x16 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "Resources\PasteUp.png"
Gui1.Button2.HoverImage := "Resources\PasteHover.png"
Gui1.Button2.PressedImage := "Resources\PasteDown.png"
Gui1.Button2.Label := "ControlPaste"
Gui, Add, Picture, x158 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "Resources\ExitUp.png"
Gui1.Button3.HoverImage := "Resources\ExitHover.png"
Gui1.Button3.PressedImage := "Resources\ExitDown.png"
;Gui1.Button3.Label := "ExitLabel"
Gui1.Button3.Label := "GuiClose"
Gui, Add, Picture, x553 y0 w48 h35 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "Resources\HelpUp.png"
Gui1.Button4.HoverImage := "Resources\HelpHover.png"
Gui1.Button4.PressedImage := "Resources\HelpDown.png"
Gui1.Button4.Label := "HelpButton"
Gui, Add, Picture, x444 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 5
;************************************************************************************************************************
Gui1.Button5 := {} ;Button 5
Gui1.Button5.DefaultImage := "Resources\UrlUp.png"
Gui1.Button5.HoverImage := "Resources\UrlHover.png"
Gui1.Button5.PressedImage := "Resources\UrlDown.png"
Gui1.Button5.Label := "URLButton"
Gui, Add, Picture, x300 y36 w141 h115 hwndhwnd, % Gui1.Button5.DefaultImage
Gui1.Handles[ hwnd ] := "Button5" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
/*
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
*/
MouseGetPos, xposUtil, yposUtil
If UtilButton=1
{
xposUtil := Floor((A_ScreenWidth/2)-450)
yposUtil := Floor((A_ScreenHeight/2)-200)
}
Gui, Show, x%xposUtil% y%yposUtil% W600 h167, Hover
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
WUtil:
UtilButton:=1
Gosub, GuiUtily
Return
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, Resources\ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
CorpusCount++
accData:= GetAccData()
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := ScriptDir "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Iniciate:=1
Gosub, ReloadMenu
Return
CopyGui:
CopyButton:=1
;GoSub, Toggle_Switch
Gosub, Menu2
Return
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
FileDelete, HTMLTemp\Corpus%DelClip%.html
FileDelete, HTMLTemp\image%DelClip%.jpg
FileDelete, HTMLTemp\Name%DelClip%.txt
FileDelete, HTMLTemp\Text%DelClip%.html
FileDelete, HTMLTemp\TextPlain%DelClip%.txt
FileDelete, HTMLTemp\URL%DelClip%.txt
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
;CorpusCount--
;Gosub, RButton
Iniciate:=0
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
}
Return
^F8::
Menu2:
;MouseGetPos, xpos1, ypos1
MouseGetPos, xposMen, yposMen
If CopyButton=1
{
xposMen := Floor(A_ScreenWidth/2)
yposMen := Floor(A_ScreenHeight/2-100)
}
Gui, CopyButtom:Show, x%xposMen% y%yposMen% W81 h84
Return
+RButton::
RButton:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x520 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x540 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w20 h20 hwndIcon10 gClipDelete vDeleteButton%A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon9 gTitleEditing vEditing%A_Index%
Gui, ContextClip: Add, Button, x40 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "Resources\clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "Resources\128.ico", 1, "s32")
GuiButtonIcon(Icon8, "Resources\ArrowSmall.ico", 1, "s32")
GuiButtonIcon(Icon10, "Resources\recycle 2.ico", 1, "s32")
GuiButtonIcon(Icon9, "Resources\pencil 1.ico", 1, "s24")
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
;Gui, ContextClip: -Caption +ToolWindow +0x400000 +hWndhMainWnd ;Menu3s
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd
Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip:+Owner
Gui, ContextClip: Add, Button, x20 y%posyExit% w480 h20 gExitLabel, Exit Menu
Gui, ContextClip: Add, Button, x500 y%posyExit% w60 h20 hwndIcon11 gReducedM
Gui, ContextClip: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip: Add, Button, x0 y%posyExit% w20 h20 hwndIcon12
MouseGetPos, xpos1, ypos1
If threeRButton=1
{
xpos1 := Floor((A_ScreenWidth/2)-450)
ypos1 := Floor((A_ScreenHeight/2)-200)
}
If ControlTwo=1
{
xpos1 := XActTwo-140
ypos1 := yActTwo
}
;xpos1 := xpos1-560
;ypos1 := ypos1-alto
Gui, ContextClip: Show, x%xpos1% y%ypos1% w560 h%Alto% ;Menu3s
GuiButtonIcon(Icon12, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon11, "Resources\ArrowRedu.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
RButtonAlt:
threeRButton :=1
Gosub, RButton
Return
TitleEditing:
Gosub, NewWindow
StringTrimLeft, REdit, a_guicontrol, 7
FileChange := "HTMLTemp\Name" REdit ".txt"
FileRead, FileCont, %FileChange%
Gui, Edit: Font, S8 Bold, Verdana
Gui, Edit: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Edit:+Owner
Gui, Edit:Add, Edit, x8 y9 w546 h20 vMyEdit, %FileCont%
;Gui, Edit: Add, Edit, x12 y9 w460 h20 vMyEdit%REdit%, %FileCont%
Gui, Edit:Add, Button, x8 y37 w70 h20 gTitleSave, OK
Gui, Edit:Add, Button, x100 y37 w70 h20 gTitleCancel, Cancel
Gui, Edit:Add, CheckBox, x240 y37 w210 h20 Checked1 vVeryfyChange, Change also the Title to Paste
EdXm := pXm-846
EdYm := pYm-96
Gui, Edit:Show, x%EdXm% y%EdYm% h63 w564
Return
TitleSave:
Gui, Edit: Submit, Destroy
fileAdd := FileOpen(FileChange, "w")
fileAdd.Write(MyEdit)
fileAdd.Close()
If VeryfyChange=1
{
ReadURL := "HTMLTemp\URL" REdit ".txt"
Fileread URLTxt, %ReadURL%
ReadText:= "HTMLTemp\Text" REdit ".html"
FileDelete, %ReadText%
myResultSave := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" URLTxt ">" MyEdit "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResultSave%, %ReadText%
}
MyEdit :=""
Reload
Return
TitleCancel:
Gui, Edit: Submit
;Gosub, NewWindow
/*
If VeryfyChange=1
{
ReadURL := "HTMLTemp\URL" REdit ".txt"
Fileread URLTxt, %ReadURL%
MsgBox, %ReadURL% - %URLTxt%
}
*/
;Reload
Return
ReducedM:
WinGetPos, XActOne, YActOne,,, A
Gui, ContextClip: Destroy
ControlOne :=1
ControlTwo :=0
Gosub, NotifyTrayClick_207
Return
NotifyTrayClick_207:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip1: Add, Button, x0 y%posy% w460 h20 gButtonTwo vTwoButton%A_Index%, %A_LoopReadLine%
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip1: Margin, 2, 2
Gui, ContextClip1: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd ;Menu31s
Gui, ContextClip1: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip1:+Owner
Gui, ContextClip1: Add, Button, x20 y%posyExit% w380 h20 gExitLabel, Exit Menu
Gui, ContextClip1: Add, Button, x400 y%posyExit% w60 h20 hwndIcon20 gExtendedM
Gui, ContextClip1: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip1: Add, Button, x0 y%posyExit% w20 h20 hwndIcon21
AltoT := Floor((CorpusCount+1)*31.5)
XPos:= A_ScreenWidth-(700)
YPos:= A_ScreenHeight-AltoT-60
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
ExtendedM:
WinGetPos, XActTwo, YActTwo,,, A
Gui, ContextClip1: Destroy
ControlOne :=0
ControlTwo :=1
Gosub, RButton
Return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: New
Gui, Help: -Caption
Gui, Help: +Owner
Gui, Help: Color, EEAA99
Gui, Help: Margin, 0, 0
Gui, Help: Add, Picture, x0 y0 w640 h250, Resources\Help.jpg
Gui, Help: Add, Button, x495 y209 w100 h30 gNextButton, More...
Gui, Help: Show, w640 h250
Return
NextButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: Destroy
Gui, Help2: New
Gui, Help2: -Caption
Gui, Help2: +Owner
Gui, Help2: Color, EEAA99
Gui, Help2: Margin, 0, 0
Gui, Help2: Add, Picture, x0 y0 w800 h397, Resources\Clipboard Utility Screenshot.jpg
Gui, Help2: Add, Button, x10 y340 w100 h30 gExitButton, Exit
Gui, Help2: Show, w800 h397
Return
ExitButton:
Gui, Help2: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Resources\Close Window.mp3
CopyButton=0
UtilButton :=0
Gui, Hide
Gui, CopyButtom:Hide
Return
;*************************************************************************
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace(status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
Gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
status_button_old:=status_button
return
;*************************************************************************
Deletealert:
if (status_delete=status_delete_old)
return
Gui, 4:default
Gui, destroy
NumberDelete:= RegExReplace(status_delete,"\D")
if !NumberDelete
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Delete Clipboard Number %NumberDelete%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 4:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 4:margin, 0, 0
Gui, 4:add, ActiveX, vWB w64 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
DelXm := pXm-944
GuiControl, Move, WB, h%maxBottom%
Gui, 4: Show, x%DelXm% y%pYm% w64 h60
status_delete_old:=status_delete
Return
;*************************************************************************
Copyalert:
if (status_Copy=status_Copy_old)
return
Gui, 6:default
Gui, destroy
NumberCopy:= RegExReplace(status_Copy,"\D")
if !NumberCopy
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Copy Item %NumberCopy% as Current Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 6:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 6:margin, 0, 0
Gui, 6:add, ActiveX, vWB w60 h72, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 6: Show, x%pXm% y%pYm% w60 h72
status_Copy_old:=status_Copy
Return
;*************************************************************************
URLalert:
if (status_URL=status_URL_old)
return
Gui, 5:default
Gui, destroy
NumberURL:= RegExReplace(status_URL,"\D")
URL_file := "HTMLTemp\URL" NumberURL ".txt"
if !URL_file
return
;Gui,2:Destroy
;URL_file := "HTMLTemp\URL" NumberURL ".txt"
FileRead, URLContents, %URL_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Go to: %URLContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 5:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 5:margin, 0, 0
Gui, 5:add, ActiveX, vWB w562 h30, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
DelXm := pXm-845
;DelXm := pXm-819
DelYm := pYm-47
;Gui, 5: Show, x%DelXm% y%DelYm% w543 h30
Gui, 5: Show, x%DelXm% y%DelYm% w562 h30
status_URL_old:=status_URL
Return
;*************************************************************************
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace(status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Gui,5:Destroy
FileRead, FileContents, %Text_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 3:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 3:margin, 0, 0
Gui, 3:add, ActiveX, vWB w320 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
;*************************************************************************
Editingalert:
if (status_Editing=status_Editing_old)
return
Gui, 6:default
Gui, destroy
EditingNumber:= RegExReplace(status_Editing,"\D")
if !EditingNumber
return
Gui,2:Destroy
Gui,5:Destroy
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Edit Title of the %EditingNumber%th Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 7: +AlwaysOnTop -Caption +ToolWindow Border
;Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui, 7:margin, 0, 0
gui, 7:add, ActiveX, vWB w62 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
;DelXm := pXm-953
GuiControl, Move, WB, h%maxBottom%
gui, 7: Show, x%pXm% y%pYm% w62 h60
status_Editing_old:=status_Editing
Return
;*************************************************************************
^F6::
ControlPaste:
MsgBox, 0x1034,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Hide
;Gui, Destroy
;Gui, -MinimizeBox
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Resources\Close Window.mp3
Return
^F10::
DeleteAll:
MsgBox, 0x1034,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
SavePDF:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, -MinimizeBox
Sleep, 1000
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, Resources\PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
FormatTime, CurrentDate,, dd-MM-yyyy
Filedate := "Documents\Final_Document_" CurrentDate ".pdf"
Filedateh := "Documents\oPDF_" CurrentDate ".html"
FileMove, Final_Document.pdf, %Filedate%
Run, %Filedate%
FileMove, ToPDF.html, %Filedateh%
;FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Return
^F11::
DeleteLast:
MsgBox, 0x1034,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
;FileDelete, HTMLTemp\*%CorpusCount%.*
FileDelete, HTMLTemp\Corpus%CorpusCount%.html
FileDelete, HTMLTemp\image%CorpusCount%.jpg
FileDelete, HTMLTemp\Name%CorpusCount%.txt
FileDelete, HTMLTemp\Text%CorpusCount%.html
FileDelete, HTMLTemp\TextPlain%CorpusCount%.txt
FileDelete, HTMLTemp\URL%CorpusCount%.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
;CorpusCount--
Return
^Esc::
Exit:
ExitApp
Return
Borrado:
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, LabelSessionAct
Gosub, ReloadMenu
Return
ButtonTwo:
StringTrimLeft, NumberFile, a_guicontrol, 9
;Gui, 2: Destroy
;Gui, ContextClip: Destroy
Gosub, ButtonLabel
Return
LabelSession:
;NumberFile:=A_ThisMenuItemPos
;Menu, tray, ToggleCheck, &Suspend Hotkeys
;Menu, tray, ToggleCheck, Clipboard Sessions
MsgBox, 0x1024,, You want the session %A_ThisMenuItem% to be the default session?
IfMsgBox No
Return
;Loop, %DirectoryCount%
/*
if !FileExist("HTMLTemp" A_Index)
{
;NumberDir : %A_Index%
MoveDir := "HTMLTemp" A_Index
}
MsgBox, %MoveDir%
*/
FileDelete, SessionTemp*.txt
FileDelete, SessionTemp00.txt
FileDelete, SessionTemp01.txt
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
NumSess := A_Index-1
NumberPos:= A_ThisMenuItemPos-3
;MsgBox, %NumberPos%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp"
FileAppend, %FileSession%, SessionTemp.txt
FileAppend, %A_ScriptDir%, SessionTemp00.txt
FileSession2 := "\HTMLTemp00"
FileAppend, %FileSession2%, SessionTemp00.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;FileMove %DirectorySess%, %DirectorySess00%
FileMoveDir %DirectorySess%, %DirectorySess00%, R
;DirectorySess :=""
;DirectorySess00 :=""
FileAppend, %A_ScriptDir%, SessionTemp01.txt
FileSession3 := "\HTMLTemp" NumberPos
FileAppend, %FileSession3%, SessionTemp01.txt
FileRead, DirectorySess01, SessionTemp01.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;MsgBox, %DirectorySess01%`n%DirectorySess%
FileMoveDir %DirectorySess01%, %DirectorySess%, R
FileMoveDir %DirectorySess00%, %DirectorySess01%, R
Menu, SessionID, DeleteAll
Menu, ClipboardID, DeleteAll
Iniciate:=0
Gosub, ReloadSession
Return
/*
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
*/
ButtonLabelTray:
If CorpusCount=0
Return
NumberFile:=A_ThisMenuItemPos
Gosub, ButtonLabel
Return
ButtonLabel:
;NumberFile:= RegExReplace(NameTwo,"\D")
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
SoundPlay, Resources\Close Window.mp3
Gui, ContextClip1: Destroy
Gui, ContextClip: Destroy
;Gui, Destroy
Gui,2: Destroy
Gui, Gui1: Destroy
;Gui, 2:default
;Gui, destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
ControlOne :=0
ControlTwo :=0
threeRButton :=0
Alto:=0
Return
TxtLabel:
SoundPlay, Resources\Clipboard_Sound.mp3
StringTrimLeft, TextCopy, a_guicontrol, 5
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
Return
TxtPlane:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
global status_Delete ,tme
global status_URL ,tme
global status_Copy ,tme
global status_Editing ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
status_Delete:=""
status_URL:=""
status_Copy:=""
status_Editing:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
if instr(a_guicontrol,"Delete")
{
status_Delete:=a_guicontrol
SetTimer, Deletealert,-20
}
if instr(a_guicontrol,"URL")
{
status_URL:=a_guicontrol
SetTimer, URLalert,-20
}
if instr(a_guicontrol,"Copy")
{
status_Copy:=a_guicontrol
SetTimer, Copyalert,-20
}
if instr(a_guicontrol,"Editing")
{
status_Editing:=a_guicontrol
SetTimer, Editingalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
status_Delete_old:=""
status_URL_old:=""
status_Copy_old:=""
status_Editing_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
URLButton:
SoundPlay, Resources\Close Window.mp3
MsgBox, 0x1024,, Extract URL's from Clipboards?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
}
}
Gosub, ExtractURL
FileDelete, ToPDF.html
Return
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
Return True
}
;************************************************************************************************************************
ExtractURL:
;Create header html document
FileAppend,
(
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=AutoHotkey.File>
<meta name=Generator content="AutoHotkey">
</head>
<body lang=es style='font-family:Calibri;font-size:11.0pt'>
), Extracted_Links.html
FormatTime, CurrentDate,, dd-MM-yyyy
DateIncl := "<p style='margin:0in'><span style='font-family:Times New Roman;font-size:11.0pt;color:#1E4D78'>Clipboard Session URLs: </span><span style='font-weight:bold;font-family:Calibri;font-size:12.0pt;color:#860000'>" CurrentDate "</span></p>"
FileAppend, %DateIncl%, Extracted_Links.html
;Add Line
myResult := "<p style='margin:0in;font-family:Calibri;font-size:11.0pt;color:#78230C'><p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>`r
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>`r"
FileAppend, %myResult%, Extracted_Links.html
;Routine loop, origin: https://www.autohotkey.com/docs/commands/LoopReadFile.htm
LinkCount := 0
ImgCount := 0
Loop, read, ToPDF.html, Extracted_Links.html
{
URLSearchString := A_LoopReadLine
Gosub, URLSearch
}
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links.html
Loop, read, Extracted_Links.html
{
If A_Index < 11
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
if A_Index > 11
if RegExMatch(A_LoopReadLine, "\.(jpg<|jpeg<|png<|gif<|svg<)")
{
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
ImgCount++ ; increment by one
}
else If InStr(A_LoopReadLine, "</ul>", True) and A_Index > 17
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links_Img.html
}
;URL number message, Optional
MsgBox %LinkCount% links were found and written to "Extracted_Links.html" `n %ImgCount% Images were found and written to "Extracted_Links_Img.html"
;Opcional, opens the result
FormatTime, CurrentDate,, dd-MM-yyyy
FileURL := "Documents\Extracted_Links_" CurrentDate ".html"
FileURLImg := "Documents\Extracted_Links_Img_" CurrentDate ".html"
FileMove, Extracted_Links.html, %FileURL%
FileMove, Extracted_Links_Img.html, %FileURLImg%
FileDelete, ToPDF.html
Run, %FileURL%
Run, %FileURLImg%
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
URLStart1 := InStr(URLSearchString, "https://")
URLStart2 := InStr(URLSearchString, "http://")
URLStart3 := InStr(URLSearchString, "ftp://")
URLStart4 := InStr(URLSearchString, "www.")
; Find the left-most starting position:
URLStart := URLStart1 ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
ArrayElement := URLStart%A_Index%
if (ArrayElement = "") ; End of the pseudo-array has been reached.
break
if (ArrayElement = 0) ; This element is disqualified.
continue
if (URLStart = 0)
URLStart := ArrayElement
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if (ArrayElement != 0)
if (ArrayElement < URLStart)
URLStart := ArrayElement
}
}
if (URLStart = 0) ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
URL := SubStr(URLSearchString, URLStart) ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%<> ; Find the first space, tab, or angle (if any).
{
URL := A_LoopField
break ; i.e. perform only one loop iteration to fetch the first "field".
}
StringReplace, URLCleansed, URL, ",, All
; Makes a second check to replace extraneous signs.
FixString := % URLCleansed
vList := "
(
%21 !
%23 #
%24 $
%26 &
%27 '
%28 (
%29 )
%2A *
%2B +
%2C ,
%3B ;
%2F /
%3A :
%3D =
%3F ?
%40 @
%5B [
%5D ]
%20
%C2%B4 ´
%2E .
%25 %
%2D -
%3C <
%3E >
%5C \
%5E ^
%5F _
%60 `
%7B {
%7C |
%7D }
%7E ~
%22 ""
\/ \
)"
Loop, Parse, vList, `n
{
oTemp := StrSplit(A_LoopField, "`t")
FixString := StrReplace(FixString, oTemp.1, oTemp.2)
}
oTemp := ""
ClipBoard := "<li style='margin-top:0;margin-bottom:0;vertical-align:middle'><p style='margin:0in;font-family:Calibri;font-size:10.0pt'><a href=" FixString ">" FixString "</a></p></li>"
FileAppend, %ClipBoard%`n
LinkCount += 1
; See if there are any other URLs in this line:
CharactersToOmit := StrLen(URL)
CharactersToOmit += URLStart
URLSearchString := SubStr(URLSearchString, CharactersToOmit)
Gosub, URLSearch ; Recursive call to self.
return
;**********************************************************************************************
^F1::
CaseMenu:
Menu Case, Add
Menu Case, DeleteAll
Menu Case, Add, &UPPERCASE, CCase
Menu Case, Add, &lowercase, CCase
Menu Case, Add, &Title Case, CCase
Menu Case, Add, &a Title to Case, CCase
Menu Case, Add, &Sentence case, CCase
Menu Case, Add
Menu Case, Add, &Remove Spaces, CCase
GetText(Txt)
If NOT ERRORLEVEL
Menu Case, Show
Return
CCase:
p:=A_ThisMenuItemPos
If (p=1)
StringUpper, Txt, Txt
Else If (p=2)
StringLower, Txt, Txt
Else If (p=3)
StringLower, Txt, Txt, T
Else If (p=4)
{
StringLower, Txt, Txt
;IMPORTANT! Change short words to be replaced in the following list according to each language or add more
lowers := ["a", "ha", "el", "y", "pero", "o", "para", "las", "es", "para", "por", "los", "con", "en", "que", "un", "de", "del", "la", "una", "cada", "en", "al", "por", "uno", "mi", "tu", "tú", "no", "ni", "sin", "se", "lo", "e", "su", "sí", "ser", "hay"]
for k, v in lowers
low .= (k = 1 ? "" : "|") . v
;Txt := RegExReplace(Txt, "(*UCP)(^\b|\b(?!(" . low . ")\b))\w+\b|\b\w+\b$", "$T0")
;Txt := RegExReplace(Txt, "((?:^|[.!?-]\s+)[a-z])", "$u1")
Txt := RegExReplace(Txt, "(*UCP)(^|\b(?!(" . low . ")\b))\w|(\.|\?|!)\s*\K\w|-\K\w", "$T0")
}
Else If (p=5)
{
StringLower, Txt, Txt
Txt := RegExReplace(Txt, "((?:^|[.!?]\s+)[a-z])", "$u1")
}
Else If (p=7)
{
Loop
{
StringReplace, Txt, Txt, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0
break
}
}
PutText(Txt)
Return
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^{vk43} ;Ctrl C
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard =
Sleep 20
Clipboard := MyText
Send ^{vk56} ;Ctrl V
Sleep 100
Clipboard := SavedClip
Return
}
;*******************************************************************************
Nothing:
Return
Tray_Open:
ListLines
return
^!F4::
NewSession:
Gui, Session: Font, S8 Bold, Verdana
Gui, Session: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Session:+Owner
Gui, Session: Add, Edit, y8 vSessEdit h20 w544, New Session
Gui Session:Add, Button, x20 y37 w70 h20 gSessionSave, OK
Gui Session:Add, Button, x120 y37 w70 h20 gSessCancel, Cancel
xSess := Floor((A_ScreenWidth/2)-450)
ySess := Floor((A_ScreenHeight/2)-200)
Gui, Session: Show, x%xSess% y%ySess%
Return
SessionSave:
FileDelete, SessionTemp.txt
Gui, Session: Submit
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal1 := A_Index
FileCreateDir, HTMLTemp%SessionTotal1%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp" SessionTotal1 "\Session.txt"
FileAppend, %FileSession%, SessionTemp.txt
;Sleep, 3500
FileRead, Directory, SessionTemp.txt
FileAppend, %SessEdit%, %Directory%
Menu, SessionID, DeleteAll
Iniciate:=1
Gosub, ReloadSession
Return
SessCancel:
Gui, Session:Destroy
Gui, RenSession:Destroy
Return
LabelSessionAct:
ReadSess := "HTMLTemp\Session.txt"
FileRead, RenSession, %ReadSess%
Gui, RenSession: Font, S8 Bold, Verdana
Gui, RenSession: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, RenSession:+Owner
Gui, RenSession: Add, Edit, y8 vReSessEdit h20 w544, %RenSession%
Gui RenSession:Add, Button, x20 y37 w70 h20 gRenSessionSave, OK
Gui RenSession:Add, Button, x120 y37 w70 h20 gSessCancel, Cancel
xSess := Floor((A_ScreenWidth/2)-450)
ySess := Floor((A_ScreenHeight/2)-200)
Gui, RenSession: Show, x%xSess% y%ySess%
/*
NumberSessTemp := "HTMLTemp\Session.txt"
FileRead, Session1, %NumberSessTemp%
xSplash := A_ScreenWidth-506
ySplash := A_ScreenHeight-140
SplashTextOn, 500, 40, Name of the Current Session, %Session1%
WinMove, Name of the Current Session,, xSplash, ySplash
Sleep, 2500
SplashTextOff
*/
Return
RenSessionSave:
Gui, RenSession: Submit
FileDelete, HTMLTemp\Session.txt
FileAppend, %ReSessEdit%, HTMLTemp\Session.txt
Return
/*
Paused:
Paused:=!Paused
IfEqual,Paused,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Orange.ico
IfEqual,Paused,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Pause Script
Menu,Tray,Icon,,,1
Pause,Toggle,1
Return
*/
^F12::
Stanby:
Suspend:=!Suspend
IfEqual,Suspend,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Red.ico
IfEqual,Suspend,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Suspend Hotkeys
Menu,Tray,Icon,,,1
Suspend,Toggle
Return
EditScript:
Run Edit %A_ScriptName%
Return
*F7::
Reloaded:
Reload
Return
/*
^!F3::
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
^!F3::
Loop, read, SesionName.txt
{
Menu, MyMenu, add,%A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
;Menu, MyMenu, add, Clipboard, ButtonLabelTray
;Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
Menu, MyMenu, Color, FFFFFF
Menu, MyMenu, show
;}
Return
*/
^!F3::
;Loop, Parse, MyListBox, |
;Loop, read, SesionName.txt
;{
Gui, -Caption
Gui, Color, ffffd6
;Gui, Font, S12 Bold, Verdana
Gui, Font, s9, Segoe UI
Gui, Add, ListBox, vsesion w470 h225
;Gui, Add, ListBox, r5, Red|Green|Blue|Black|White
;Gui, MiListBox:Add, ListBox, r5 vColorChoice, %A_LoopReadLine%
;MsgBox Selection number %A_Index% is %A_LoopField%.
;}
Loop, read, SesionName.txt
{
GuiControl,, sesion, %A_LoopReadLine%
}
Gui, Show
/*
;To cancel, press ESCAPE or close this window.
Gui, Add, ListBox, vListBox_pdf x16 y10 w370 h125,
Gui, Add, ListBox, vListBox_ini x16 y145 w370 h125,
Gui, Add, Button, Default, OK
;----------------------------- Start Fill Listboxs
Loop, C:\temp\*.pdf
{
GuiControl,, ListBox_pdf, %A_LoopFileFullPath%
}
Loop, C:\*.ini
{
GuiControl,, ListBox_ini, %A_LoopFileFullPath%
}
Gui, Show
*/
NotifyTrayClick_201:
;xSplash := Floor((A_ScreenWidth/2)-450)
;ySplash := Floor((A_ScreenHeight/2)-200)
xSplash := A_ScreenWidth-506
ySplash := A_ScreenHeight-180
SplashTextOn, 500, 80, Content of the current clipboard, %Clipboard%
WinMove, Content of the current clipboard,, xSplash, ySplash
;SplashTextOn,,, Displays only a title bar.
Sleep, 1000
SplashTextOff
;SplashTextOn,,, %Clipboard%
;WinMove,,, xSplash, ySplash
;Sleep, 1000
;SplashTextOff
Return
Code: Select all
;https://www.autohotkey.com/boards/viewtopic.php?f=76&t=92963
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
;EnvSet, SD, %A_ScriptDir%
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
#Include Library\ViewHtml.ahk
;#Include Library\ToolTipEx.ahk
#SingleInstance, Force
#InstallMousehook
;#Persistent
SetBatchLines, -1
Name := "Clipboard Utility - "
Version := "4.1i"
CoordMode, Mouse, Screen
CoordMode, Mouse, Screen
CorpusCount := 0
DirectoryCount := 0
Iniciate:= 0
;Hotkey, LButton Up, off
;loop, HTMLTemp\Corpus*.html
;CorpusCount := % Floor(A_Index)
Menu, Tray, Icon, Resources\Scissors_Green.ico
Menu, Tray, NoStandard
Menu, tray, Add, %name% %version%, Nothing
Menu, tray, Icon, %name% %version%, Resources\Clipboard Utility.ico
Menu, Tray, Add
Menu, tray, Add, Exit , Exit
Menu, tray, Icon, Exit , shell32.dll, 132
Menu, Tray, Add
Menu, tray, Add, &Suspend Hotkeys , Stanby
Menu, tray, Icon,&Suspend Hotkeys , %A_ScriptDir%\Resources\Scissors_Red.ico
Menu, Tray, Add
Menu, Tray, Add, Help, HelpButton
Menu, Tray, Icon, Help, %A_ScriptDir%\Resources\Help.ico
Menu, Tray, Add
Menu Tray, Add, Open Info, Tray_Open
Menu Tray, Icon, Open Info, %A_ScriptDir%\Resources\Info.ico
Menu, tray, Add, &Reload this script , Reloaded
Menu, tray, Icon,&Reload this script , %A_ScriptDir%\Resources\2488.ico
Menu, tray, Add, &Edit this script , EditScript
Menu, tray, Icon,&Edit this script , comres.dll, 7
Menu, tray, Add,
Menu, winmanagetID, Add, Clipboard Window, RButtonAlt
Menu, winmanagetID, icon, Clipboard Window, %A_ScriptDir%\Resources\Clipboard Utility.ico
Menu, winmanagetID, Add, Utility Window, WUtil
Menu, winmanagetID, icon, Utility Window, %A_ScriptDir%\Resources\75a.ico
Menu, winmanagetID, Add, Copy Clipboard Window, CopyGui
Menu, winmanagetID, icon, Copy Clipboard Window, Resources\Clipboard Utility 5.ico
Menu, Tray, add, Window Management, :winmanagetID
Menu, tray, Icon, Window Management, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add, Save all Clipboard to PDF File, SavePDF
Menu, Tray, Icon, Save all Clipboard to PDF File, %A_ScriptDir%\Resources\PDF.ico
Menu, Tray, Add, Extract URL's from clipboard, URLButton
Menu, Tray, Icon, Extract URL's from clipboard, %A_ScriptDir%\Resources\URL.ico
Menu, DeleteID, Add, Delete Last Clipboard, DeleteLast
Menu, DeleteID, Add, Delete All Clipboard, DeleteAll
Menu, Tray, add, Delete Options, :DeleteID
Menu, tray, Icon, Delete Options, %A_ScriptDir%\Resources\Recycle 3.ico
Menu, Tray, Add
;**********************************************************************************************
ReloadSession:
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal := A_Index-1
FileDelete, SessionNumber.txt
;If !CorpusCount=0
;{
NumberSessTemp := "HTMLTemp\Session.txt"
FileRead, Session1, %NumberSessTemp%
; Fileappend, %Session1% `n, SessionNumber.txt
;Menu, SessionID, add, %Session1%, LabelSessionAct
;Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2293.ico
;Menu, SessionID, add
Menu, SessionID, add, Create New Session, NewSession
Menu, SessionID, Icon, Create New Session, %A_ScriptDir%\Resources\178.ico
Menu, SessionID, add
Menu, SessionID, add, 0: %Session1%, LabelSessionAct
Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2478.ico
;Menu, SessionID, add, Current Session, LabelSessionAct
;Menu, SessionID, Icon, Current Session, %A_ScriptDir%\Resources\2478.ico
;************************************************************************
loop, %SessionTotal%
{
FileDelete, SessionCount.txt
FileAppend, %A_ScriptDir%, SessionCount.txt
FullFile:="\HTMLTemp" A_Index "\*.*"
FileAppend, %FullFile%, SessionCount.txt
FileRead, CountFiles, SessionCount.txt
;MsgBox, %CountFiles%
loop, %CountFiles%
FilesCount := % Floor(A_Index/6)
NameTemp := "HTMLTemp" A_Index "\Session.txt"
FileRead, Session1, %NameTemp%
Fileappend, %Session1% |·| %FilesCount% Clipboards`n, SessionNumber.txt
;MsgBox, %FilesCount%
}
Loop, read, SessionNumber.txt
{
Menu, SessionID, add, %A_Index%: %A_LoopReadLine%, LabelSession
}
Menu, Tray, add, Clipboard Sessions, :SessionID
Menu, Tray, Icon, Clipboard Sessions, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add
;**********************************************************************
ReloadMenu:
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
Menu, ClipboardID, add, %A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
Menu, Tray, add, Clipboard, :ClipboardID
Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
}
Menu, Tray, Default, Clipboard
;Menu, Tray, Tip, Clipboard Utility 4.1f
Menu, Tray, Tip, This Session has 0%CorpusCount% Clipboards
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:+Owner
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, Resources\PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, Resources\PauseOff.png
GuiButtonIcon(Icon, "Resources\Clipboard Utility 5.ico", 1, "s90")
GoSub, Toggle_Switch
;CorpusCount := 0
/*
if FileExist("HTMLTemp\Text1.html")
MsgBox, 0x1034,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
*/
if !FileExist(HTMLTemp)
{
FileCreateDir, HTMLTemp
}
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
DirectoryCount := A_Index-1
;MsgBox, %DirectoryCount%
Filedelete, WorkingDir.txt
FileAppend, %A_ScriptDir%\, WorkingDir.txt
FileRead, ScriptDir, Workingdir.txt
threeRButton=1
If !Iniciate=1
Gosub, RButton
Return
^F4::
GuiUtily:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd
Gui, -Caption HwndHwnd
Gui, +Owner
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Add, Picture, x0 y0 w600 h167, Resources\Clipboard Utility_p.png
Gui, Add, Text, x0 y0 w552 h35 GuiMove ; , `&& Drag
Gui, Add, Picture, x0 y0 w552 h35, Resources\ArribaIzq.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "Resources\PDFup.png"
Gui1.Button1.HoverImage := "Resources\PDFhover.png"
Gui1.Button1.PressedImage := "Resources\PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Add, Picture, x16 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "Resources\PasteUp.png"
Gui1.Button2.HoverImage := "Resources\PasteHover.png"
Gui1.Button2.PressedImage := "Resources\PasteDown.png"
Gui1.Button2.Label := "ControlPaste"
Gui, Add, Picture, x158 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "Resources\ExitUp.png"
Gui1.Button3.HoverImage := "Resources\ExitHover.png"
Gui1.Button3.PressedImage := "Resources\ExitDown.png"
;Gui1.Button3.Label := "ExitLabel"
Gui1.Button3.Label := "GuiClose"
Gui, Add, Picture, x553 y0 w48 h35 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "Resources\HelpUp.png"
Gui1.Button4.HoverImage := "Resources\HelpHover.png"
Gui1.Button4.PressedImage := "Resources\HelpDown.png"
Gui1.Button4.Label := "HelpButton"
Gui, Add, Picture, x444 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 5
;************************************************************************************************************************
Gui1.Button5 := {} ;Button 5
Gui1.Button5.DefaultImage := "Resources\UrlUp.png"
Gui1.Button5.HoverImage := "Resources\UrlHover.png"
Gui1.Button5.PressedImage := "Resources\UrlDown.png"
Gui1.Button5.Label := "URLButton"
Gui, Add, Picture, x300 y36 w141 h115 hwndhwnd, % Gui1.Button5.DefaultImage
Gui1.Handles[ hwnd ] := "Button5" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
/*
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
*/
MouseGetPos, xposUtil, yposUtil
If UtilButton=1
{
xposUtil := Floor((A_ScreenWidth/2)-450)
yposUtil := Floor((A_ScreenHeight/2)-200)
}
Gui, Show, x%xposUtil% y%yposUtil% W600 h167, Hover
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
WUtil:
UtilButton:=1
Gosub, GuiUtily
Return
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, Resources\ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
CorpusCount++
accData:= GetAccData()
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
ImageCount := ScriptDir "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Iniciate:=1
Gosub, ReloadMenu
Return
CopyGui:
CopyButton:=1
;GoSub, Toggle_Switch
Gosub, Menu2
Return
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
FileDelete, HTMLTemp\Corpus%DelClip%.html
FileDelete, HTMLTemp\image%DelClip%.jpg
FileDelete, HTMLTemp\Name%DelClip%.txt
FileDelete, HTMLTemp\Text%DelClip%.html
FileDelete, HTMLTemp\TextPlain%DelClip%.txt
FileDelete, HTMLTemp\URL%DelClip%.txt
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
;CorpusCount--
;Gosub, RButton
Iniciate:=0
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
}
Return
^F8::
Menu2:
;MouseGetPos, xpos1, ypos1
MouseGetPos, xposMen, yposMen
If CopyButton=1
{
xposMen := Floor(A_ScreenWidth/2)
yposMen := Floor(A_ScreenHeight/2-100)
}
Gui, CopyButtom:Show, x%xposMen% y%yposMen% W81 h84
Return
+RButton::
RButton:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x520 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x540 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w20 h20 hwndIcon10 gClipDelete vDeleteButton%A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon9 gTitleEditing vEditing%A_Index%
Gui, ContextClip: Add, Button, x40 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "Resources\clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "Resources\128.ico", 1, "s32")
GuiButtonIcon(Icon8, "Resources\ArrowSmall.ico", 1, "s32")
GuiButtonIcon(Icon10, "Resources\recycle 2.ico", 1, "s32")
GuiButtonIcon(Icon9, "Resources\pencil 1.ico", 1, "s24")
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
;Gui, ContextClip: -Caption +ToolWindow +0x400000 +hWndhMainWnd ;Menu3s
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd
;Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
WinSet, Transparent
Gui, ContextClip:+Owner
posyExitSess := posyExit+20
;LeeSession:= ScriptDir "\HTMLTemp\Session.txt"
LeeSession:= "HTMLTemp\Session.txt"
FileRead, SessClip, %LeeSession%
Gui, ContextClip: Add, Picture, x0 y%posyExit% W29 h32 gLabelSessionAct, Resources\IConChange.png
Gui, ContextClip: Add, Picture, x498 y%posyExit% W72 h32 gReducedM, Resources\ReducedN.png
Gui, ContextClip: Add, Picture, x440 y%posyExit% W40 h32 gExitLabel, Resources\Close.png
Gui, ContextClip: Add, Picture, x30 y%posyExit% W435 h32 GuiMove, Resources\Resto1.png
Gui, ContextClip: Add, Picture, x0 y%posyExit% W560 h32, Resources\Fondo_p4.png
;Gui, Font, S12 Bold CDefault, Verdana
Gui, ContextClip: Font, S9 Bold, Verdana
posyExitSess1 := posyExit+08
Gui, ContextClip: Add, Text, cYellow BackgroundTrans +Center x2 y%posyExitSess1% vTextTitle W536 h20, %SessClip%
MouseGetPos, xpos1, ypos1
If threeRButton=1
{
xpos1 := Floor((A_ScreenWidth/2)-450)
ypos1 := Floor((A_ScreenHeight/2)-200)
}
If ControlTwo=1
{
xpos1 := XActTwo-140
ypos1 := yActTwo-13
}
;xpos1 := xpos1-560
;ypos1 := ypos1-alto
AltoSess := Alto+12
Gui, ContextClip: Show, x%xpos1% y%ypos1% w560 h%AltoSess% ;Menu3s
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
RButtonAlt:
threeRButton :=1
Gosub, RButton
Return
TitleEditing:
Gosub, NewWindow
StringTrimLeft, REdit, a_guicontrol, 7
FileChange := "HTMLTemp\Name" REdit ".txt"
FileRead, FileCont, %FileChange%
Gui, Edit: Font, S8 Bold, Verdana
Gui, Edit: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Edit:+Owner
Gui, Edit:Add, Edit, x8 y9 w546 h20 vMyEdit, %FileCont%
;Gui, Edit: Add, Edit, x12 y9 w460 h20 vMyEdit%REdit%, %FileCont%
Gui, Edit:Add, Button, x8 y37 w70 h20 gTitleSave, OK
Gui, Edit:Add, Button, x100 y37 w70 h20 gTitleCancel, Cancel
Gui, Edit:Add, CheckBox, x240 y37 w210 h20 Checked1 vVeryfyChange, Change also the Title to Paste
EdXm := pXm-846
EdYm := pYm-96
Gui, Edit:Show, x%EdXm% y%EdYm% h63 w564
Return
TitleSave:
Gui, Edit: Submit, Destroy
fileAdd := FileOpen(FileChange, "w")
fileAdd.Write(MyEdit)
fileAdd.Close()
If VeryfyChange=1
{
ReadURL := "HTMLTemp\URL" REdit ".txt"
Fileread URLTxt, %ReadURL%
ReadText:= "HTMLTemp\Text" REdit ".html"
FileDelete, %ReadText%
myResultSave := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" URLTxt ">" MyEdit "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResultSave%, %ReadText%
}
MyEdit :=""
Reload
Return
TitleCancel:
Gui, Edit: Destroy
MyEdit :=""
;Gosub, NewWindow
Reload
Return
ReducedM:
WinGetPos, XActOne, YActOne,,, A
Gui, ContextClip: Destroy
ControlOne :=1
ControlTwo :=0
Gosub, NotifyTrayClick_207
Return
NotifyTrayClick_207:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip1: Add, Button, x0 y%posy% w460 h20 gButtonTwo vTwoButton%A_Index%, %A_LoopReadLine%
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip1: Margin, 2, 2
Gui, ContextClip1: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd ;Menu31s
Gui, ContextClip1: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip1:+Owner
Gui, ContextClip1: Add, Button, x20 y%posyExit% w380 h20 gExitLabel, Exit Menu
Gui, ContextClip1: Add, Button, x400 y%posyExit% w60 h20 hwndIcon20 gExtendedM
Gui, ContextClip1: Add, Text, x0 y%posyExit% w20 h20 GuiMove, `&& Drag
Gui, ContextClip1: Add, Button, x0 y%posyExit% w20 h20 hwndIcon21
AltoT := Floor((CorpusCount+1)*31.5)
XPos:= A_ScreenWidth-(700)
YPos:= A_ScreenHeight-AltoT-60
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
ExtendedM:
WinGetPos, XActTwo, YActTwo,,, A
Gui, ContextClip1: Destroy
ControlOne :=0
ControlTwo :=1
Gosub, RButton
Return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: New
Gui, Help: -Caption
Gui, Help: +Owner
Gui, Help: Color, EEAA99
Gui, Help: Margin, 0, 0
Gui, Help: Add, Picture, x0 y0 w640 h250, Resources\Help.jpg
Gui, Help: Add, Button, x495 y209 w100 h30 gNextButton, More...
Gui, Help: Show, w640 h250
Return
NextButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: Destroy
Gui, Help2: New
Gui, Help2: -Caption
Gui, Help2: +Owner
Gui, Help2: Color, EEAA99
Gui, Help2: Margin, 0, 0
Gui, Help2: Add, Picture, x0 y0 w800 h397, Resources\Clipboard Utility Screenshot.jpg
Gui, Help2: Add, Button, x10 y340 w100 h30 gExitButton, Exit
Gui, Help2: Show, w800 h397
Return
ExitButton:
Gui, Help2: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Resources\Close Window.mp3
CopyButton=0
UtilButton :=0
Gui, Hide
Gui, CopyButtom:Hide
Return
;*************************************************************************
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace(status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
Gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
status_button_old:=status_button
return
;*************************************************************************
Deletealert:
if (status_delete=status_delete_old)
return
Gui, 4:default
Gui, destroy
NumberDelete:= RegExReplace(status_delete,"\D")
if !NumberDelete
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Delete Clipboard Number %NumberDelete%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 4:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 4:margin, 0, 0
Gui, 4:add, ActiveX, vWB w64 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
DelXm := pXm-944
GuiControl, Move, WB, h%maxBottom%
Gui, 4: Show, x%DelXm% y%pYm% w64 h60
status_delete_old:=status_delete
Return
;*************************************************************************
Copyalert:
if (status_Copy=status_Copy_old)
return
Gui, 6:default
Gui, destroy
NumberCopy:= RegExReplace(status_Copy,"\D")
if !NumberCopy
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Copy Item %NumberCopy% as Current Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 6:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 6:margin, 0, 0
Gui, 6:add, ActiveX, vWB w60 h72, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 6: Show, x%pXm% y%pYm% w60 h72
status_Copy_old:=status_Copy
Return
;*************************************************************************
URLalert:
if (status_URL=status_URL_old)
return
Gui, 5:default
Gui, destroy
NumberURL:= RegExReplace(status_URL,"\D")
URL_file := "HTMLTemp\URL" NumberURL ".txt"
if !URL_file
return
;Gui,2:Destroy
;URL_file := "HTMLTemp\URL" NumberURL ".txt"
FileRead, URLContents, %URL_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Go to: %URLContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 5:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 5:margin, 0, 0
Gui, 5:add, ActiveX, vWB w562 h30, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
DelXm := pXm-845
;DelXm := pXm-819
DelYm := pYm-47
;Gui, 5: Show, x%DelXm% y%DelYm% w543 h30
Gui, 5: Show, x%DelXm% y%DelYm% w562 h30
status_URL_old:=status_URL
Return
;*************************************************************************
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace(status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Gui,5:Destroy
FileRead, FileContents, %Text_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 3:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 3:margin, 0, 0
Gui, 3:add, ActiveX, vWB w320 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
;*************************************************************************
Editingalert:
if (status_Editing=status_Editing_old)
return
Gui, 6:default
Gui, destroy
EditingNumber:= RegExReplace(status_Editing,"\D")
if !EditingNumber
return
Gui,2:Destroy
Gui,5:Destroy
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Edit Title of the %EditingNumber%th Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 7: +AlwaysOnTop -Caption +ToolWindow Border
;Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui, 7:margin, 0, 0
gui, 7:add, ActiveX, vWB w62 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
;DelXm := pXm-953
GuiControl, Move, WB, h%maxBottom%
gui, 7: Show, x%pXm% y%pYm% w62 h60
status_Editing_old:=status_Editing
Return
;*************************************************************************
^F6::
ControlPaste:
MsgBox, 0x1034,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Hide
;Gui, Destroy
;Gui, -MinimizeBox
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Resources\Close Window.mp3
Return
^F10::
DeleteAll:
MsgBox, 0x1034,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
SavePDF:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, -MinimizeBox
Sleep, 1000
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, Resources\PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
FormatTime, CurrentDate,, dd-MM-yyyy
Filedate := "Documents\Final_Document_" CurrentDate ".pdf"
Filedateh := "Documents\oPDF_" CurrentDate ".html"
FileMove, Final_Document.pdf, %Filedate%
Run, %Filedate%
FileMove, ToPDF.html, %Filedateh%
;FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Return
^F11::
DeleteLast:
MsgBox, 0x1034,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
;FileDelete, HTMLTemp\*%CorpusCount%.*
FileDelete, HTMLTemp\Corpus%CorpusCount%.html
FileDelete, HTMLTemp\image%CorpusCount%.jpg
FileDelete, HTMLTemp\Name%CorpusCount%.txt
FileDelete, HTMLTemp\Text%CorpusCount%.html
FileDelete, HTMLTemp\TextPlain%CorpusCount%.txt
FileDelete, HTMLTemp\URL%CorpusCount%.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
;CorpusCount--
Return
^Esc::
Exit:
ExitApp
Return
Borrado:
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, LabelSessionAct
Gosub, ReloadMenu
Return
ButtonTwo:
StringTrimLeft, NumberFile, a_guicontrol, 9
;Gui, 2: Destroy
;Gui, ContextClip: Destroy
Gosub, ButtonLabel
Return
LabelSession:
;NumberFile:=A_ThisMenuItemPos
;Menu, tray, ToggleCheck, &Suspend Hotkeys
;Menu, tray, ToggleCheck, Clipboard Sessions
MsgBox, 0x1024,, You want the session %A_ThisMenuItem% to be the default session?
IfMsgBox No
Return
;Loop, %DirectoryCount%
/*
if !FileExist("HTMLTemp" A_Index)
{
;NumberDir : %A_Index%
MoveDir := "HTMLTemp" A_Index
}
MsgBox, %MoveDir%
*/
FileDelete, SessionTemp*.txt
FileDelete, SessionTemp00.txt
FileDelete, SessionTemp01.txt
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
NumSess := A_Index-1
NumberPos:= A_ThisMenuItemPos-3
;MsgBox, %NumberPos%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp"
FileAppend, %FileSession%, SessionTemp.txt
FileAppend, %A_ScriptDir%, SessionTemp00.txt
FileSession2 := "\HTMLTemp00"
FileAppend, %FileSession2%, SessionTemp00.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;FileMove %DirectorySess%, %DirectorySess00%
FileMoveDir %DirectorySess%, %DirectorySess00%, R
;DirectorySess :=""
;DirectorySess00 :=""
FileAppend, %A_ScriptDir%, SessionTemp01.txt
FileSession3 := "\HTMLTemp" NumberPos
FileAppend, %FileSession3%, SessionTemp01.txt
FileRead, DirectorySess01, SessionTemp01.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;MsgBox, %DirectorySess01%`n%DirectorySess%
FileMoveDir %DirectorySess01%, %DirectorySess%, R
FileMoveDir %DirectorySess00%, %DirectorySess01%, R
Menu, SessionID, DeleteAll
Menu, ClipboardID, DeleteAll
Iniciate:=0
Gosub, ReloadSession
Return
/*
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
*/
ButtonLabelTray:
If CorpusCount=0
Return
NumberFile:=A_ThisMenuItemPos
Gosub, ButtonLabel
Return
ButtonLabel:
;NumberFile:= RegExReplace(NameTwo,"\D")
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
SoundPlay, Resources\Close Window.mp3
Gui, ContextClip1: Destroy
Gui, ContextClip: Destroy
;Gui, Destroy
Gui,2: Destroy
Gui, Gui1: Destroy
;Gui, 2:default
;Gui, destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
ControlOne :=0
ControlTwo :=0
threeRButton :=0
Alto:=0
Return
TxtLabel:
SoundPlay, Resources\Clipboard_Sound.mp3
StringTrimLeft, TextCopy, a_guicontrol, 5
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
Return
TxtPlane:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
global status_Delete ,tme
global status_URL ,tme
global status_Copy ,tme
global status_Editing ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
status_Delete:=""
status_URL:=""
status_Copy:=""
status_Editing:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
if instr(a_guicontrol,"Delete")
{
status_Delete:=a_guicontrol
SetTimer, Deletealert,-20
}
if instr(a_guicontrol,"URL")
{
status_URL:=a_guicontrol
SetTimer, URLalert,-20
}
if instr(a_guicontrol,"Copy")
{
status_Copy:=a_guicontrol
SetTimer, Copyalert,-20
}
if instr(a_guicontrol,"Editing")
{
status_Editing:=a_guicontrol
SetTimer, Editingalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
status_Delete_old:=""
status_URL_old:=""
status_Copy_old:=""
status_Editing_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
URLButton:
SoundPlay, Resources\Close Window.mp3
MsgBox, 0x1024,, Extract URL's from Clipboards?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
}
}
Gosub, ExtractURL
FileDelete, ToPDF.html
Return
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
Return True
}
;************************************************************************************************************************
ExtractURL:
;Create header html document
FileAppend,
(
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=AutoHotkey.File>
<meta name=Generator content="AutoHotkey">
</head>
<body lang=es style='font-family:Calibri;font-size:11.0pt'>
), Extracted_Links.html
FormatTime, CurrentDate,, dd-MM-yyyy
DateIncl := "<p style='margin:0in'><span style='font-family:Times New Roman;font-size:11.0pt;color:#1E4D78'>Clipboard Session URLs: </span><span style='font-weight:bold;font-family:Calibri;font-size:12.0pt;color:#860000'>" CurrentDate "</span></p>"
FileAppend, %DateIncl%, Extracted_Links.html
;Add Line
myResult := "<p style='margin:0in;font-family:Calibri;font-size:11.0pt;color:#78230C'><p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>`r
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>`r"
FileAppend, %myResult%, Extracted_Links.html
;Routine loop, origin: https://www.autohotkey.com/docs/commands/LoopReadFile.htm
LinkCount := 0
ImgCount := 0
Loop, read, ToPDF.html, Extracted_Links.html
{
URLSearchString := A_LoopReadLine
Gosub, URLSearch
}
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links.html
Loop, read, Extracted_Links.html
{
If A_Index < 11
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
if A_Index > 11
if RegExMatch(A_LoopReadLine, "\.(jpg<|jpeg<|png<|gif<|svg<)")
{
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
ImgCount++ ; increment by one
}
else If InStr(A_LoopReadLine, "</ul>", True) and A_Index > 17
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links_Img.html
}
;URL number message, Optional
MsgBox %LinkCount% links were found and written to "Extracted_Links.html" `n %ImgCount% Images were found and written to "Extracted_Links_Img.html"
;Opcional, opens the result
FormatTime, CurrentDate,, dd-MM-yyyy
FileURL := "Documents\Extracted_Links_" CurrentDate ".html"
FileURLImg := "Documents\Extracted_Links_Img_" CurrentDate ".html"
FileMove, Extracted_Links.html, %FileURL%
FileMove, Extracted_Links_Img.html, %FileURLImg%
FileDelete, ToPDF.html
Run, %FileURL%
Run, %FileURLImg%
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
URLStart1 := InStr(URLSearchString, "https://")
URLStart2 := InStr(URLSearchString, "http://")
URLStart3 := InStr(URLSearchString, "ftp://")
URLStart4 := InStr(URLSearchString, "www.")
; Find the left-most starting position:
URLStart := URLStart1 ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
ArrayElement := URLStart%A_Index%
if (ArrayElement = "") ; End of the pseudo-array has been reached.
break
if (ArrayElement = 0) ; This element is disqualified.
continue
if (URLStart = 0)
URLStart := ArrayElement
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if (ArrayElement != 0)
if (ArrayElement < URLStart)
URLStart := ArrayElement
}
}
if (URLStart = 0) ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
URL := SubStr(URLSearchString, URLStart) ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%<> ; Find the first space, tab, or angle (if any).
{
URL := A_LoopField
break ; i.e. perform only one loop iteration to fetch the first "field".
}
StringReplace, URLCleansed, URL, ",, All
; Makes a second check to replace extraneous signs.
FixString := % URLCleansed
vList := "
(
%21 !
%23 #
%24 $
%26 &
%27 '
%28 (
%29 )
%2A *
%2B +
%2C ,
%3B ;
%2F /
%3A :
%3D =
%3F ?
%40 @
%5B [
%5D ]
%20
%C2%B4 ´
%2E .
%25 %
%2D -
%3C <
%3E >
%5C \
%5E ^
%5F _
%60 `
%7B {
%7C |
%7D }
%7E ~
%22 ""
\/ \
)"
Loop, Parse, vList, `n
{
oTemp := StrSplit(A_LoopField, "`t")
FixString := StrReplace(FixString, oTemp.1, oTemp.2)
}
oTemp := ""
ClipBoard := "<li style='margin-top:0;margin-bottom:0;vertical-align:middle'><p style='margin:0in;font-family:Calibri;font-size:10.0pt'><a href=" FixString ">" FixString "</a></p></li>"
FileAppend, %ClipBoard%`n
LinkCount += 1
; See if there are any other URLs in this line:
CharactersToOmit := StrLen(URL)
CharactersToOmit += URLStart
URLSearchString := SubStr(URLSearchString, CharactersToOmit)
Gosub, URLSearch ; Recursive call to self.
return
;**********************************************************************************************
^F1::
CaseMenu:
Menu Case, Add
Menu Case, DeleteAll
Menu Case, Add, &UPPERCASE, CCase
Menu Case, Add, &lowercase, CCase
Menu Case, Add, &Title Case, CCase
Menu Case, Add, &a Title to Case, CCase
Menu Case, Add, &Sentence case, CCase
Menu Case, Add
Menu Case, Add, &Remove Spaces, CCase
GetText(Txt)
If NOT ERRORLEVEL
Menu Case, Show
Return
CCase:
p:=A_ThisMenuItemPos
If (p=1)
StringUpper, Txt, Txt
Else If (p=2)
StringLower, Txt, Txt
Else If (p=3)
StringLower, Txt, Txt, T
Else If (p=4)
{
StringLower, Txt, Txt
;IMPORTANT! Change short words to be replaced in the following list according to each language or add more
lowers := ["a", "ha", "el", "y", "pero", "o", "para", "las", "es", "para", "por", "los", "con", "en", "que", "un", "de", "del", "la", "una", "cada", "en", "al", "por", "uno", "mi", "tu", "tú", "no", "ni", "sin", "se", "lo", "e", "su", "sí", "ser", "hay"]
for k, v in lowers
low .= (k = 1 ? "" : "|") . v
;Txt := RegExReplace(Txt, "(*UCP)(^\b|\b(?!(" . low . ")\b))\w+\b|\b\w+\b$", "$T0")
;Txt := RegExReplace(Txt, "((?:^|[.!?-]\s+)[a-z])", "$u1")
Txt := RegExReplace(Txt, "(*UCP)(^|\b(?!(" . low . ")\b))\w|(\.|\?|!)\s*\K\w|-\K\w", "$T0")
}
Else If (p=5)
{
StringLower, Txt, Txt
Txt := RegExReplace(Txt, "((?:^|[.!?]\s+)[a-z])", "$u1")
}
Else If (p=7)
{
Loop
{
StringReplace, Txt, Txt, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0
break
}
}
PutText(Txt)
Return
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^{vk43} ;Ctrl C
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard =
Sleep 20
Clipboard := MyText
Send ^{vk56} ;Ctrl V
Sleep 100
Clipboard := SavedClip
Return
}
;*******************************************************************************
Nothing:
Return
Tray_Open:
ListLines
return
^!F4::
NewSession:
Gui, Session: Font, S8 Bold, Verdana
Gui, Session: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Session:+Owner
Gui, Session: Add, Edit, y8 vSessEdit h20 w544, New Session
Gui Session:Add, Button, x20 y37 w70 h20 gSessionSave, OK
Gui Session:Add, Button, x120 y37 w70 h20 gSessCancel, Cancel
xSess := Floor((A_ScreenWidth/2)-450)
ySess := Floor((A_ScreenHeight/2)-200)
Gui, Session: Show, x%xSess% y%ySess%
Return
SessionSave:
FileDelete, SessionTemp.txt
Gui, Session: Submit
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal1 := A_Index
FileCreateDir, HTMLTemp%SessionTotal1%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp" SessionTotal1 "\Session.txt"
FileAppend, %FileSession%, SessionTemp.txt
;Sleep, 3500
FileRead, Directory, SessionTemp.txt
FileAppend, %SessEdit%, %Directory%
Menu, SessionID, DeleteAll
Iniciate:=1
Gosub, ReloadSession
Return
SessCancel:
Gui, Session:Destroy
Gui, RenSession:Destroy
Return
/*
LabelSessionAct1:
Position :=1
Return
*/
LabelSessionAct:
ReadSess := "HTMLTemp\Session.txt"
FileRead, RenSession, %ReadSess%
Gui, RenSession: Font, S8 Bold, Verdana
Gui, RenSession: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, RenSession:+Owner
Gui, RenSession: Add, Edit, y8 vReSessEdit h20 w544, %RenSession%
Gui RenSession:Add, Button, x20 y37 w70 h20 gRenSessionSave, OK
Gui RenSession:Add, Button, x120 y37 w70 h20 gSessCancel, Cancel
xSess := Floor((A_ScreenWidth/2)-450)
ySess := Floor((A_ScreenHeight/2)-200)
Gui, RenSession: Show, x%xSess% y%ySess%
/*
NumberSessTemp := "HTMLTemp\Session.txt"
FileRead, Session1, %NumberSessTemp%
xSplash := A_ScreenWidth-506
ySplash := A_ScreenHeight-140
SplashTextOn, 500, 40, Name of the Current Session, %Session1%
WinMove, Name of the Current Session,, xSplash, ySplash
Sleep, 2500
SplashTextOff
*/
Return
RenSessionSave:
Gui, RenSession: Submit
FileDelete, HTMLTemp\Session.txt
FileAppend, %ReSessEdit%, HTMLTemp\Session.txt
Gosub, RButton
Return
/*
Paused:
Paused:=!Paused
IfEqual,Paused,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Orange.ico
IfEqual,Paused,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Pause Script
Menu,Tray,Icon,,,1
Pause,Toggle,1
Return
*/
^F12::
Stanby:
Suspend:=!Suspend
IfEqual,Suspend,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Red.ico
IfEqual,Suspend,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Suspend Hotkeys
Menu,Tray,Icon,,,1
Suspend,Toggle
Return
EditScript:
Run Edit %A_ScriptName%
Return
^F7::
Reloaded:
Reload
Return
/*
^!F3::
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
^!F3::
Loop, read, SesionName.txt
{
Menu, MyMenu, add,%A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
;Menu, MyMenu, add, Clipboard, ButtonLabelTray
;Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
Menu, MyMenu, Color, FFFFFF
Menu, MyMenu, show
;}
Return
*/
^!F3::
;Loop, Parse, MyListBox, |
;Loop, read, SesionName.txt
;{
Gui, -Caption
Gui, Color, ffffd6
;Gui, Font, S12 Bold, Verdana
Gui, Font, s9, Segoe UI
Gui, Add, ListBox, vsesion w470 h225
;Gui, Add, ListBox, r5, Red|Green|Blue|Black|White
;Gui, MiListBox:Add, ListBox, r5 vColorChoice, %A_LoopReadLine%
;MsgBox Selection number %A_Index% is %A_LoopField%.
;}
Loop, read, SesionName.txt
{
GuiControl,, sesion, %A_LoopReadLine%
}
Gui, Show
/*
;To cancel, press ESCAPE or close this window.
Gui, Add, ListBox, vListBox_pdf x16 y10 w370 h125,
Gui, Add, ListBox, vListBox_ini x16 y145 w370 h125,
Gui, Add, Button, Default, OK
;----------------------------- Start Fill Listboxs
Loop, C:\temp\*.pdf
{
GuiControl,, ListBox_pdf, %A_LoopFileFullPath%
}
Loop, C:\*.ini
{
GuiControl,, ListBox_ini, %A_LoopFileFullPath%
}
Gui, Show
*/
NotifyTrayClick_201:
;xSplash := Floor((A_ScreenWidth/2)-450)
;ySplash := Floor((A_ScreenHeight/2)-200)
xSplash := A_ScreenWidth-506
ySplash := A_ScreenHeight-180
SplashTextOn, 500, 80, Content of the current clipboard, %Clipboard%
WinMove, Content of the current clipboard,, xSplash, ySplash
;SplashTextOn,,, Displays only a title bar.
Sleep, 1000
SplashTextOff
;SplashTextOn,,, %Clipboard%
;WinMove,,, xSplash, ySplash
;Sleep, 1000
;SplashTextOff
Return
Code: Select all
;https://www.autohotkey.com/boards/viewtopic.php?f=76&t=92963
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
;EnvSet, SD, %A_ScriptDir%
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
#Include Library\ViewHtml.ahk
;#Include Library\ToolTipEx.ahk
#SingleInstance, Force
#InstallMousehook
;#Persistent
SetBatchLines, -1
Name := "Clipboard Utility - "
Version := "4.1m"
CoordMode, Mouse, Screen
CoordMode, Mouse, Screen
CorpusCount := 0
DirectoryCount := 0
Iniciate:= 0
;Hotkey, LButton Up, off
;loop, HTMLTemp\Corpus*.html
;CorpusCount := % Floor(A_Index)
Menu, Tray, Icon, Resources\Scissors_Green.ico
Menu, Tray, NoStandard
Menu, tray, Add, %name% %version%, Nothing
Menu, tray, Icon, %name% %version%, Resources\Clipboard Utility.ico
Menu, Tray, Add
Menu, tray, Add, Exit , Exit
Menu, tray, Icon, Exit , shell32.dll, 132
Menu, Tray, Add
Menu, tray, Add, &Suspend Hotkeys , Stanby
Menu, tray, Icon,&Suspend Hotkeys , %A_ScriptDir%\Resources\Scissors_Red.ico
Menu, Tray, Add
Menu, Tray, Add, Help, HelpButton
Menu, Tray, Icon, Help, %A_ScriptDir%\Resources\Help.ico
Menu, Tray, Add
Menu Tray, Add, Open Info, Tray_Open
Menu Tray, Icon, Open Info, %A_ScriptDir%\Resources\Info.ico
Menu, tray, Add, &Reload this script , Reloaded
Menu, tray, Icon,&Reload this script , %A_ScriptDir%\Resources\2488.ico
Menu, tray, Add, &Edit this script , EditScript
Menu, tray, Icon,&Edit this script , comres.dll, 7
Menu, tray, Add,
Menu, winmanagetID, Add, Clipboard Window, RButtonAlt
Menu, winmanagetID, icon, Clipboard Window, %A_ScriptDir%\Resources\Clipboard Utility.ico
Menu, winmanagetID, Add, Utility Window, WUtil
Menu, winmanagetID, icon, Utility Window, %A_ScriptDir%\Resources\75a.ico
Menu, winmanagetID, Add, Copy Clipboard Window, CopyGui
Menu, winmanagetID, icon, Copy Clipboard Window, Resources\Clipboard Utility 5.ico
Menu, Tray, add, Window Management, :winmanagetID
Menu, tray, Icon, Window Management, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add, Save all Clipboard to PDF File, SavePDF
Menu, Tray, Icon, Save all Clipboard to PDF File, %A_ScriptDir%\Resources\PDF.ico
Menu, Tray, Add, Extract URL's from clipboard, URLButton
Menu, Tray, Icon, Extract URL's from clipboard, %A_ScriptDir%\Resources\URL.ico
Menu, DeleteID, Add, Delete Last Clipboard, DeleteLast
Menu, DeleteID, Add, Delete All Clipboard, DeleteAll
Menu, Tray, add, Delete Options, :DeleteID
Menu, tray, Icon, Delete Options, %A_ScriptDir%\Resources\Recycle 3.ico
Menu, Tray, Add
;**********************************************************************************************
ReloadSession:
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal := A_Index-1
FileDelete, SessionNumber.txt
;If !CorpusCount=0
;{
NumberSessTemp := "HTMLTemp\Session.txt"
FileRead, Session1, %NumberSessTemp%
; Fileappend, %Session1% `n, SessionNumber.txt
;Menu, SessionID, add, %Session1%, LabelSessionAct
;Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2293.ico
;Menu, SessionID, add
Menu, SessionID, add, Create New Session, NewSession
Menu, SessionID, Icon, Create New Session, %A_ScriptDir%\Resources\178.ico
Menu, SessionID, add
Menu, SessionID, add, 0: %Session1%, LabelSessionAct
Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2478.ico
;Menu, SessionID, add, Current Session, LabelSessionAct
;Menu, SessionID, Icon, Current Session, %A_ScriptDir%\Resources\2478.ico
;************************************************************************
loop, %SessionTotal%
{
FileDelete, SessionCount.txt
FileAppend, %A_ScriptDir%, SessionCount.txt
FullFile:="\HTMLTemp" A_Index "\*.*"
FileAppend, %FullFile%, SessionCount.txt
FileRead, CountFiles, SessionCount.txt
;MsgBox, %CountFiles%
loop, %CountFiles%
FilesCount := % Floor(A_Index/6)
NameTemp := "HTMLTemp" A_Index "\Session.txt"
FileRead, Session1, %NameTemp%
Fileappend, %Session1% |·| %FilesCount% Clipboards`n, SessionNumber.txt
;MsgBox, %FilesCount%
}
Loop, read, SessionNumber.txt
{
Menu, SessionID, add, %A_Index%: %A_LoopReadLine%, LabelSession
}
Menu, Tray, add, Clipboard Sessions, :SessionID
Menu, Tray, Icon, Clipboard Sessions, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add
;**********************************************************************
ReloadMenu:
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
Menu, ClipboardID, add, %A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
Menu, Tray, add, Clipboard, :ClipboardID
Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
}
Menu, Tray, Default, Window Management
;Menu, Tray, Default, Clipboard Sessions
;Menu, Tray, Tip, Clipboard Utility 4.1f
Menu, Tray, Tip, This Session has 0%CorpusCount% Clipboards
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:+Owner
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, Resources\PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, Resources\PauseOff.png
GuiButtonIcon(Icon, "Resources\Clipboard Utility 5.ico", 1, "s90")
GoSub, Toggle_Switch
;CorpusCount := 0
/*
if FileExist("HTMLTemp\Text1.html")
MsgBox, 0x1034,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
*/
if !FileExist(HTMLTemp)
{
FileCreateDir, HTMLTemp
}
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
DirectoryCount := A_Index-1
;MsgBox, %DirectoryCount%
Filedelete, WorkingDir.txt
FileAppend, %A_ScriptDir%\, WorkingDir.txt
FileRead, ScriptDir, Workingdir.txt
threeRButton=1
If !Iniciate=1
Gosub, RButton
Return
^F4::
GuiUtily:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd
Gui, -Caption HwndHwnd
Gui, +Owner
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Add, Picture, x0 y0 w600 h167, Resources\Clipboard Utility_p.png
;Gui, Add, Text, x0 y0 w552 h35 GuiMove ; , `&& Drag
Gui, Add, Picture, x0 y0 w552 h35 GuiMove, Resources\ArribaIzq.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "Resources\PDFup.png"
Gui1.Button1.HoverImage := "Resources\PDFhover.png"
Gui1.Button1.PressedImage := "Resources\PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Add, Picture, x16 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "Resources\PasteUp.png"
Gui1.Button2.HoverImage := "Resources\PasteHover.png"
Gui1.Button2.PressedImage := "Resources\PasteDown.png"
Gui1.Button2.Label := "ControlPaste"
Gui, Add, Picture, x158 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "Resources\ExitUp.png"
Gui1.Button3.HoverImage := "Resources\ExitHover.png"
Gui1.Button3.PressedImage := "Resources\ExitDown.png"
;Gui1.Button3.Label := "ExitLabel"
Gui1.Button3.Label := "GuiClose"
Gui, Add, Picture, x553 y0 w48 h35 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "Resources\HelpUp.png"
Gui1.Button4.HoverImage := "Resources\HelpHover.png"
Gui1.Button4.PressedImage := "Resources\HelpDown.png"
Gui1.Button4.Label := "HelpButton"
Gui, Add, Picture, x444 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 5
;************************************************************************************************************************
Gui1.Button5 := {} ;Button 5
Gui1.Button5.DefaultImage := "Resources\UrlUp.png"
Gui1.Button5.HoverImage := "Resources\UrlHover.png"
Gui1.Button5.PressedImage := "Resources\UrlDown.png"
Gui1.Button5.Label := "URLButton"
Gui, Add, Picture, x300 y36 w141 h115 hwndhwnd, % Gui1.Button5.DefaultImage
Gui1.Handles[ hwnd ] := "Button5" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
/*
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
*/
MouseGetPos, xposUtil, yposUtil
If UtilButton=1
{
xposUtil := Floor((A_ScreenWidth/2)-450)
yposUtil := Floor((A_ScreenHeight/2)-200)
}
Gui, Show, x%xposUtil% y%yposUtil% W600 h167, Hover
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
WUtil:
UtilButton:=1
Gosub, GuiUtily
Return
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, Resources\ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
accData:= GetAccData()
;******************************************************************************************************************
If not ClipboardGet_HTML( Data )
{
ErrorType :=1
Gosub, ControlError
;MsgBox, The content of the clipboard does not have a valid format to be saved and the operation will be canceled.
Return
}
Else
CorpusCount++
;******************************************************************************************************************
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
;******************************************************************************************************************
FileGetSize, SizeFile, %FileaccData%
If !FileaccData or SizeFile=3
{
ErrorType :=0
Gosub, ControlError
If ErrorTex=0
Return
}
;******************************************************************************************************************
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
;******************************************************************************************************************
FileGetSize, SizeFile1, %FileTex%
If !FileTex or SizeFile1=3
{
ErrorType :=0
Gosub, ControlError
If ErrorTex=0
Return
}
;******************************************************************************************************************
;ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html, CP65001
;******************************************************************************************************************
FileGetSize, SizeFile2, Temp.html
;MsgBox, %SizeFile2%
FileHTML := "Temp.html"
If !FileHTML or SizeFile2=3
{
ErrorType :=1
Gosub, ControlError
;If ErrorTex=0
Return
}
;******************************************************************************************************************
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%, TempPDF.html
}
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
;ImageCount := ScriptDir "HTMLTemp\Image" CorpusCount ".jpg"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
;******************************************************************************************************************
If !ImageCount
{
ErrorType :=2
Gosub, ControlError
If ErrorImg=0
{
FileCopy Resources\No Image File.jpg, %ImageCount%
Return
}
}
;******************************************************************************************************************
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
;Gosub, CheckProcess
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Iniciate:=1
Data :=""
Gosub, ReloadMenu
Return
ControlError:
If ErrorType =0
{
MsgBox, 0x1024,, You have not been able to save the name of the clipboard source, you will be able to name it later. `nContinue in every way?
IfMsgBox Yes
{
ErrorTex:=1
Return
}
ErrorText:=0
Return
}
If ErrorType =1
{
MsgBox, The content of the clipboard does not have a valid format to be saved and the operation will be canceled.`n(The source of the text must be from the Internet or from formatted Word or PDF files opened with a browser.)
;CorpusCount++
;FileDelete,
Return
}
If ErrorType =2
{
MsgBox, 0x1024,, The clipboard image could not be saved. The clipboard exists, but it won't display an image `nContinue in every way?
IfMsgBox Yes
{
ErrorImg:=1
Return
}
ErrorImg:=0
Return
}
Return
/*
CheckProcess:
Corpus:= "HTMLTemp\Corpus" CorpusCount ".html"
Corpus:= "HTMLTemp\Image" CorpusCount ".jpg"
Corpus:= "HTMLTemp\name" CorpusCount ".txt"
Corpus:= "HTMLTemp\TextPlain" CorpusCount ".txt"
Corpus:= "HTMLTemp\URL" CorpusCount ".txt"
Corpus:= "HTMLTemp\Text" CorpusCount ".txt"
Return
*/
CopyGui:
CopyButton:=1
;GoSub, Toggle_Switch
Gosub, Menu2
Return
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
FileDelete, HTMLTemp\Corpus%DelClip%.html
FileDelete, HTMLTemp\image%DelClip%.jpg
FileDelete, HTMLTemp\Name%DelClip%.txt
FileDelete, HTMLTemp\Text%DelClip%.html
FileDelete, HTMLTemp\TextPlain%DelClip%.txt
FileDelete, HTMLTemp\URL%DelClip%.txt
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
;CorpusCount--
;Gosub, RButton
Iniciate:=0
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
}
Return
^F8::
Menu2:
;MouseGetPos, xpos1, ypos1
MouseGetPos, xposMen, yposMen
If CopyButton=1
{
xposMen := Floor(A_ScreenWidth/2)
yposMen := Floor(A_ScreenHeight/2-100)
}
Gui, CopyButtom:Show, x%xposMen% y%yposMen% W81 h84
Return
+RButton::
RButton:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
;Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
Gui1.Hwnd := hwnd
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x520 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x540 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w20 h20 hwndIcon10 gClipDelete vDeleteButton%A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon9 gTitleEditing vEditing%A_Index%
Gui, ContextClip: Add, Button, x40 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "Resources\clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "Resources\128.ico", 1, "s32")
GuiButtonIcon(Icon8, "Resources\ArrowSmall.ico", 1, "s32")
GuiButtonIcon(Icon10, "Resources\recycle 2.ico", 1, "s32")
GuiButtonIcon(Icon9, "Resources\pencil 1.ico", 1, "s24")
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
;Gui, ContextClip: -Caption +ToolWindow +0x400000 +hWndhMainWnd HwndHwnd ;Menu3s
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd
;Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
;WinSet, Transparent
Gui, ContextClip:+Owner
posyExitSess := posyExit+20
;LeeSession:= ScriptDir "\HTMLTemp\Session.txt"
LeeSession:= "HTMLTemp\Session.txt"
FileRead, SessClip, %LeeSession%
Gui, ContextClip: Add, Picture, x0 y%posyExit% W560 h32, Resources\Fondo_p.png
Gui, ContextClip: Add, Picture, x0 y%posyExit% W29 h32 gLabelSessionAct, Resources\IConChange.png
Gui, ContextClip: Add, Picture, x30 y%posyExit% W435 h32 GuiMove, Resources\Resto1.png
;***********************************************************************
Gui1.Button7 := {} ;Button 7
Gui1.Button7.DefaultImage := "Resources\Reducedcap.png"
,Gui1.Button7.HoverImage := "Resources\Close.png"
Gui1.Button7.PressedImage := "Resources\Reducedcap1.png"
;Gui1.Button7.Label := "ReducedM"
Gui, ContextClip: Add, Picture, x487 y%posyExit% W72 h32 gReducedM hwndhwnd, % Gui1.Button7.DefaultImage
Gui1.Handles[ hwnd ] := "Button7" ;The name of the control to point at.
Gui1.Button7.Hwnd := hwnd
;***********************************************************************
Gui1.Button6 := {} ;Button 6
Gui1.Button6.DefaultImage := "Resources\Close.png"
,Gui1.Button6.HoverImage := "Resources\Close.png"
Gui1.Button6.PressedImage := "Resources\Close1.png"
Gui1.Button6.Label := "ExitLabel"
Gui, ContextClip: Add, Picture, x457 y%posyExit% W30 h32 hwndhwnd, % Gui1.Button6.DefaultImage
Gui1.Handles[ hwnd ] := "Button6" ;The name of the control to point at.
Gui1.Button6.Hwnd := hwnd
;***********************************************************************
Gui, ContextClip: Font, S9 Bold, Verdana
posyExitSess1 := posyExit+08
Gui, ContextClip: Add, Text, cYellow BackgroundTrans +Center x2 y%posyExitSess1% vTextTitle W536 h20, %SessClip%
MouseGetPos, xpos1, ypos1
If threeRButton=1
{
xpos1 := Floor((A_ScreenWidth/2)-450)
ypos1 := Floor((A_ScreenHeight/2)-200)
}
If ControlTwo=1
{
xpos1 := XActTwo-140
ypos1 := yActTwo-13
}
;xpos1 := xpos1-560
;ypos1 := ypos1-alto
AltoSess := Alto+12
Gui, ContextClip: Show, x%xpos1% y%ypos1% w560 h%AltoSess% ;Menu3s
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
OnMessage( 0x201 , "ButtonPress" )
Gosub, NewWindow
return
RButtonAlt:
threeRButton :=1
Gosub, RButton
Return
TitleEditing:
Gosub, NewWindow
StringTrimLeft, REdit, a_guicontrol, 7
FileChange := "HTMLTemp\Name" REdit ".txt"
FileRead, FileCont, %FileChange%
Gui, Edit: Font, S8 Bold, Verdana
Gui, Edit: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Edit:+Owner
Gui, Edit:Add, Edit, x8 y9 w546 h20 vMyEdit, %FileCont%
;Gui, Edit: Add, Edit, x12 y9 w460 h20 vMyEdit%REdit%, %FileCont%
Gui, Edit:Add, Button, x8 y37 w70 h20 gTitleSave, OK
Gui, Edit:Add, Button, x100 y37 w70 h20 gTitleCancel, Cancel
Gui, Edit:Add, CheckBox, x240 y37 w210 h20 Checked1 vVeryfyChange, Change also the Title to Paste
EdXm := pXm-846
EdYm := pYm-96
Gui, Edit:Show, x%EdXm% y%EdYm% h63 w564
Return
TitleSave:
Gui, Edit: Submit, Destroy
fileAdd := FileOpen(FileChange, "w")
fileAdd.Write(MyEdit)
fileAdd.Close()
If VeryfyChange=1
{
ReadURL := "HTMLTemp\URL" REdit ".txt"
Fileread URLTxt, %ReadURL%
ReadText:= "HTMLTemp\Text" REdit ".html"
FileDelete, %ReadText%
myResultSave := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" URLTxt ">" MyEdit "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResultSave%, %ReadText%
}
MyEdit :=""
FileCont :=""
FileChange :=""
Gosub, RButton
Return
TitleCancel:
Gui, Edit: Destroy
MyEdit :=""
FileCont :=""
FileChange :=""
;Gosub, NewWindow
Gosub, RButton
Return
ReducedM:
WinGetPos, XActOne, YActOne,,, A
Gui, ContextClip: Destroy
SoundPlay, Resources\Close Window.mp3
ControlOne :=1
ControlTwo :=0
Gosub, NotifyTrayClick_207
Return
NotifyTrayClick_207:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip1: Add, Button, x0 y%posy% w460 h20 gButtonTwo vTwoButton%A_Index%, %A_LoopReadLine%
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip1: Margin, 2, 2
Gui, ContextClip1: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd ;Menu31s
Gui, ContextClip1: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip1:+Owner
Gui, ContextClip1: Add, Button, x20 y%posyExit% w380 h20 gExitLabel, Exit Menu
Gui, ContextClip1: Add, Button, x400 y%posyExit% w60 h20 hwndIcon20 gExtendedM
Gui, ContextClip1: Add, Text, x0 y%posyExit% w20 h20 GuiMove
Gui, ContextClip1: Add, Button, x0 y%posyExit% w20 h20 hwndIcon21
AltoT := Floor((CorpusCount+1)*31.5)
XPos:= A_ScreenWidth-(700)
YPos:= A_ScreenHeight-AltoT-60
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
ExtendedM:
WinGetPos, XActTwo, YActTwo,,, A
Gui, ContextClip1: Destroy
SoundPlay, Resources\Close Window.mp3
ControlOne :=0
ControlTwo :=1
Gosub, RButton
Return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: New
Gui, Help: -Caption
Gui, Help: +Owner
Gui, Help: Color, EEAA99
Gui, Help: Margin, 0, 0
Gui, Help: Add, Picture, x0 y0 w640 h250, Resources\Help.jpg
Gui, Help: Add, Button, x495 y209 w100 h30 gNextButton, More...
Gui, Help: Show, w640 h250
Return
NextButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: Destroy
Gui, Help2: New
Gui, Help2: -Caption
Gui, Help2: +Owner
Gui, Help2: Color, EEAA99
Gui, Help2: Margin, 0, 0
Gui, Help2: Add, Picture, x0 y0 w800 h397, Resources\Clipboard Utility Screenshot.jpg
Gui, Help2: Add, Button, x10 y340 w100 h30 gExitButton, Exit
Gui, Help2: Show, w800 h397
Return
ExitButton:
Gui, Help2: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Resources\Close Window.mp3
CopyButton=0
UtilButton :=0
Gui, Hide
Gui, CopyButtom:Hide
Return
;*************************************************************************
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace(status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
Gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
status_button_old:=status_button
return
;*************************************************************************
Deletealert:
if (status_delete=status_delete_old)
return
Gui, 4:default
Gui, destroy
NumberDelete:= RegExReplace(status_delete,"\D")
if !NumberDelete
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Delete Clipboard Number %NumberDelete%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 4:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 4:margin, 0, 0
Gui, 4:add, ActiveX, vWB w64 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
DelXm := pXm-944
GuiControl, Move, WB, h%maxBottom%
Gui, 4: Show, x%DelXm% y%pYm% w64 h60
status_delete_old:=status_delete
Return
;*************************************************************************
Copyalert:
if (status_Copy=status_Copy_old)
return
Gui, 6:default
Gui, destroy
NumberCopy:= RegExReplace(status_Copy,"\D")
if !NumberCopy
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Copy Item %NumberCopy% as Current Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 6:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 6:margin, 0, 0
Gui, 6:add, ActiveX, vWB w60 h72, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 6: Show, x%pXm% y%pYm% w60 h72
status_Copy_old:=status_Copy
Return
;*************************************************************************
URLalert:
if (status_URL=status_URL_old)
return
Gui, 5:default
Gui, destroy
NumberURL:= RegExReplace(status_URL,"\D")
URL_file := "HTMLTemp\URL" NumberURL ".txt"
if !URL_file
return
;Gui,2:Destroy
;URL_file := "HTMLTemp\URL" NumberURL ".txt"
FileRead, URLContents, %URL_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Go to: %URLContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 5:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 5:margin, 0, 0
Gui, 5:add, ActiveX, vWB w562 h30, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
DelXm := pXm-845
;DelXm := pXm-819
DelYm := pYm-47
;Gui, 5: Show, x%DelXm% y%DelYm% w543 h30
Gui, 5: Show, x%DelXm% y%DelYm% w562 h30
status_URL_old:=status_URL
Return
;*************************************************************************
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace(status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Gui,5:Destroy
FileRead, FileContents, %Text_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 3:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 3:margin, 0, 0
Gui, 3:add, ActiveX, vWB w320 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
;*************************************************************************
Editingalert:
if (status_Editing=status_Editing_old)
return
Gui, 6:default
Gui, destroy
EditingNumber:= RegExReplace(status_Editing,"\D")
if !EditingNumber
return
Gui,2:Destroy
Gui,5:Destroy
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Edit Title of the %EditingNumber%th Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 7: +AlwaysOnTop -Caption +ToolWindow Border
;Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui, 7:margin, 0, 0
gui, 7:add, ActiveX, vWB w62 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
;DelXm := pXm-953
GuiControl, Move, WB, h%maxBottom%
gui, 7: Show, x%pXm% y%pYm% w62 h60
status_Editing_old:=status_Editing
Return
;*************************************************************************
^F6::
ControlPaste:
MsgBox, 0x1034,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Hide
;Gui, Destroy
;Gui, -MinimizeBox
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Resources\Close Window.mp3
Return
^F10::
DeleteAll:
MsgBox, 0x1034,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
SavePDF:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, -MinimizeBox
Sleep, 1000
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, Resources\PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
FormatTime, CurrentDate,, dd-MM-yyyy
Filedate := "Documents\Final_Document_" CurrentDate ".pdf"
Filedateh := "Documents\oPDF_" CurrentDate ".html"
FileMove, Final_Document.pdf, %Filedate%
Run, %Filedate%
FileMove, ToPDF.html, %Filedateh%
;FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Return
^F11::
;^!z::
DeleteLast:
MsgBox, 0x1034,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
;FileDelete, HTMLTemp\*%CorpusCount%.*
FileDelete, HTMLTemp\Corpus%CorpusCount%.html
FileDelete, HTMLTemp\image%CorpusCount%.jpg
FileDelete, HTMLTemp\Name%CorpusCount%.txt
FileDelete, HTMLTemp\Text%CorpusCount%.html
FileDelete, HTMLTemp\TextPlain%CorpusCount%.txt
FileDelete, HTMLTemp\URL%CorpusCount%.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
;CorpusCount--
Return
^Esc::
Exit:
ExitApp
Return
Borrado:
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, LabelSessionAct
CorpusCount :=0
Gosub, ReloadSession
;Gosub, ReloadMenu
Return
ButtonTwo:
StringTrimLeft, NumberFile, a_guicontrol, 9
;Gui, 2: Destroy
;Gui, ContextClip: Destroy
Gosub, ButtonLabel
Return
LabelSession:
;NumberFile:=A_ThisMenuItemPos
;Menu, tray, ToggleCheck, &Suspend Hotkeys
;Menu, tray, ToggleCheck, Clipboard Sessions
MsgBox, 0x1024,, You want the session %A_ThisMenuItem% to be the default session?
IfMsgBox No
Return
;Loop, %DirectoryCount%
/*
if !FileExist("HTMLTemp" A_Index)
{
;NumberDir : %A_Index%
MoveDir := "HTMLTemp" A_Index
}
MsgBox, %MoveDir%
*/
FileDelete, SessionTemp*.txt
FileDelete, SessionTemp00.txt
FileDelete, SessionTemp01.txt
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
NumSess := A_Index-1
NumberPos:= A_ThisMenuItemPos-3
;MsgBox, %NumberPos%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp"
FileAppend, %FileSession%, SessionTemp.txt
FileAppend, %A_ScriptDir%, SessionTemp00.txt
FileSession2 := "\HTMLTemp00"
FileAppend, %FileSession2%, SessionTemp00.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;FileMove %DirectorySess%, %DirectorySess00%
FileMoveDir %DirectorySess%, %DirectorySess00%, R
;DirectorySess :=""
;DirectorySess00 :=""
FileAppend, %A_ScriptDir%, SessionTemp01.txt
FileSession3 := "\HTMLTemp" NumberPos
FileAppend, %FileSession3%, SessionTemp01.txt
FileRead, DirectorySess01, SessionTemp01.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;MsgBox, %DirectorySess01%`n%DirectorySess%
FileMoveDir %DirectorySess01%, %DirectorySess%, R
FileMoveDir %DirectorySess00%, %DirectorySess01%, R
Menu, SessionID, DeleteAll
Menu, ClipboardID, DeleteAll
Iniciate:=0
Gosub, ReloadSession
Return
/*
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
*/
ButtonLabelTray:
If CorpusCount=0
Return
NumberFile:=A_ThisMenuItemPos
Gosub, ButtonLabel
Return
ButtonLabel:
;NumberFile:= RegExReplace(NameTwo,"\D")
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
SoundPlay, Resources\Close Window.mp3
Gui, ContextClip1: Destroy
Gui, ContextClip: Destroy
;Gui, Destroy
Gui,2: Destroy
Gui, Gui1: Destroy
;Gui, 2:default
;Gui, destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
ControlOne :=0
ControlTwo :=0
threeRButton :=0
Alto:=0
Return
TxtLabel:
SoundPlay, Resources\Clipboard_Sound.mp3
StringTrimLeft, TextCopy, a_guicontrol, 5
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
Return
TxtPlane:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
global status_Delete ,tme
global status_URL ,tme
global status_Copy ,tme
global status_Editing ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
status_Delete:=""
status_URL:=""
status_Copy:=""
status_Editing:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
if instr(a_guicontrol,"Delete")
{
status_Delete:=a_guicontrol
SetTimer, Deletealert,-20
}
if instr(a_guicontrol,"URL")
{
status_URL:=a_guicontrol
SetTimer, URLalert,-20
}
if instr(a_guicontrol,"Copy")
{
status_Copy:=a_guicontrol
SetTimer, Copyalert,-20
}
if instr(a_guicontrol,"Editing")
{
status_Editing:=a_guicontrol
SetTimer, Editingalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
status_Delete_old:=""
status_URL_old:=""
status_Copy_old:=""
status_Editing_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
URLButton:
SoundPlay, Resources\Close Window.mp3
MsgBox, 0x1024,, Extract URL's from Clipboards?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
}
}
Gosub, ExtractURL
FileDelete, ToPDF.html
Return
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
Return True
}
;************************************************************************************************************************
ExtractURL:
;Create header html document
FileAppend,
(
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=AutoHotkey.File>
<meta name=Generator content="AutoHotkey">
</head>
<body lang=es style='font-family:Calibri;font-size:11.0pt'>
), Extracted_Links.html
FormatTime, CurrentDate,, dd-MM-yyyy
DateIncl := "<p style='margin:0in'><span style='font-family:Times New Roman;font-size:11.0pt;color:#1E4D78'>Clipboard Session URLs: </span><span style='font-weight:bold;font-family:Calibri;font-size:12.0pt;color:#860000'>" CurrentDate "</span></p>"
FileAppend, %DateIncl%, Extracted_Links.html
;Add Line
myResult := "<p style='margin:0in;font-family:Calibri;font-size:11.0pt;color:#78230C'><p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>`r
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>`r"
FileAppend, %myResult%, Extracted_Links.html
;Routine loop, origin: https://www.autohotkey.com/docs/commands/LoopReadFile.htm
LinkCount := 0
ImgCount := 0
Loop, read, ToPDF.html, Extracted_Links.html
{
URLSearchString := A_LoopReadLine
Gosub, URLSearch
}
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links.html
Loop, read, Extracted_Links.html
{
If A_Index < 11
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
if A_Index > 11
if RegExMatch(A_LoopReadLine, "\.(jpg<|jpeg<|png<|gif<|svg<)")
{
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
ImgCount++ ; increment by one
}
else If InStr(A_LoopReadLine, "</ul>", True) and A_Index > 17
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links_Img.html
}
;URL number message, Optional
MsgBox %LinkCount% links were found and written to "Extracted_Links.html" `n %ImgCount% Images were found and written to "Extracted_Links_Img.html"
;Opcional, opens the result
FormatTime, CurrentDate,, dd-MM-yyyy
FileURL := "Documents\Extracted_Links_" CurrentDate ".html"
FileURLImg := "Documents\Extracted_Links_Img_" CurrentDate ".html"
FileMove, Extracted_Links.html, %FileURL%
FileMove, Extracted_Links_Img.html, %FileURLImg%
FileDelete, ToPDF.html
Run, %FileURL%
Run, %FileURLImg%
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
URLStart1 := InStr(URLSearchString, "https://")
URLStart2 := InStr(URLSearchString, "http://")
URLStart3 := InStr(URLSearchString, "ftp://")
URLStart4 := InStr(URLSearchString, "www.")
; Find the left-most starting position:
URLStart := URLStart1 ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
ArrayElement := URLStart%A_Index%
if (ArrayElement = "") ; End of the pseudo-array has been reached.
break
if (ArrayElement = 0) ; This element is disqualified.
continue
if (URLStart = 0)
URLStart := ArrayElement
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if (ArrayElement != 0)
if (ArrayElement < URLStart)
URLStart := ArrayElement
}
}
if (URLStart = 0) ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
URL := SubStr(URLSearchString, URLStart) ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%<> ; Find the first space, tab, or angle (if any).
{
URL := A_LoopField
break ; i.e. perform only one loop iteration to fetch the first "field".
}
StringReplace, URLCleansed, URL, ",, All
; Makes a second check to replace extraneous signs.
FixString := % URLCleansed
vList := "
(
%21 !
%23 #
%24 $
%26 &
%27 '
%28 (
%29 )
%2A *
%2B +
%2C ,
%3B ;
%2F /
%3A :
%3D =
%3F ?
%40 @
%5B [
%5D ]
%20
%C2%B4 ´
%2E .
%25 %
%2D -
%3C <
%3E >
%5C \
%5E ^
%5F _
%60 `
%7B {
%7C |
%7D }
%7E ~
%22 ""
\/ \
)"
Loop, Parse, vList, `n
{
oTemp := StrSplit(A_LoopField, "`t")
FixString := StrReplace(FixString, oTemp.1, oTemp.2)
}
oTemp := ""
ClipBoard := "<li style='margin-top:0;margin-bottom:0;vertical-align:middle'><p style='margin:0in;font-family:Calibri;font-size:10.0pt'><a href=" FixString ">" FixString "</a></p></li>"
FileAppend, %ClipBoard%`n
LinkCount += 1
; See if there are any other URLs in this line:
CharactersToOmit := StrLen(URL)
CharactersToOmit += URLStart
URLSearchString := SubStr(URLSearchString, CharactersToOmit)
Gosub, URLSearch ; Recursive call to self.
return
;**********************************************************************************************
^F1::
CaseMenu:
Menu Case, Add
Menu Case, DeleteAll
Menu Case, Add, &UPPERCASE, CCase
Menu Case, Add, &lowercase, CCase
Menu Case, Add, &Title Case, CCase
Menu Case, Add, &a Title to Case, CCase
Menu Case, Add, &Sentence case, CCase
Menu Case, Add
Menu Case, Add, &Remove Spaces, CCase
GetText(Txt)
If NOT ERRORLEVEL
Menu Case, Show
Return
CCase:
p:=A_ThisMenuItemPos
If (p=1)
StringUpper, Txt, Txt
Else If (p=2)
StringLower, Txt, Txt
Else If (p=3)
StringLower, Txt, Txt, T
Else If (p=4)
{
StringLower, Txt, Txt
;IMPORTANT! Change short words to be replaced in the following list according to each language or add more
lowers := ["a", "ha", "el", "y", "pero", "o", "para", "las", "es", "para", "por", "los", "con", "en", "que", "un", "de", "del", "la", "una", "cada", "en", "al", "por", "uno", "mi", "tu", "tú", "no", "ni", "sin", "se", "lo", "e", "su", "sí", "ser", "hay"]
for k, v in lowers
low .= (k = 1 ? "" : "|") . v
;Txt := RegExReplace(Txt, "(*UCP)(^\b|\b(?!(" . low . ")\b))\w+\b|\b\w+\b$", "$T0")
;Txt := RegExReplace(Txt, "((?:^|[.!?-]\s+)[a-z])", "$u1")
Txt := RegExReplace(Txt, "(*UCP)(^|\b(?!(" . low . ")\b))\w|(\.|\?|!)\s*\K\w|-\K\w", "$T0")
}
Else If (p=5)
{
StringLower, Txt, Txt
Txt := RegExReplace(Txt, "((?:^|[.!?]\s+)[a-z])", "$u1")
}
Else If (p=7)
{
Loop
{
StringReplace, Txt, Txt, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0
break
}
}
PutText(Txt)
Return
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^{vk43} ;Ctrl C
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard =
Sleep 20
Clipboard := MyText
Send ^{vk56} ;Ctrl V
Sleep 100
Clipboard := SavedClip
Return
}
;*******************************************************************************
Nothing:
Run, https://www.autohotkey.com/boards/viewtopic.php?t=92963
Return
Tray_Open:
ListLines
return
^!F4::
NewSession:
Gui, Session: Font, S8 Bold, Verdana
Gui, Session: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Session:+Owner
Gui, Session: Add, Edit, y8 vSessEdit h20 w544, New Session
Gui Session:Add, Button, x20 y37 w70 h20 gSessionSave, OK
Gui Session:Add, Button, x120 y37 w70 h20 gSessCancel, Cancel
xSess := Floor((A_ScreenWidth/2)-450)
ySess := Floor((A_ScreenHeight/2)-200)
Gui, Session: Show, x%xSess% y%ySess%
Return
SessionSave:
FileDelete, SessionTemp.txt
Gui, Session: Submit
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal1 := A_Index
FileCreateDir, HTMLTemp%SessionTotal1%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp" SessionTotal1 "\Session.txt"
FileAppend, %FileSession%, SessionTemp.txt
;Sleep, 3500
FileRead, Directory, SessionTemp.txt
FileAppend, %SessEdit%, %Directory%
Menu, SessionID, DeleteAll
Iniciate:=1
Gosub, ReloadSession
Return
SessCancel:
Gui, Session:Destroy
Gui, RenSession:Destroy
Return
/*
LabelSessionAct1:
Position :=1
Return
*/
LabelSessionAct:
ReadSess := "HTMLTemp\Session.txt"
FileRead, RenSession, %ReadSess%
Gui, RenSession: Font, S8 Bold, Verdana
Gui, RenSession: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, RenSession:+Owner
Gui, RenSession: Add, Edit, y8 vReSessEdit h20 w544, %RenSession%
Gui RenSession:Add, Button, x20 y37 w70 h20 gRenSessionSave, OK
Gui RenSession:Add, Button, x120 y37 w70 h20 gSessCancel, Cancel
xSess := Floor((A_ScreenWidth/2)-450)
ySess := Floor((A_ScreenHeight/2)-200)
Gui, RenSession: Show, x%xSess% y%ySess%
/*
NumberSessTemp := "HTMLTemp\Session.txt"
FileRead, Session1, %NumberSessTemp%
xSplash := A_ScreenWidth-506
ySplash := A_ScreenHeight-140
SplashTextOn, 500, 40, Name of the Current Session, %Session1%
WinMove, Name of the Current Session,, xSplash, ySplash
Sleep, 2500
SplashTextOff
*/
Return
RenSessionSave:
Gui, RenSession: Submit
FileDelete, HTMLTemp\Session.txt
FileAppend, %ReSessEdit%, HTMLTemp\Session.txt
Gosub, RButton
Return
/*
Paused:
Paused:=!Paused
IfEqual,Paused,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Orange.ico
IfEqual,Paused,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Pause Script
Menu,Tray,Icon,,,1
Pause,Toggle,1
Return
*/
^F12::
Stanby:
Suspend:=!Suspend
IfEqual,Suspend,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Red.ico
IfEqual,Suspend,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Suspend Hotkeys
Menu,Tray,Icon,,,1
Suspend,Toggle
Return
EditScript:
Run Edit %A_ScriptName%
Return
^F7::
Reloaded:
Reload
Return
/*
^!F3::
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
^!F3::
Loop, read, SesionName.txt
{
Menu, MyMenu, add,%A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
;Menu, MyMenu, add, Clipboard, ButtonLabelTray
;Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
Menu, MyMenu, Color, FFFFFF
Menu, MyMenu, show
;}
Return
*/
^!F3::
;Loop, Parse, MyListBox, |
;Loop, read, SesionName.txt
;{
Gui, -Caption
Gui, Color, ffffd6
;Gui, Font, S12 Bold, Verdana
Gui, Font, s9, Segoe UI
Gui, Add, ListBox, vsesion w470 h225
;Gui, Add, ListBox, r5, Red|Green|Blue|Black|White
;Gui, MiListBox:Add, ListBox, r5 vColorChoice, %A_LoopReadLine%
;MsgBox Selection number %A_Index% is %A_LoopField%.
;}
Loop, read, SesionName.txt
{
GuiControl,, sesion, %A_LoopReadLine%
}
Gui, Show
/*
;To cancel, press ESCAPE or close this window.
Gui, Add, ListBox, vListBox_pdf x16 y10 w370 h125,
Gui, Add, ListBox, vListBox_ini x16 y145 w370 h125,
Gui, Add, Button, Default, OK
;----------------------------- Start Fill Listboxs
Loop, C:\temp\*.pdf
{
GuiControl,, ListBox_pdf, %A_LoopFileFullPath%
}
Loop, C:\*.ini
{
GuiControl,, ListBox_ini, %A_LoopFileFullPath%
}
Gui, Show
*/
NotifyTrayClick_201:
;xSplash := Floor((A_ScreenWidth/2)-450)
;ySplash := Floor((A_ScreenHeight/2)-200)
xSplash := A_ScreenWidth-506
ySplash := A_ScreenHeight-180
SplashTextOn, 500, 80, Content of the current clipboard, %Clipboard%
WinMove, Content of the current clipboard,, xSplash, ySplash
;SplashTextOn,,, Displays only a title bar.
Sleep, 1000
SplashTextOff
;SplashTextOn,,, %Clipboard%
;WinMove,,, xSplash, ySplash
;Sleep, 1000
;SplashTextOff
Return
Code: Select all
;https://www.autohotkey.com/boards/viewtopic.php?f=76&t=92963
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
;EnvSet, SD, %A_ScriptDir%
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
#Include Library\ViewHtml.ahk
;#Include Library\ToolTipEx.ahk
#SingleInstance, Force
#InstallMousehook
;#Persistent
SetBatchLines, -1
Name := "Clipboard Utility - "
Version := "4.1n"
CoordMode, Mouse, Screen
CoordMode, Mouse, Screen
CorpusCount := 0
DirectoryCount := 0
Iniciate := 0
PDFCount := 0
;Hotkey, LButton Up, off
;loop, HTMLTemp\Corpus*.html
;CorpusCount := % Floor(A_Index)
Menu, Tray, Icon, Resources\Scissors_Green.ico
Menu, Tray, NoStandard
Menu, tray, Add, %name% %version%, Nothing
Menu, tray, Icon, %name% %version%, Resources\Clipboard Utility.ico
Menu, Tray, Add
Menu, tray, Add, Exit , Exit
Menu, tray, Icon, Exit , shell32.dll, 132
Menu, Tray, Add
Menu, tray, Add, &Suspend Hotkeys , Stanby
Menu, tray, Icon,&Suspend Hotkeys , %A_ScriptDir%\Resources\Scissors_Red.ico
Menu, Tray, Add
Menu, Tray, Add, Help, HelpButton
Menu, Tray, Icon, Help, %A_ScriptDir%\Resources\Help.ico
Menu, Tray, Add
Menu Tray, Add, Open Info, Tray_Open
Menu Tray, Icon, Open Info, %A_ScriptDir%\Resources\Info.ico
Menu, tray, Add, &Reload this script , Reloaded
Menu, tray, Icon,&Reload this script , %A_ScriptDir%\Resources\2488.ico
Menu, tray, Add, &Edit this script , EditScript
Menu, tray, Icon,&Edit this script , comres.dll, 7
Menu, tray, Add,
Menu, winmanagetID, Add, Clipboard Window Extended, RButtonAlt
Menu, winmanagetID, icon, Clipboard Window Extended, %A_ScriptDir%\Resources\162.ico
Menu, winmanagetID, Add, Clipboard Window Reduced, ReducedAlt
Menu, winmanagetID, icon, Clipboard Window Reduced, %A_ScriptDir%\Resources\Clipboard Utility.ico
Menu, winmanagetID, Add, Utility Window, WUtil
Menu, winmanagetID, icon, Utility Window, %A_ScriptDir%\Resources\75a.ico
Menu, winmanagetID, Add, Copy Clipboard Window, CopyGui
Menu, winmanagetID, icon, Copy Clipboard Window, Resources\Clipboard Utility 5.ico
Menu, Tray, add, Window Management, :winmanagetID
Menu, tray, Icon, Window Management, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add, Save all Clipboard to PDF File, SavePDF
Menu, Tray, Icon, Save all Clipboard to PDF File, %A_ScriptDir%\Resources\PDF.ico
Menu, Tray, Add, Extract URL's from clipboard, URLButton
Menu, Tray, Icon, Extract URL's from clipboard, %A_ScriptDir%\Resources\URL.ico
Menu, DeleteID, Add, Delete Last Clipboard, DeleteLast
Menu, DeleteID, Add, Delete All Clipboard, DeleteAll
Menu, Tray, add, Delete Options, :DeleteID
Menu, tray, Icon, Delete Options, %A_ScriptDir%\Resources\Recycle 3.ico
Menu, Tray, Add
;**********************************************************************************************
ReloadSession:
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal := A_Index-1
FileDelete, SessionNumber.txt
;If !CorpusCount=0
;{
NumberSessTemp := "HTMLTemp\Session.txt"
FileRead, Session1, %NumberSessTemp%
; Fileappend, %Session1% `n, SessionNumber.txt
;Menu, SessionID, add, %Session1%, LabelSessionAct
;Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2293.ico
;Menu, SessionID, add
Menu, SessionID, add, Create New Session, NewSession
Menu, SessionID, Icon, Create New Session, %A_ScriptDir%\Resources\178.ico
Menu, SessionID, add
Menu, SessionID, add, 0: %Session1%, LabelSessionAct
Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2478.ico
;Menu, SessionID, add, Current Session, LabelSessionAct
;Menu, SessionID, Icon, Current Session, %A_ScriptDir%\Resources\2478.ico
;************************************************************************
loop, %SessionTotal%
{
FileDelete, SessionCount.txt
FileAppend, %A_ScriptDir%, SessionCount.txt
FullFile:="\HTMLTemp" A_Index "\*.*"
FileAppend, %FullFile%, SessionCount.txt
FileRead, CountFiles, SessionCount.txt
;MsgBox, %CountFiles%
loop, %CountFiles%
FilesCount := % Floor(A_Index/6)
NameTemp := "HTMLTemp" A_Index "\Session.txt"
FileRead, Session1, %NameTemp%
Fileappend, %Session1% |·| %FilesCount% Clipboards`n, SessionNumber.txt
;MsgBox, %FilesCount%
}
Loop, read, SessionNumber.txt
{
Menu, SessionID, add, %A_Index%: %A_LoopReadLine%, LabelSession
}
Menu, Tray, add, Clipboard Sessions, :SessionID
Menu, Tray, Icon, Clipboard Sessions, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add
;**********************************************************************
ReloadMenu:
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
Menu, ClipboardID, add, %A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
Menu, Tray, add, Clipboard, :ClipboardID
Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
}
Menu, Tray, Default, Window Management
;Menu, Tray, Default, Clipboard Sessions
;Menu, Tray, Tip, Clipboard Utility 4.1f
Menu, Tray, Tip, This Session has 0%CorpusCount% Clipboards
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:+Owner
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, Resources\PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, Resources\PauseOff.png
GuiButtonIcon(Icon, "Resources\Clipboard Utility 5.ico", 1, "s90")
GoSub, Toggle_Switch
;CorpusCount := 0
/*
if FileExist("HTMLTemp\Text1.html")
MsgBox, 0x1034,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
*/
if !FileExist(HTMLTemp)
{
FileCreateDir, HTMLTemp
}
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
DirectoryCount := A_Index-1
;MsgBox, %DirectoryCount%
Filedelete, WorkingDir.txt
FileAppend, %A_ScriptDir%\, WorkingDir.txt
FileRead, ScriptDir, Workingdir.txt
threeRButton=1
If !Iniciate=1
Gosub, RButton
Return
^F4::
GuiUtily:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd
Gui, -Caption HwndHwnd
Gui, +Owner
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Add, Picture, x0 y0 w600 h167, Resources\Clipboard Utility_p.png
;Gui, Add, Text, x0 y0 w552 h35 GuiMove ; , `&& Drag
Gui, Add, Picture, x0 y0 w552 h35 GuiMove, Resources\ArribaIzq.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "Resources\PDFup.png"
Gui1.Button1.HoverImage := "Resources\PDFhover.png"
Gui1.Button1.PressedImage := "Resources\PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Add, Picture, x16 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "Resources\PasteUp.png"
Gui1.Button2.HoverImage := "Resources\PasteHover.png"
Gui1.Button2.PressedImage := "Resources\PasteDown.png"
Gui1.Button2.Label := "ControlPaste"
Gui, Add, Picture, x158 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "Resources\ExitUp.png"
Gui1.Button3.HoverImage := "Resources\ExitHover.png"
Gui1.Button3.PressedImage := "Resources\ExitDown.png"
;Gui1.Button3.Label := "ExitLabel"
Gui1.Button3.Label := "GuiClose"
Gui, Add, Picture, x553 y0 w48 h35 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "Resources\HelpUp.png"
Gui1.Button4.HoverImage := "Resources\HelpHover.png"
Gui1.Button4.PressedImage := "Resources\HelpDown.png"
Gui1.Button4.Label := "HelpButton"
Gui, Add, Picture, x444 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 5
;************************************************************************************************************************
Gui1.Button5 := {} ;Button 5
Gui1.Button5.DefaultImage := "Resources\UrlUp.png"
Gui1.Button5.HoverImage := "Resources\UrlHover.png"
Gui1.Button5.PressedImage := "Resources\UrlDown.png"
Gui1.Button5.Label := "URLButton"
Gui, Add, Picture, x300 y36 w141 h115 hwndhwnd, % Gui1.Button5.DefaultImage
Gui1.Handles[ hwnd ] := "Button5" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
/*
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
*/
MouseGetPos, xposUtil, yposUtil
If UtilButton=1
{
xposUtil := Floor((A_ScreenWidth/2)-450)
yposUtil := Floor((A_ScreenHeight/2)-200)
}
Gui, Show, x%xposUtil% y%yposUtil% W600 h167, Hover
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
WUtil:
UtilButton:=1
Gosub, GuiUtily
Return
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, Resources\ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
;Data:=clip_GetHtmlString()
accData:= GetAccData()
;******************************************************************************************************************
If not ClipboardGet_HTML( Data )
{
ErrorType :=1
Gosub, ControlError
;MsgBox, The content of the clipboard does not have a valid format to be saved and the operation will be canceled.
Return
}
Else
CorpusCount++
;******************************************************************************************************************
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
;******************************************************************************************************************
FileGetSize, SizeFile, %FileaccData%
If !FileaccData or SizeFile=3
{
ErrorType :=0
Gosub, ControlError
If ErrorTex=0
Return
}
;******************************************************************************************************************
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
;******************************************************************************************************************
FileGetSize, SizeFile1, %FileTex%
If !FileTex or SizeFile1=3
{
ErrorType :=0
Gosub, ControlError
If ErrorTex=0
Return
}
;******************************************************************************************************************
;ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html ;, CP65001
;******************************************************************************************************************
FileGetSize, SizeFile2, Temp.html
;MsgBox, %SizeFile2%
FileHTML := "Temp.html"
If !FileHTML or SizeFile2=3
{
ErrorType :=1
Gosub, ControlError
;If ErrorTex=0
Return
}
;******************************************************************************************************************
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%`n, TempPDF.html
}
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
;ImageCount := ScriptDir "HTMLTemp\Image" CorpusCount ".jpg"
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
;******************************************************************************************************************
If !ImageCount
{
ErrorType :=2
Gosub, ControlError
If ErrorImg=0
{
FileCopy Resources\No Image File.jpg, %ImageCount%
Return
}
}
;******************************************************************************************************************
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
FileDelete, Image_Temp.jpg
;Gosub, CheckProcess
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Iniciate:=1
Data :=""
Gosub, ReloadMenu
Return
ControlError:
If ErrorType =0
{
MsgBox, 0x1024,, You have not been able to save the name of the clipboard source, you will be able to name it later. `nContinue in every way?
IfMsgBox Yes
{
ErrorTex:=1
Return
}
ErrorText:=0
Return
}
If ErrorType =1
{
MsgBox, The content of the clipboard does not have a valid format to be saved and the operation will be canceled.`n(The source of the text must be from the Internet or from formatted Word or PDF files opened with a browser.)
;CorpusCount++
;FileDelete,
Return
}
If ErrorType =2
{
MsgBox, 0x1024,, The clipboard image could not be saved. The clipboard exists, but it won't display an image `nContinue in every way?
IfMsgBox Yes
{
ErrorImg:=1
Return
}
ErrorImg:=0
Return
}
Return
/*
CheckProcess:
Corpus:= "HTMLTemp\Corpus" CorpusCount ".html"
Corpus:= "HTMLTemp\Image" CorpusCount ".jpg"
Corpus:= "HTMLTemp\name" CorpusCount ".txt"
Corpus:= "HTMLTemp\TextPlain" CorpusCount ".txt"
Corpus:= "HTMLTemp\URL" CorpusCount ".txt"
Corpus:= "HTMLTemp\Text" CorpusCount ".txt"
Return
*/
CopyGui:
CopyButton:=1
;GoSub, Toggle_Switch
Gosub, Menu2
Return
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
FileDelete, HTMLTemp\Corpus%DelClip%.html
FileDelete, HTMLTemp\image%DelClip%.jpg
FileDelete, HTMLTemp\Name%DelClip%.txt
FileDelete, HTMLTemp\Text%DelClip%.html
FileDelete, HTMLTemp\TextPlain%DelClip%.txt
FileDelete, HTMLTemp\URL%DelClip%.txt
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
;CorpusCount--
;Gosub, RButton
Iniciate:=0
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
}
Return
^F8::
Menu2:
;MouseGetPos, xpos1, ypos1
MouseGetPos, xposMen, yposMen
If CopyButton=1
{
xposMen := Floor(A_ScreenWidth/2)
yposMen := Floor(A_ScreenHeight/2-100)
}
Gui, CopyButtom:Show, x%xposMen% y%yposMen% W81 h84
Return
+RButton::
RButton:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
;Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
Gui1.Hwnd := hwnd
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x520 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x540 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w20 h20 hwndIcon10 gClipDelete vDeleteButton%A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon9 gTitleEditing vEditing%A_Index%
Gui, ContextClip: Add, Button, x40 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "Resources\clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "Resources\128.ico", 1, "s32")
GuiButtonIcon(Icon8, "Resources\ArrowSmall.ico", 1, "s32")
GuiButtonIcon(Icon10, "Resources\recycle 2.ico", 1, "s32")
GuiButtonIcon(Icon9, "Resources\pencil 1.ico", 1, "s24")
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
;Gui, ContextClip: -Caption +ToolWindow +0x400000 +hWndhMainWnd HwndHwnd ;Menu3s
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd
;Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
;WinSet, Transparent
Gui, ContextClip:+Owner
posyExitSess := posyExit+20
;LeeSession:= ScriptDir "\HTMLTemp\Session.txt"
LeeSession:= "HTMLTemp\Session.txt"
FileRead, SessClip, %LeeSession%
Gui, ContextClip: Add, Picture, x0 y%posyExit% W560 h32, Resources\Fondo_p.png
Gui, ContextClip: Add, Picture, x0 y%posyExit% W29 h32 gLabelSessionAct, Resources\IConChange.png
Gui, ContextClip: Add, Picture, x30 y%posyExit% W435 h32 GuiMove, Resources\Resto1.png
;***********************************************************************
Gui1.Button7 := {} ;Button 7
Gui1.Button7.DefaultImage := "Resources\Reducedcap.png"
,Gui1.Button7.HoverImage := "Resources\Close.png"
Gui1.Button7.PressedImage := "Resources\Reducedcap1.png"
;Gui1.Button7.Label := "ReducedM"
Gui, ContextClip: Add, Picture, x487 y%posyExit% W72 h32 gReducedM hwndhwnd, % Gui1.Button7.DefaultImage
Gui1.Handles[ hwnd ] := "Button7" ;The name of the control to point at.
Gui1.Button7.Hwnd := hwnd
;***********************************************************************
Gui1.Button6 := {} ;Button 6
Gui1.Button6.DefaultImage := "Resources\Close.png"
,Gui1.Button6.HoverImage := "Resources\Close.png"
Gui1.Button6.PressedImage := "Resources\Close1.png"
Gui1.Button6.Label := "ExitLabel"
Gui, ContextClip: Add, Picture, x457 y%posyExit% W30 h32 hwndhwnd, % Gui1.Button6.DefaultImage
Gui1.Handles[ hwnd ] := "Button6" ;The name of the control to point at.
Gui1.Button6.Hwnd := hwnd
;***********************************************************************
Gui, ContextClip: Font, S9 Bold, Verdana
posyExitSess1 := posyExit+08
Gui, ContextClip: Add, Text, cYellow BackgroundTrans +Center x2 y%posyExitSess1% vTextTitle W536 h20, %SessClip%
MouseGetPos, xpos1, ypos1
If threeRButton=1
{
xpos1 := Floor((A_ScreenWidth/2)-450)
ypos1 := Floor((A_ScreenHeight/2)-200)
}
If ControlTwo=1
{
xpos1 := XActTwo-140
ypos1 := yActTwo-13
}
;xpos1 := xpos1-560
;ypos1 := ypos1-alto
AltoSess := Alto+12
Gui, ContextClip: Show, x%xpos1% y%ypos1% w560 h%AltoSess% ;Menu3s
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
OnMessage( 0x201 , "ButtonPress" )
Gosub, NewWindow
return
RButtonAlt:
threeRButton :=1
Gosub, RButton
Return
TitleEditing:
Gosub, NewWindow
StringTrimLeft, REdit, a_guicontrol, 7
FileChange := "HTMLTemp\Name" REdit ".txt"
FileRead, FileCont, %FileChange%
Gui, Edit: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Edit:+Owner
Gui, Edit: Font, S10 Bold, Verdana
Gui, Edit: Add, Picture, x0 y0 h20 w564 h32, Resources\Fondo_Limp.png
Gui, Edit: Add, Text, cYellow BackgroundTrans x35 y6 W560 h32 GuiMove, Clipboard Title
Gui, Edit: Add, Text, x0 y33 w563 0x10 ; 0x7 Black
Gui, Edit: Font, S8 Bold, Verdana
Gui, Edit:Add, Edit, x5 y40 w544 h20 vMyEdit, %FileCont%
;Gui, Edit: Add, Edit, x12 y9 w460 h20 vMyEdit%REdit%, %FileCont%
Gui, Edit:Add, Button, x20 y70 w70 h20 gTitleSave, OK
Gui, Edit:Add, Button, x120 y70 w70 h20 gTitleCancel, Cancel
Gui, Edit:Add, CheckBox, x240 y70 w210 h20 Checked1 vVeryfyChange, Change also the Title to Paste
EdXm := pXm-846
EdYm := pYm-148 ;96
Gui, Edit:Show, x%EdXm% y%EdYm% w564
Return
TitleSave:
Gui, Edit: Submit, Destroy
fileAdd := FileOpen(FileChange, "w")
fileAdd.Write(MyEdit)
fileAdd.Close()
If VeryfyChange=1
{
ReadURL := "HTMLTemp\URL" REdit ".txt"
Fileread URLTxt, %ReadURL%
ReadText:= "HTMLTemp\Text" REdit ".html"
FileDelete, %ReadText%
myResultSave := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" URLTxt ">" MyEdit "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResultSave%, %ReadText%
}
MyEdit :=""
FileCont :=""
FileChange :=""
Gosub, RButton
Return
TitleCancel:
Gui, Edit: Destroy
MyEdit :=""
FileCont :=""
FileChange :=""
;Gosub, NewWindow
Gosub, RButton
Return
ReducedM:
WinGetPos, XActOne, YActOne,,, A
Gui, ContextClip: Destroy
SoundPlay, Resources\Close Window.mp3
ControlOne :=1
ControlTwo :=0
Gosub, NotifyTrayClick_207
Return
NotifyTrayClick_207:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip1: Add, Button, x0 y%posy% w460 h20 gButtonTwo vTwoButton%A_Index%, %A_LoopReadLine%
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip1: Margin, 2, 2
Gui, ContextClip1: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd ;Menu31s
Gui, ContextClip1: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip1:+Owner
Gui, ContextClip1: Add, Button, x20 y%posyExit% w380 h20 gExitLabel, Exit Menu
Gui, ContextClip1: Add, Button, x400 y%posyExit% w60 h20 hwndIcon20 gExtendedM
Gui, ContextClip1: Add, Text, x0 y%posyExit% w20 h20 GuiMove
Gui, ContextClip1: Add, Button, x0 y%posyExit% w20 h20 hwndIcon21
AltoT := Floor((CorpusCount+1)*31.5)
XPos:= A_ScreenWidth-(700)
YPos:= A_ScreenHeight-AltoT-60
If threeRButton=1
{
xpos := Floor((A_ScreenWidth/2)-450)
ypos := Floor((A_ScreenHeight/2)-200)
}
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
ExtendedM:
WinGetPos, XActTwo, YActTwo,,, A
Gui, ContextClip1: Destroy
SoundPlay, Resources\Close Window.mp3
ControlOne :=0
ControlTwo :=1
Gosub, RButton
Return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
ReducedAlt:
threeRButton :=1
Gosub, NotifyTrayClick_207
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: New
Gui, Help: -Caption
Gui, Help: +Owner
Gui, Help: Color, EEAA99
Gui, Help: Margin, 0, 0
Gui, Help: Add, Picture, x0 y0 w640 h250, Resources\Help.jpg
Gui, Help: Add, Button, x495 y209 w100 h30 gNextButton, More...
Gui, Help: Show, w640 h250
Return
NextButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: Destroy
Gui, Help2: New
Gui, Help2: -Caption
Gui, Help2: +Owner
Gui, Help2: Color, EEAA99
Gui, Help2: Margin, 0, 0
Gui, Help2: Add, Picture, x0 y0 w800 h397, Resources\Clipboard Utility Screenshot.jpg
Gui, Help2: Add, Button, x10 y340 w100 h30 gExitButton, Exit
Gui, Help2: Show, w800 h397
Return
ExitButton:
Gui, Help2: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Resources\Close Window.mp3
CopyButton=0
UtilButton :=0
Gui, Hide
Gui, CopyButtom:Hide
Return
;*************************************************************************
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace(status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
Gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
status_button_old:=status_button
return
;*************************************************************************
Deletealert:
if (status_delete=status_delete_old)
return
Gui, 4:default
Gui, destroy
NumberDelete:= RegExReplace(status_delete,"\D")
if !NumberDelete
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Delete Clipboard Number %NumberDelete%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 4:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 4:margin, 0, 0
Gui, 4:add, ActiveX, vWB w64 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
DelXm := pXm-944
GuiControl, Move, WB, h%maxBottom%
Gui, 4: Show, x%DelXm% y%pYm% w64 h60
status_delete_old:=status_delete
Return
;*************************************************************************
Copyalert:
if (status_Copy=status_Copy_old)
return
Gui, 6:default
Gui, destroy
NumberCopy:= RegExReplace(status_Copy,"\D")
if !NumberCopy
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Copy Item %NumberCopy% as Current Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 6:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 6:margin, 0, 0
Gui, 6:add, ActiveX, vWB w60 h72, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 6: Show, x%pXm% y%pYm% w60 h72
status_Copy_old:=status_Copy
Return
;*************************************************************************
URLalert:
if (status_URL=status_URL_old)
return
Gui, 5:default
Gui, destroy
NumberURL:= RegExReplace(status_URL,"\D")
URL_file := "HTMLTemp\URL" NumberURL ".txt"
if !URL_file
return
;Gui,2:Destroy
;URL_file := "HTMLTemp\URL" NumberURL ".txt"
FileRead, URLContents, %URL_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Go to: %URLContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 5:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 5:margin, 0, 0
Gui, 5:add, ActiveX, vWB w562 h30, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
DelXm := pXm-845
;DelXm := pXm-819
DelYm := pYm-47
;Gui, 5: Show, x%DelXm% y%DelYm% w543 h30
Gui, 5: Show, x%DelXm% y%DelYm% w562 h30
status_URL_old:=status_URL
Return
;*************************************************************************
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace(status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Gui,5:Destroy
FileRead, FileContents, %Text_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 3:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 3:margin, 0, 0
Gui, 3:add, ActiveX, vWB w320 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
;*************************************************************************
Editingalert:
if (status_Editing=status_Editing_old)
return
Gui, 6:default
Gui, destroy
EditingNumber:= RegExReplace(status_Editing,"\D")
if !EditingNumber
return
Gui,2:Destroy
Gui,5:Destroy
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Edit Title of the %EditingNumber%th Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 7: +AlwaysOnTop -Caption +ToolWindow Border
;Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui, 7:margin, 0, 0
gui, 7:add, ActiveX, vWB w62 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
;DelXm := pXm-953
GuiControl, Move, WB, h%maxBottom%
gui, 7: Show, x%pXm% y%pYm% w62 h60
status_Editing_old:=status_Editing
Return
;*************************************************************************
^F6::
ControlPaste:
MsgBox, 0x1034,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Hide
;Gui, Destroy
;Gui, -MinimizeBox
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Resources\Close Window.mp3
Return
^F10::
DeleteAll:
MsgBox, 0x1034,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
SavePDF:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, -MinimizeBox
Sleep, 1000
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, Resources\PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
PDFCount++
FormatTime, CurrentDate,, dd-MM-yyyy
Filedate := "Documents\Final_Document_" CurrentDate "-" PDFCount ".pdf"
Filedateh := "Documents\ToPDF_" CurrentDate "-" PDFCount ".html"
FileMove, Final_Document.pdf, %Filedate%
Run, %Filedate%
FileMove, ToPDF.html, %Filedateh%
;FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Return
^F11::
;^!z::
DeleteLast:
MsgBox, 0x1034,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
;FileDelete, HTMLTemp\*%CorpusCount%.*
FileDelete, HTMLTemp\Corpus%CorpusCount%.html
FileDelete, HTMLTemp\image%CorpusCount%.jpg
FileDelete, HTMLTemp\Name%CorpusCount%.txt
FileDelete, HTMLTemp\Text%CorpusCount%.html
FileDelete, HTMLTemp\TextPlain%CorpusCount%.txt
FileDelete, HTMLTemp\URL%CorpusCount%.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
;CorpusCount--
Return
^Esc::
Exit:
ExitApp
Return
Borrado:
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, LabelSessionAct
CorpusCount :=0
Gosub, ReloadSession
;Gosub, ReloadMenu
Return
ButtonTwo:
StringTrimLeft, NumberFile, a_guicontrol, 9
;Gui, 2: Destroy
;Gui, ContextClip: Destroy
Gosub, ButtonLabel
Return
LabelSession:
;NumberFile:=A_ThisMenuItemPos
;Menu, tray, ToggleCheck, &Suspend Hotkeys
;Menu, tray, ToggleCheck, Clipboard Sessions
MsgBox, 0x1024,, You want the session %A_ThisMenuItem% to be the default session?
IfMsgBox No
Return
;Loop, %DirectoryCount%
/*
if !FileExist("HTMLTemp" A_Index)
{
;NumberDir : %A_Index%
MoveDir := "HTMLTemp" A_Index
}
MsgBox, %MoveDir%
*/
FileDelete, SessionTemp*.txt
FileDelete, SessionTemp00.txt
FileDelete, SessionTemp01.txt
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
NumSess := A_Index-1
NumberPos:= A_ThisMenuItemPos-3
;MsgBox, %NumberPos%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp"
FileAppend, %FileSession%, SessionTemp.txt
FileAppend, %A_ScriptDir%, SessionTemp00.txt
FileSession2 := "\HTMLTemp00"
FileAppend, %FileSession2%, SessionTemp00.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;FileMove %DirectorySess%, %DirectorySess00%
FileMoveDir %DirectorySess%, %DirectorySess00%, R
;DirectorySess :=""
;DirectorySess00 :=""
FileAppend, %A_ScriptDir%, SessionTemp01.txt
FileSession3 := "\HTMLTemp" NumberPos
FileAppend, %FileSession3%, SessionTemp01.txt
FileRead, DirectorySess01, SessionTemp01.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;MsgBox, %DirectorySess01%`n%DirectorySess%
FileMoveDir %DirectorySess01%, %DirectorySess%, R
FileMoveDir %DirectorySess00%, %DirectorySess01%, R
Menu, SessionID, DeleteAll
Menu, ClipboardID, DeleteAll
Iniciate:=0
Gosub, ReloadSession
Return
ButtonLabelTray:
If CorpusCount=0
Return
NumberFile:=A_ThisMenuItemPos
Gosub, ButtonLabel
Return
ButtonLabel:
;NumberFile:= RegExReplace(NameTwo,"\D")
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
SoundPlay, Resources\Close Window.mp3
Gui, ContextClip1: Destroy
Gui, ContextClip: Destroy
;Gui, Destroy
Gui,2: Destroy
Gui, Gui1: Destroy
;Gui, 2:default
;Gui, destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
ControlOne :=0
ControlTwo :=0
threeRButton :=0
Alto:=0
Return
TxtLabel:
SoundPlay, Resources\Clipboard_Sound.mp3
StringTrimLeft, TextCopy, a_guicontrol, 5
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
Return
TxtPlane:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
global status_Delete ,tme
global status_URL ,tme
global status_Copy ,tme
global status_Editing ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
status_Delete:=""
status_URL:=""
status_Copy:=""
status_Editing:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
if instr(a_guicontrol,"Delete")
{
status_Delete:=a_guicontrol
SetTimer, Deletealert,-20
}
if instr(a_guicontrol,"URL")
{
status_URL:=a_guicontrol
SetTimer, URLalert,-20
}
if instr(a_guicontrol,"Copy")
{
status_Copy:=a_guicontrol
SetTimer, Copyalert,-20
}
if instr(a_guicontrol,"Editing")
{
status_Editing:=a_guicontrol
SetTimer, Editingalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
status_Delete_old:=""
status_URL_old:=""
status_Copy_old:=""
status_Editing_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
URLButton:
SoundPlay, Resources\Close Window.mp3
MsgBox, 0x1024,, Extract URL's from Clipboards?
IfMsgBox No
Return
Else
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
}
}
Gosub, ExtractURL
FileDelete, ToPDF.html
Return
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
Return True
}
;************************************************************************************************************************
ExtractURL:
;Create header html document
FileAppend,
(
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=AutoHotkey.File>
<meta name=Generator content="AutoHotkey">
</head>
<body lang=es style='font-family:Calibri;font-size:11.0pt'>
), Extracted_Links.html
FormatTime, CurrentDate,, dd-MM-yyyy
DateIncl := "<p style='margin:0in'><span style='font-family:Times New Roman;font-size:11.0pt;color:#1E4D78'>Clipboard Session URLs: </span><span style='font-weight:bold;font-family:Calibri;font-size:12.0pt;color:#860000'>" CurrentDate "</span></p>"
FileAppend, %DateIncl%, Extracted_Links.html
;Add Line
myResult := "<p style='margin:0in;font-family:Calibri;font-size:11.0pt;color:#78230C'><p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>`r
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>`r"
FileAppend, %myResult%, Extracted_Links.html
;Routine loop, origin: https://www.autohotkey.com/docs/commands/LoopReadFile.htm
LinkCount := 0
ImgCount := 0
Loop, read, ToPDF.html, Extracted_Links.html
{
URLSearchString := A_LoopReadLine
Gosub, URLSearch
}
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links.html
Loop, read, Extracted_Links.html
{
If A_Index < 11
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
if A_Index > 11
if RegExMatch(A_LoopReadLine, "\.(jpg<|jpeg<|png<|gif<|svg<)")
{
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
ImgCount++ ; increment by one
}
else If InStr(A_LoopReadLine, "</ul>", True) and A_Index > 17
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links_Img.html
}
;URL number message, Optional
MsgBox %LinkCount% links were found and written to "Extracted_Links.html" `n %ImgCount% Images were found and written to "Extracted_Links_Img.html"
;Opcional, opens the result
FormatTime, CurrentDate,, dd-MM-yyyy
FileURL := "Documents\Extracted_Links_" CurrentDate ".html"
FileURLImg := "Documents\Extracted_Links_Img_" CurrentDate ".html"
FileMove, Extracted_Links.html, %FileURL%
FileMove, Extracted_Links_Img.html, %FileURLImg%
FileDelete, ToPDF.html
Run, %FileURL%
Run, %FileURLImg%
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
URLStart1 := InStr(URLSearchString, "https://")
URLStart2 := InStr(URLSearchString, "http://")
URLStart3 := InStr(URLSearchString, "ftp://")
URLStart4 := InStr(URLSearchString, "www.")
; Find the left-most starting position:
URLStart := URLStart1 ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
ArrayElement := URLStart%A_Index%
if (ArrayElement = "") ; End of the pseudo-array has been reached.
break
if (ArrayElement = 0) ; This element is disqualified.
continue
if (URLStart = 0)
URLStart := ArrayElement
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if (ArrayElement != 0)
if (ArrayElement < URLStart)
URLStart := ArrayElement
}
}
if (URLStart = 0) ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
URL := SubStr(URLSearchString, URLStart) ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%<> ; Find the first space, tab, or angle (if any).
{
URL := A_LoopField
break ; i.e. perform only one loop iteration to fetch the first "field".
}
StringReplace, URLCleansed, URL, ",, All
; Makes a second check to replace extraneous signs.
FixString := % URLCleansed
vList := "
(
%21 !
%23 #
%24 $
%26 &
%27 '
%28 (
%29 )
%2A *
%2B +
%2C ,
%3B ;
%2F /
%3A :
%3D =
%3F ?
%40 @
%5B [
%5D ]
%20
%C2%B4 ´
%2E .
%25 %
%2D -
%3C <
%3E >
%5C \
%5E ^
%5F _
%60 `
%7B {
%7C |
%7D }
%7E ~
%22 ""
\/ \
)"
Loop, Parse, vList, `n
{
oTemp := StrSplit(A_LoopField, "`t")
FixString := StrReplace(FixString, oTemp.1, oTemp.2)
}
oTemp := ""
ClipBoard := "<li style='margin-top:0;margin-bottom:0;vertical-align:middle'><p style='margin:0in;font-family:Calibri;font-size:10.0pt'><a href=" FixString ">" FixString "</a></p></li>"
FileAppend, %ClipBoard%`n
LinkCount += 1
; See if there are any other URLs in this line:
CharactersToOmit := StrLen(URL)
CharactersToOmit += URLStart
URLSearchString := SubStr(URLSearchString, CharactersToOmit)
Gosub, URLSearch ; Recursive call to self.
return
;**********************************************************************************************
^F1::
CaseMenu:
Menu Case, Add
Menu Case, DeleteAll
Menu Case, Add, &UPPERCASE, CCase
Menu Case, Add, &lowercase, CCase
Menu Case, Add, &Title Case, CCase
Menu Case, Add, &a Title to Case, CCase
Menu Case, Add, &Sentence case, CCase
Menu Case, Add
Menu Case, Add, &Remove Spaces, CCase
GetText(Txt)
If NOT ERRORLEVEL
Menu Case, Show
Return
CCase:
p:=A_ThisMenuItemPos
If (p=1)
StringUpper, Txt, Txt
Else If (p=2)
StringLower, Txt, Txt
Else If (p=3)
StringLower, Txt, Txt, T
Else If (p=4)
{
StringLower, Txt, Txt
;IMPORTANT! Change short words to be replaced in the following list according to each language or add more
lowers := ["a", "ha", "el", "y", "pero", "o", "para", "las", "es", "para", "por", "los", "con", "en", "que", "un", "de", "del", "la", "una", "cada", "en", "al", "por", "uno", "mi", "tu", "tú", "no", "ni", "sin", "se", "lo", "e", "su", "sí", "ser", "hay"]
for k, v in lowers
low .= (k = 1 ? "" : "|") . v
;Txt := RegExReplace(Txt, "(*UCP)(^\b|\b(?!(" . low . ")\b))\w+\b|\b\w+\b$", "$T0")
;Txt := RegExReplace(Txt, "((?:^|[.!?-]\s+)[a-z])", "$u1")
Txt := RegExReplace(Txt, "(*UCP)(^|\b(?!(" . low . ")\b))\w|(\.|\?|!)\s*\K\w|-\K\w", "$T0")
}
Else If (p=5)
{
StringLower, Txt, Txt
Txt := RegExReplace(Txt, "((?:^|[.!?]\s+)[a-z])", "$u1")
}
Else If (p=7)
{
Loop
{
StringReplace, Txt, Txt, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0
break
}
}
PutText(Txt)
Return
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^{vk43} ;Ctrl C
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard =
Sleep 20
Clipboard := MyText
Send ^{vk56} ;Ctrl V
Sleep 100
Clipboard := SavedClip
Return
}
;*******************************************************************************
Nothing:
Run, https://www.autohotkey.com/boards/viewtopic.php?t=92963
Return
Tray_Open:
ListLines
return
^!F4::
NewSession:
Gui, Session: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Session:+Owner
Gui, Session: Font, S10 Bold, Verdana
Gui, Session: Add, Picture, x0 y0 h20 w562 h32, Resources\Fondo_Limp.png
Gui, Session: Add, Text, cYellow BackgroundTrans x35 y6 W560 h32 GuiMove, Session Name
;Gui, RenSession: Add, Text, x5 y6 h20 w549, Session Name:
Gui, Session: Add, Text, x0 y33 w563 0x10 ; 0x7 Black
Gui, Session: Font, S8 Bold, Verdana
Gui, Session: Add, Edit, x5 y40 vSessEdit h20 w544, New Session
Gui Session:Add, Button, x20 y70 w70 h20 gSessionSave, OK
Gui Session:Add, Button, x120 y70 w70 h20 gSessCancel, Cancel
xSess := Floor((A_ScreenWidth/2)-448)
ySess := Floor((A_ScreenHeight/2)-200)
Gui, Session: Show, x%xSess% y%ySess% w562
Return
SessionSave:
FileDelete, SessionTemp.txt
Gui, Session: Submit
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal1 := A_Index
FileCreateDir, HTMLTemp%SessionTotal1%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp" SessionTotal1 "\Session.txt"
FileAppend, %FileSession%, SessionTemp.txt
;Sleep, 3500
FileRead, Directory, SessionTemp.txt
FileAppend, %SessEdit%, %Directory%
Menu, SessionID, DeleteAll
Iniciate:=1
;Gosub, NewWindow
SessEdit :=""
Gosub, ReloadSession
Return
SessCancel:
Gui, Session:Destroy
Gui, RenSession:Destroy
SessEdit :=""
ReSessEdit :=""
Gosub, RButton
Return
/*
LabelSessionAct1:
Position :=1
Return
*/
LabelSessionAct:
Gosub, NewWindow
ReadSess := "HTMLTemp\Session.txt"
FileRead, RenSession, %ReadSess%
Gui, RenSession: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, RenSession:+Owner
Gui, RenSession: Font, S10 Bold, Verdana
Gui, RenSession: Add, Picture, x0 y0 h20 w564 h32, Resources\Fondo_Limp.png
Gui, RenSession: Add, Text, cYellow BackgroundTrans x35 y6 W560 h32 GuiMove, Session Name
;Gui, RenSession: Add, Text, x5 y6 h20 w549, Session Name:
Gui, RenSession: Add, Text, x0 y33 w563 0x10 ; 0x7 Black
Gui, RenSession: Font, S8 Bold, Verdana
Gui, RenSession: Add, Edit, x5 y40 vReSessEdit h20 w544, %RenSession%
Gui RenSession:Add, Button, x20 y70 w70 h20 gRenSessionSave, OK
Gui RenSession:Add, Button, x120 y70 w70 h20 gSessCancel, Cancel
xSess := pXm-846
ySess := pYm-148 ;96
;ySess := Floor((A_ScreenWidth/2)-448)
;ySess := Floor((A_ScreenHeight/2)-200)
Gui, RenSession: Show, x%xSess% y%ySess% w564
Return
RenSessionSave:
Gui, RenSession: Submit
FileDelete, HTMLTemp\Session.txt
FileAppend, %ReSessEdit%, HTMLTemp\Session.txt
ReSessEdit :=""
Gosub, RButton
Return
/*
Paused:
Paused:=!Paused
IfEqual,Paused,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Orange.ico
IfEqual,Paused,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Pause Script
Menu,Tray,Icon,,,1
Pause,Toggle,1
Return
*/
^F12::
Stanby:
Suspend:=!Suspend
IfEqual,Suspend,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Red.ico
IfEqual,Suspend,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Suspend Hotkeys
Menu,Tray,Icon,,,1
Suspend,Toggle
Return
EditScript:
Run Edit %A_ScriptName%
Return
^F7::
Reloaded:
Reload
Return
/*
^!F3::
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
^!F3::
Loop, read, SesionName.txt
{
Menu, MyMenu, add,%A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
;Menu, MyMenu, add, Clipboard, ButtonLabelTray
;Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
Menu, MyMenu, Color, FFFFFF
Menu, MyMenu, show
;}
Return
*/
^!F3::
;Loop, Parse, MyListBox, |
;Loop, read, SesionName.txt
;{
Gui, -Caption
Gui, Color, ffffd6
;Gui, Font, S12 Bold, Verdana
Gui, Font, s9, Segoe UI
Gui, Add, ListBox, vsesion w470 h225
;Gui, Add, ListBox, r5, Red|Green|Blue|Black|White
;Gui, MiListBox:Add, ListBox, r5 vColorChoice, %A_LoopReadLine%
;MsgBox Selection number %A_Index% is %A_LoopField%.
;}
Loop, read, SesionName.txt
{
GuiControl,, sesion, %A_LoopReadLine%
}
Gui, Show
/*
;To cancel, press ESCAPE or close this window.
Gui, Add, ListBox, vListBox_pdf x16 y10 w370 h125,
Gui, Add, ListBox, vListBox_ini x16 y145 w370 h125,
Gui, Add, Button, Default, OK
;----------------------------- Start Fill Listboxs
Loop, C:\temp\*.pdf
{
GuiControl,, ListBox_pdf, %A_LoopFileFullPath%
}
Loop, C:\*.ini
{
GuiControl,, ListBox_ini, %A_LoopFileFullPath%
}
Gui, Show
*/
NotifyTrayClick_201:
;xSplash := Floor((A_ScreenWidth/2)-450)
;ySplash := Floor((A_ScreenHeight/2)-200)
xSplash := A_ScreenWidth-506
ySplash := A_ScreenHeight-180
SplashTextOn, 500, 80, Content of the current clipboard, %Clipboard%
WinMove, Content of the current clipboard,, xSplash, ySplash
;SplashTextOn,,, Displays only a title bar.
Sleep, 1000
SplashTextOff
;SplashTextOn,,, %Clipboard%
;WinMove,,, xSplash, ySplash
;Sleep, 1000
;SplashTextOff
Return
Code: Select all
^F3::
Send ^c
RunWait, %A_WorkingDir%\Addons\InsideClipboard.exe /saveclp Clipboard.clp,,hide
Return
^F4::
RunWait, %A_WorkingDir%\Addons\InsideClipboard.exe /loadclp Clipboard.clp,,hide
Send ^v
Return
Code: Select all
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
#NoEnv
#MaxMem,1024
^F3::
Send ^c
Data:=clip_GetHtmlString()
;FileAppend, %Data%, Texto.html
;DataReplace := StrReplace(Data, "<h1", "<p")
;DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %Data%, Temp.html ;, CP65001
;FileAppend, %DataReplace1%, Temp.html ;, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%`n, TempPDF.html
}
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
Return
^F8::
WinClip.Clear()
html := FileOpen("temp2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Return
;----------------------------------------------------------------------------------------------
clip_GetHtmlString()
{ if !DllCall("User32.dll\IsClipboardFormatAvailable","UInt",ClipFormatHtml:=DllCall("User32.dll\RegisterClipboardFormat","Str","HTML Format","UInt"))
return 0
DllCall("User32.dll\OpenClipboard","Ptr",0,"UInt")
htmlString:=DllCall("User32.dll\GetClipboardData","UInt",ClipFormatHtml,"Str")
DllCall("User32.dll\CloseClipboard")
Len:=(StrLen(htmlString)*(A_IsUnicode?2:1))
If (Len<1)
return 0
return StrGet(&htmlString,Len,"")
}
/*
clip_SetHtmlString(htmlString)
{ DllCall("User32.dll\OpenClipboard","Uint",0)
DllCall("User32.dll\EmptyClipboard")
DllCall("User32.dll\SetClipboardData","Uint",DllCall("User32.dll\RegisterClipboardFormat","Str","HTML Format","UInt"),"Astr",htmlString)
DllCall("User32.dll\CloseClipboard")
return
}
Code: Select all
;https://www.autohotkey.com/boards/viewtopic.php?f=76&t=92963
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
;EnvSet, SD, %A_ScriptDir%
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
#Include Library\ViewHtml.ahk
#Include Library\Gdip_All_1.45.ahk
;#Include Library\ToolTipEx.ahk
#SingleInstance, Force
#InstallMousehook
;#Persistent
SetBatchLines, -1
Name := "Clipboard Utility - "
Version := "4.2a"
CoordMode, Mouse, Screen
;IniciateUtility:
CoordMode, Mouse, Screen
CorpusCount := 0
DirectoryCount := 0
Iniciate := 0
PDFCount := 0
WordCount := 0
SuspendThumbnail := 0
;Hotkey, LButton Up, off
;loop, HTMLTemp\Corpus*.html
;CorpusCount := % Floor(A_Index)
Menu, Tray, Icon, Resources\Scissors_Green.ico
Menu, Tray, NoStandard
Menu, tray, Add, %name% %version%, Nothing
Menu, tray, Icon, %name% %version%, Resources\Clipboard Utility.ico
Menu, Tray, Add
Menu, tray, Add, Exit , Exit
Menu, tray, Icon, Exit , shell32.dll, 132
Menu, Tray, Add
Menu, tray, Add, &Suspend Hotkeys , Stanby
Menu, tray, Icon,&Suspend Hotkeys , %A_ScriptDir%\Resources\Scissors_Red.ico
Menu, Tray, Add
Menu, Tray, Add, Help, HelpButton
Menu, Tray, Icon, Help, %A_ScriptDir%\Resources\Help.ico
Menu, Tray, Add
Menu Tray, Add, Open Info, Tray_Open
Menu Tray, Icon, Open Info, %A_ScriptDir%\Resources\Info.ico
Menu, tray, Add, &Reload this script , Reloaded
Menu, tray, Icon,&Reload this script , %A_ScriptDir%\Resources\2488.ico
Menu, tray, Add, &Edit this script , EditScript
Menu, tray, Icon,&Edit this script , comres.dll, 7
Menu, tray, Add,
Menu, winmanagetID, Add, Clipboard Window Extended, RButtonAlt
Menu, winmanagetID, icon, Clipboard Window Extended, %A_ScriptDir%\Resources\162.ico
Menu, winmanagetID, Add, Clipboard Window Reduced, ReducedAlt
Menu, winmanagetID, icon, Clipboard Window Reduced, %A_ScriptDir%\Resources\Clipboard Utility.ico
Menu, winmanagetID, Add, Utility Window, WUtil
Menu, winmanagetID, icon, Utility Window, %A_ScriptDir%\Resources\75a.ico
Menu, winmanagetID, Add, Copy Clipboard Window, CopyGui
Menu, winmanagetID, icon, Copy Clipboard Window, Resources\Clipboard Utility 5.ico
Menu, Tray, add, Window Management, :winmanagetID
Menu, tray, Icon, Window Management, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add, Save all Clipboard to PDF File, SavePDF
Menu, Tray, Icon, Save all Clipboard to PDF File, %A_ScriptDir%\Resources\PDF.ico
Menu, Tray, Add, Save all Clipboard to Word File, SaveWord
Menu, Tray, Icon, Save all Clipboard to Word File, %A_ScriptDir%\Resources\Word1.ico
Menu, Tray, Add, Extract URL's from clipboard, URLButton
Menu, Tray, Icon, Extract URL's from clipboard, %A_ScriptDir%\Resources\URL.ico
Menu, ThumbnailID, Add, Postpone Thumbnail Creation, SuspendThumbnail
Menu, ThumbnailID, Icon, Postpone Thumbnail Creation, %A_ScriptDir%\Resources\1908.ico
Menu, ThumbnailID, Add, Create Missing Thumbnails, CreateMissing
Menu, ThumbnailID, Icon, Create Missing Thumbnails, %A_ScriptDir%\Resources\949.ico
Menu, Tray, Add, Thumbnail Creation, :ThumbnailID
Menu, Tray, Icon, Thumbnail Creation, %A_ScriptDir%\Resources\989.ico
Menu, DeleteID, Add, Delete Last Clipboard, DeleteLast
Menu, DeleteID, Icon, Delete Last Clipboard, %A_ScriptDir%\Resources\1892.ico
Menu, DeleteID, Add, Delete All Clipboard, DeleteAll
Menu, DeleteID, Icon, Delete All Clipboard, %A_ScriptDir%\Resources\Recycle Bin Full.ico
Menu, Tray, add, Delete Options, :DeleteID
Menu, tray, Icon, Delete Options, %A_ScriptDir%\Resources\Recycle 3.ico
Menu, Tray, Add
;**********************************************************************************************
ReloadSession:
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal := A_Index-1
FileDelete, SessionNumber.txt
;If !CorpusCount=0
;{
NumberSessTemp := "HTMLTemp\Session.txt"
FileRead, Session1, %NumberSessTemp%
; Fileappend, %Session1% `n, SessionNumber.txt
;Menu, SessionID, add, %Session1%, LabelSessionAct1
;Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2293.ico
;Menu, SessionID, add
Menu, SessionID, add, Create New Session, NewSession
Menu, SessionID, Icon, Create New Session, %A_ScriptDir%\Resources\178.ico
Menu, SessionID, add
Menu, SessionID, add, 0: %Session1%, LabelSessionAct1
Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2478.ico
;Menu, SessionID, add, Current Session, LabelSessionAct0
;Menu, SessionID, Icon, Current Session, %A_ScriptDir%\Resources\2478.ico
;************************************************************************
loop, %SessionTotal%
{
FileDelete, SessionCount.txt
FileAppend, %A_ScriptDir%, SessionCount.txt
FullFile:="\HTMLTemp" A_Index "\*.*"
FileAppend, %FullFile%, SessionCount.txt
FileRead, CountFiles, SessionCount.txt
;MsgBox, %CountFiles%
loop, %CountFiles%
FilesCount := % Floor(A_Index/6)
NameTemp := "HTMLTemp" A_Index "\Session.txt"
FileRead, Session1, %NameTemp%
Fileappend, %Session1% |·| %FilesCount% Clipboards`n, SessionNumber.txt
;MsgBox, %FilesCount%
}
Loop, read, SessionNumber.txt
{
Menu, SessionID, add, %A_Index%: %A_LoopReadLine%, LabelSession
}
Menu, Tray, add, Clipboard Sessions, :SessionID
Menu, Tray, Icon, Clipboard Sessions, %A_ScriptDir%\Resources\2036.ico
Menu, Tray, Add
;**********************************************************************
ReloadMenu:
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
Menu, ClipboardID, add, %A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
Menu, Tray, add, Clipboard, :ClipboardID
Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
}
Menu, Tray, Default, Window Management
;Menu, Tray, Default, Clipboard Sessions
;Menu, Tray, Tip, Clipboard Utility 4.1f
Menu, Tray, Tip, This Session has 0%CorpusCount% Clipboards
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
Gui, CopyButtom:+Owner
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, Resources\PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, Resources\PauseOff.png
GuiButtonIcon(Icon, "Resources\Clipboard Utility 5.ico", 1, "s90")
/*
if FileExist("HTMLTemp\Text1.html")
MsgBox, 0x1034,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
*/
GoSub, Toggle_Switch
CorpusCount := 0
;DirectoryCount := 0
if !FileExist(HTMLTemp)
{
FileCreateDir, HTMLTemp
}
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
DirectoryCount := A_Index-1
;MsgBox, %DirectoryCount%
Filedelete, WorkingDir.txt
FileAppend, %A_ScriptDir%\, WorkingDir.txt
FileRead, ScriptDir, Workingdir.txt
threeRButton=1
loop, Documents\*.pdf
PDFCount := A_Index
If PDFCount != 0
{
PDFCount := PDFCount+1
}
;MsgBox, %PDFCount%
loop, Documents\*.docx
WordCount := A_Index
If WordCount != 0
{
WordCount := WordCount+1
}
If Iniciate=1
{
Return
}
;If !Iniciate=1
Gosub, RButton
Return
^F4::
GuiUtily:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd
Gui, Utily: -Caption HwndHwnd
Gui, Utily: +Owner
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Utily: Add, Picture, x0 y0 w739 h167, Resources\Clipboard Utility_p_2.png
;Gui, Add, Text, x0 y0 w691 h35 GuiMove ; , `&& Drag
Gui, Utily: Add, Picture, x0 y0 w691 h35 GuiMove, Resources\ArribaIzq1.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "Resources\PDFup.png"
Gui1.Button1.HoverImage := "Resources\PDFhover.png"
Gui1.Button1.PressedImage := "Resources\PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Utily: Add, Picture, x12 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "Resources\WordUp.png"
Gui1.Button2.HoverImage := "Resources\WordOver.png"
Gui1.Button2.PressedImage := "Resources\WordDown.png"
Gui1.Button2.Label := "SaveWord"
Gui, Utily: Add, Picture, x154 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "Resources\PasteUp.png"
Gui1.Button3.HoverImage := "Resources\PasteHover.png"
Gui1.Button3.PressedImage := "Resources\PasteDown.png"
Gui1.Button3.Label := "ControlPaste"
Gui, Utily: Add, Picture, x297 y36 w141 h115 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "Resources\UrlUp.png"
Gui1.Button4.HoverImage := "Resources\UrlHover.png"
Gui1.Button4.PressedImage := "Resources\UrlDown.png"
Gui1.Button4.Label := "URLButton"
Gui, Utily: Add, Picture, x440 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 5
;************************************************************************************************************************
Gui1.Button5 := {} ;Button 5
Gui1.Button5.DefaultImage := "Resources\HelpUp.png"
Gui1.Button5.HoverImage := "Resources\HelpHover.png"
Gui1.Button5.PressedImage := "Resources\HelpDown.png"
Gui1.Button5.Label := "HelpButton"
Gui, Utily: Add, Picture, x583 y36 w141 h115 hwndhwnd, % Gui1.Button5.DefaultImage
Gui1.Handles[ hwnd ] := "Button5" ;The name of the control to point at.
Gui1.Button5.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 6
;************************************************************************************************************************
Gui1.Button6 := {} ;Button 6
Gui1.Button6.DefaultImage := "Resources\ExitUp1.png"
Gui1.Button6.HoverImage := "Resources\ExitHover1.png"
Gui1.Button6.PressedImage := "Resources\ExitDown1.png"
;Gui1.Button6.Label := "ExitLabel"
Gui1.Button6.Label := "GuiClose"
Gui, Utily: Add, Picture, x691 y0 w48 h35 hwndhwnd, % Gui1.Button6.DefaultImage
Gui1.Handles[ hwnd ] := "Button6" ;The name of the control to point at.
Gui1.Button6.Hwnd := hwnd
;************************************************************************************************************************
/*
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
*/
MouseGetPos, xposUtil, yposUtil
If UtilButton=1
{
xposUtil := Floor((A_ScreenWidth/2)-450)
yposUtil := Floor((A_ScreenHeight/2)-200)
}
Gui, Utily: Show, x%xposUtil% y%yposUtil% W739 h167, Hover
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
WUtil:
UtilButton:=1
Gosub, GuiUtily
Return
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, Resources\ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
;Data:=clip_GetHtmlString()
accData:= GetAccData()
;******************************************************************************************************************
If not ClipboardGet_HTML( Data )
{
ErrorType :=1
Gosub, ControlError
;MsgBox, The content of the clipboard does not have a valid format to be saved and the operation will be canceled.
Return
}
Else
CorpusCount++
;******************************************************************************************************************
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
;******************************************************************************************************************
FileGetSize, SizeFile, %FileaccData%
If !FileaccData or SizeFile=3
{
ErrorType :=0
Gosub, ControlError
If ErrorTex=0
Return
}
;******************************************************************************************************************
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
;******************************************************************************************************************
FileGetSize, SizeFile1, %FileTex%
If !FileTex or SizeFile1=3
{
ErrorType :=0
Gosub, ControlError
If ErrorTex=0
Return
}
;******************************************************************************************************************
;ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html ;, CP65001
;******************************************************************************************************************
FileGetSize, SizeFile2, Temp.html
;MsgBox, %SizeFile2%
FileHTML := "Temp.html"
If !FileHTML or SizeFile2=3
{
ErrorType :=1
Gosub, ControlError
;If ErrorTex=0
Return
}
;******************************************************************************************************************
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%`n, TempPDF.html
}
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
If SuspendThumbnail=0
{
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
Gosub, ResizeH
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
;**********************
If !ImageCount
{
ErrorType :=2
Gosub, ControlError
}
;**********************
FileDelete, Image_Temp.jpg
}
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
;Gosub, CheckProcess
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Iniciate:=1
Data :=""
Gosub, ReloadMenu
Return
ControlError:
If ErrorType =0
{
MsgBox, 0x1024,, You have not been able to save the name of the clipboard source, you will be able to name it later. `nContinue in every way?
IfMsgBox Yes
{
ErrorTex:=1
Return
}
ErrorText:=0
Return
}
If ErrorType =1
{
MsgBox, The content of the clipboard does not have a valid format to be saved and the operation will be canceled.`n(The source of the text must be from the Internet or from formatted Word or PDF files opened with a browser.)
;CorpusCount++
;FileDelete,
Return
}
If ErrorType =2
;{
;MsgBox, 0x1024,, The clipboard image could not be saved. The clipboard exists, but it won't display an image `nContinue in every way?
MsgBox, The clipboard image could not be saved. The clipboard exists, but it will not display an image.`n It can be created later.
*/
IfMsgBox Yes
{
ErrorImg:=1
Return
}
ErrorImg:=0
*/
Return
;}
Return
ResizeH:
filePath := "Image_Temp.jpg"
size := GetImageSize(filePath)
If size.H !>500
return
else
if ErrorLevel
return
crop(FilePath, 0, 0, W, 500)
Return
/*
CheckProcess:
Corpus:= "HTMLTemp\Corpus" CorpusCount ".html"
Corpus:= "HTMLTemp\Image" CorpusCount ".jpg"
Corpus:= "HTMLTemp\name" CorpusCount ".txt"
Corpus:= "HTMLTemp\TextPlain" CorpusCount ".txt"
Corpus:= "HTMLTemp\URL" CorpusCount ".txt"
Corpus:= "HTMLTemp\Text" CorpusCount ".txt"
Return
*/
CopyGui:
CopyButton:=1
;GoSub, Toggle_Switch
Gosub, Menu2
Return
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
FileDelete, HTMLTemp\Corpus%DelClip%.html
FileDelete, HTMLTemp\image%DelClip%.jpg
FileDelete, HTMLTemp\Name%DelClip%.txt
FileDelete, HTMLTemp\Text%DelClip%.html
FileDelete, HTMLTemp\TextPlain%DelClip%.txt
FileDelete, HTMLTemp\URL%DelClip%.txt
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
;CorpusCount--
;Gosub, RButton
Iniciate:=0
Menu, ClipboardID, DeleteAll
;Gosub, IniciateUtility
Gosub, ReloadMenu
}
Return
^F8::
Menu2:
;MouseGetPos, xpos1, ypos1
MouseGetPos, xposMen, yposMen
If CopyButton=1
{
xposMen := Floor(A_ScreenWidth/2)
yposMen := Floor(A_ScreenHeight/2-100)
}
Gui, CopyButtom:Show, x%xposMen% y%yposMen% W81 h84
Return
+RButton::
RButton:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
;Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
Gui1.Hwnd := hwnd
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x520 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x540 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w20 h20 hwndIcon10 gClipDelete vDeleteButton%A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon9 gTitleEditing vEditing%A_Index%
Gui, ContextClip: Add, Button, x40 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "Resources\clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "Resources\128.ico", 1, "s32")
GuiButtonIcon(Icon8, "Resources\ArrowSmall.ico", 1, "s32")
GuiButtonIcon(Icon10, "Resources\recycle 2.ico", 1, "s32")
GuiButtonIcon(Icon9, "Resources\pencil 1.ico", 1, "s24")
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
;Gui, ContextClip: -Caption +ToolWindow +0x400000 +hWndhMainWnd HwndHwnd ;Menu3s
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd
;Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
;WinSet, Transparent
Gui, ContextClip:+Owner
posyExitSess := posyExit+20
;LeeSession:= ScriptDir "\HTMLTemp\Session.txt"
LeeSession:= "HTMLTemp\Session.txt"
FileRead, SessClip, %LeeSession%
Gui, ContextClip: Add, Picture, x0 y%posyExit% W560 h32, Resources\Fondo_p.png
Gui, ContextClip: Add, Picture, x0 y%posyExit% W29 h32 gLabelSessionAct0, Resources\IConChange.png
Gui, ContextClip: Add, Picture, x30 y%posyExit% W435 h32 GuiMove, Resources\Resto1.png
;***********************************************************************
Gui1.Button7 := {} ;Button 7
Gui1.Button7.DefaultImage := "Resources\Reducedcap.png"
,Gui1.Button7.HoverImage := "Resources\Close.png"
Gui1.Button7.PressedImage := "Resources\Reducedcap1.png"
;Gui1.Button7.Label := "ReducedM"
Gui, ContextClip: Add, Picture, x487 y%posyExit% W72 h32 gReducedM hwndhwnd, % Gui1.Button7.DefaultImage
Gui1.Handles[ hwnd ] := "Button7" ;The name of the control to point at.
Gui1.Button7.Hwnd := hwnd
;***********************************************************************
Gui1.Button8 := {} ;Button 8
Gui1.Button8.DefaultImage := "Resources\Close.png"
,Gui1.Button8.HoverImage := "Resources\Close.png"
Gui1.Button8.PressedImage := "Resources\Close1.png"
Gui1.Button8.Label := "ExitLabel"
Gui, ContextClip: Add, Picture, x457 y%posyExit% W30 h32 hwndhwnd, % Gui1.Button8.DefaultImage
Gui1.Handles[ hwnd ] := "Button8" ;The name of the control to point at.
Gui1.Button8.Hwnd := hwnd
;***********************************************************************
Gui, ContextClip: Font, S9 Bold, Verdana
posyExitSess1 := posyExit+08
Gui, ContextClip: Add, Text, cYellow BackgroundTrans +Center x2 y%posyExitSess1% vTextTitle W536 h20, %SessClip%
MouseGetPos, xpos1, ypos1
If threeRButton=1
{
xpos1 := Floor((A_ScreenWidth/2)-450)
ypos1 := Floor((A_ScreenHeight/2)-200)
}
If ControlTwo=1
{
xpos1 := XActTwo-140
ypos1 := yActTwo-13
}
;xpos1 := xpos1-560
;ypos1 := ypos1-alto
AltoSess := Alto+12
Gui, ContextClip: Show, x%xpos1% y%ypos1% w560 h%AltoSess% ;Menu3s
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
OnMessage( 0x201 , "ButtonPress" )
Gosub, NewWindow
return
RButtonAlt:
threeRButton :=1
Gosub, RButton
Return
TitleEditing:
Gosub, NewWindow
StringTrimLeft, REdit, a_guicontrol, 7
FileChange := "HTMLTemp\Name" REdit ".txt"
FileRead, FileCont, %FileChange%
Gui, Edit: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Edit:+Owner
Gui, Edit: Font, S10 Bold, Verdana
Gui, Edit: Add, Picture, x0 y0 h20 w564 h32, Resources\Fondo_Limp.png
Gui, Edit: Add, Text, cYellow BackgroundTrans x35 y6 W560 h32 GuiMove, Clipboard Title
Gui, Edit: Add, Text, x0 y33 w563 0x10 ; 0x7 Black
Gui, Edit: Font, S8 Bold, Verdana
Gui, Edit:Add, Edit, x5 y40 w544 h20 vMyEdit, %FileCont%
;Gui, Edit: Add, Edit, x12 y9 w460 h20 vMyEdit%REdit%, %FileCont%
Gui, Edit:Add, Button, x20 y70 w70 h20 gTitleSave, OK
Gui, Edit:Add, Button, x120 y70 w70 h20 gTitleCancel, Cancel
Gui, Edit:Add, CheckBox, x240 y70 w210 h20 Checked1 vVeryfyChange, Change also the Title to Paste
EdXm := pXm-846
EdYm := pYm-148 ;96
Gui, Edit:Show, x%EdXm% y%EdYm% w564
Return
TitleSave:
Gui, Edit: Submit, Destroy
fileAdd := FileOpen(FileChange, "w")
fileAdd.Write(MyEdit)
fileAdd.Close()
If VeryfyChange=1
{
ReadURL := "HTMLTemp\URL" REdit ".txt"
Fileread URLTxt, %ReadURL%
ReadText:= "HTMLTemp\Text" REdit ".html"
FileDelete, %ReadText%
myResultSave := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" URLTxt ">" MyEdit "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResultSave%, %ReadText%
}
MyEdit :=""
FileCont :=""
FileChange :=""
Gosub, RButton
Return
TitleCancel:
Gui, Edit: Destroy
MyEdit :=""
FileCont :=""
FileChange :=""
;Gosub, NewWindow
Gosub, RButton
Return
ReducedM:
WinGetPos, XActOne, YActOne,,, A
Gui, ContextClip: Destroy
SoundPlay, Resources\Close Window.mp3
ControlOne :=1
ControlTwo :=0
Gosub, NotifyTrayClick_207
Return
NotifyTrayClick_207:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip1: Add, Button, x0 y%posy% w460 h20 gButtonTwo vTwoButton%A_Index%, %A_LoopReadLine%
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip1: Margin, 2, 2
Gui, ContextClip1: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd ;Menu31s
Gui, ContextClip1: color,ffffd6
;Gui, Font, S14 Bold, Verdana
Gui, ContextClip1:+Owner
Gui, ContextClip1: Add, Button, x20 y%posyExit% w380 h20 gExitLabel, Exit Menu
Gui, ContextClip1: Add, Button, x400 y%posyExit% w60 h20 hwndIcon20 gExtendedM
Gui, ContextClip1: Add, Text, x0 y%posyExit% w20 h20 GuiMove
Gui, ContextClip1: Add, Button, x0 y%posyExit% w20 h20 hwndIcon21
AltoT := Floor((CorpusCount+1)*31.5)
XPos:= A_ScreenWidth-(700)
YPos:= A_ScreenHeight-AltoT-60
If threeRButton=1
{
xpos := Floor((A_ScreenWidth/2)-450)
ypos := Floor((A_ScreenHeight/2)-200)
}
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
ExtendedM:
WinGetPos, XActTwo, YActTwo,,, A
Gui, ContextClip1: Destroy
SoundPlay, Resources\Close Window.mp3
ControlOne :=0
ControlTwo :=1
Gosub, RButton
Return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
ReducedAlt:
threeRButton :=1
Gosub, NotifyTrayClick_207
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: New
Gui, Help: -Caption
Gui, Help: +Owner
Gui, Help: Color, EEAA99
Gui, Help: Margin, 0, 0
Gui, Help: Add, Picture, x0 y0 w640 h250, Resources\Help.jpg
Gui, Help: Add, Button, x495 y209 w100 h30 gNextButton, More...
Gui, Help: Show, w640 h250
Return
NextButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: Destroy
Gui, Help2: New
Gui, Help2: -Caption
Gui, Help2: +Owner
Gui, Help2: Color, EEAA99
Gui, Help2: Margin, 0, 0
Gui, Help2: Add, Picture, x0 y0 w800 h397, Resources\Clipboard Utility Screenshot.jpg
Gui, Help2: Add, Button, x10 y340 w100 h30 gExitButton, Exit
Gui, Help2: Show, w800 h397
Return
ExitButton:
Gui, Help2: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Resources\Close Window.mp3
CopyButton=0
UtilButton :=0
Gui, Hide
Gui, CopyButtom:Hide
Return
;*************************************************************************
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace(status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
Gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
status_button_old:=status_button
return
;*************************************************************************
Deletealert:
if (status_delete=status_delete_old)
return
Gui, 4:default
Gui, destroy
NumberDelete:= RegExReplace(status_delete,"\D")
if !NumberDelete
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Delete Clipboard Number %NumberDelete%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 4:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 4:margin, 0, 0
Gui, 4:add, ActiveX, vWB w64 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
DelXm := pXm-944
GuiControl, Move, WB, h%maxBottom%
Gui, 4: Show, x%DelXm% y%pYm% w64 h60
status_delete_old:=status_delete
Return
;*************************************************************************
Copyalert:
if (status_Copy=status_Copy_old)
return
Gui, 6:default
Gui, destroy
NumberCopy:= RegExReplace(status_Copy,"\D")
if !NumberCopy
return
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Copy Item %NumberCopy% as Current Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 6:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 6:margin, 0, 0
Gui, 6:add, ActiveX, vWB w60 h72, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 6: Show, x%pXm% y%pYm% w60 h72
status_Copy_old:=status_Copy
Return
;*************************************************************************
URLalert:
if (status_URL=status_URL_old)
return
Gui, 5:default
Gui, destroy
NumberURL:= RegExReplace(status_URL,"\D")
URL_file := "HTMLTemp\URL" NumberURL ".txt"
if !URL_file
return
;Gui,2:Destroy
;URL_file := "HTMLTemp\URL" NumberURL ".txt"
FileRead, URLContents, %URL_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Go to: %URLContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 5:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 5:margin, 0, 0
Gui, 5:add, ActiveX, vWB w562 h30, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
DelXm := pXm-845
;DelXm := pXm-819
DelYm := pYm-47
;Gui, 5: Show, x%DelXm% y%DelYm% w543 h30
Gui, 5: Show, x%DelXm% y%DelYm% w562 h30
status_URL_old:=status_URL
Return
;*************************************************************************
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace(status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Gui,5:Destroy
FileRead, FileContents, %Text_file%
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 3:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 3:margin, 0, 0
Gui, 3:add, ActiveX, vWB w320 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
;*************************************************************************
Editingalert:
if (status_Editing=status_Editing_old)
return
Gui, 6:default
Gui, destroy
EditingNumber:= RegExReplace(status_Editing,"\D")
if !EditingNumber
return
Gui,2:Destroy
Gui,5:Destroy
Html =
(
<html><head><Style>
body {background-color: #ffffeb; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Edit Title of the %EditingNumber%th Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 7: +AlwaysOnTop -Caption +ToolWindow Border
;Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui, 7:margin, 0, 0
gui, 7:add, ActiveX, vWB w62 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
;DelXm := pXm-953
GuiControl, Move, WB, h%maxBottom%
gui, 7: Show, x%pXm% y%pYm% w62 h60
status_Editing_old:=status_Editing
Return
;*************************************************************************
^F6::
ControlPaste:
MsgBox, 0x1034,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Utily: Destroy
;Gui, Hide
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Resources\Close Window.mp3
Return
^F10::
DeleteAll:
MsgBox, 0x1034,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
SavePDF:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, Utily: Destroy
Sleep, 1000
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, Resources\PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
PDFCount++
FormatTime, CurrentDate,, dd-MM-yyyy
Filedate := "Documents\Final_Document_" CurrentDate "-" PDFCount ".pdf"
Filedateh := "Documents\ToPDF_" CurrentDate "-" PDFCount ".html"
FileMove, Final_Document.pdf, %Filedate%
Run, %Filedate%
FileMove, ToPDF.html, %Filedateh%
;FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Return
^F7::
SaveWord:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a Word File?
IfMsgBox No
Return
Else
Gui, Utily: Destroy
Sleep, 1000
;ToolTip, Saving clipboard to docx file...
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToWord.html, CP65001
;FileRead, Line1, Resources\WordLine.html
;FileAppend, %Line1%, ToWord.html, CP65001
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToWord.html, CP65001
FileRead, Line2, Resources\WordLine.html
FileAppend, %Line2%, ToWord.html, CP65001
}
}
WinClip.Clear()
html := FileOpen("ToWord.html", "r").read()
WinClip.SetHTML(html)
Filedelete, WorkingDir.txt
FileAppend, %A_ScriptDir%\, WorkingDir.txt
FileRead, ScriptDir, Workingdir.txt
Clip:= ScriptDir "Word.docx"
ClipToDoc( clip )
WordCount++
FormatTime, CurrentDate,, dd-MM-yyyy
FileWord := ScriptDir "\Documents\Final_Document_" CurrentDate "-" WordCount ".docx"
FileMove, Word.docx, %FileWord%
Run, %FileWord%
FileDelete, ToWord.html
Return
^F11::
;^!z::
DeleteLast:
MsgBox, 0x1034,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
;FileDelete, HTMLTemp\*%CorpusCount%.*
FileDelete, HTMLTemp\Corpus%CorpusCount%.html
FileDelete, HTMLTemp\image%CorpusCount%.jpg
FileDelete, HTMLTemp\Name%CorpusCount%.txt
FileDelete, HTMLTemp\Text%CorpusCount%.html
FileDelete, HTMLTemp\TextPlain%CorpusCount%.txt
FileDelete, HTMLTemp\URL%CorpusCount%.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
;CorpusCount--
Return
^Esc::
Exit:
ExitApp
Return
Borrado:
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, LabelSessionAct1
CorpusCount :=0
;Gosub, ReloadSession
Gosub, ReloadMenu
Return
ButtonTwo:
StringTrimLeft, NumberFile, a_guicontrol, 9
;Gui, 2: Destroy
;Gui, ContextClip: Destroy
Gosub, ButtonLabel
Return
LabelSession:
;NumberFile:=A_ThisMenuItemPos
;Menu, tray, ToggleCheck, &Suspend Hotkeys
;Menu, tray, ToggleCheck, Clipboard Sessions
MsgBox, 0x1024,, You want the session %A_ThisMenuItem% to be the default session?
IfMsgBox No
Return
;Loop, %DirectoryCount%
/*
if !FileExist("HTMLTemp" A_Index)
{
;NumberDir : %A_Index%
MoveDir := "HTMLTemp" A_Index
}
MsgBox, %MoveDir%
*/
FileDelete, SessionTemp*.txt
FileDelete, SessionTemp00.txt
FileDelete, SessionTemp01.txt
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
NumSess := A_Index-1
NumberPos:= A_ThisMenuItemPos-3
;MsgBox, %NumberPos%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp"
FileAppend, %FileSession%, SessionTemp.txt
FileAppend, %A_ScriptDir%, SessionTemp00.txt
FileSession2 := "\HTMLTemp00"
FileAppend, %FileSession2%, SessionTemp00.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;FileMove %DirectorySess%, %DirectorySess00%
FileMoveDir %DirectorySess%, %DirectorySess00%, R
;DirectorySess :=""
;DirectorySess00 :=""
FileAppend, %A_ScriptDir%, SessionTemp01.txt
FileSession3 := "\HTMLTemp" NumberPos
FileAppend, %FileSession3%, SessionTemp01.txt
FileRead, DirectorySess01, SessionTemp01.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;MsgBox, %DirectorySess01%`n%DirectorySess%
FileMoveDir %DirectorySess01%, %DirectorySess%, R
FileMoveDir %DirectorySess00%, %DirectorySess01%, R
Menu, SessionID, DeleteAll
Menu, ClipboardID, DeleteAll
Iniciate:=0
Gosub, ReloadSession
Return
ButtonLabelTray:
If CorpusCount=0
Return
NumberFile:=A_ThisMenuItemPos
Gosub, ButtonLabel
Return
ButtonLabel:
;NumberFile:= RegExReplace(NameTwo,"\D")
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
SoundPlay, Resources\Close Window.mp3
Gui, ContextClip1: Destroy
Gui, ContextClip: Destroy
;Gui, Destroy
Gui,2: Destroy
Gui, Gui1: Destroy
;Gui, 2:default
;Gui, destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
ControlOne :=0
ControlTwo :=0
threeRButton :=0
Alto:=0
Return
TxtLabel:
SoundPlay, Resources\Clipboard_Sound.mp3
StringTrimLeft, TextCopy, a_guicontrol, 5
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
Return
TxtPlane:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
global status_Delete ,tme
global status_URL ,tme
global status_Copy ,tme
global status_Editing ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
status_Delete:=""
status_URL:=""
status_Copy:=""
status_Editing:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
if instr(a_guicontrol,"Delete")
{
status_Delete:=a_guicontrol
SetTimer, Deletealert,-20
}
if instr(a_guicontrol,"URL")
{
status_URL:=a_guicontrol
SetTimer, URLalert,-20
}
if instr(a_guicontrol,"Copy")
{
status_Copy:=a_guicontrol
SetTimer, Copyalert,-20
}
if instr(a_guicontrol,"Editing")
{
status_Editing:=a_guicontrol
SetTimer, Editingalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
status_Delete_old:=""
status_URL_old:=""
status_Copy_old:=""
status_Editing_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
URLButton:
SoundPlay, Resources\Close Window.mp3
MsgBox, 0x1024,, Extract URL's from Clipboards?
IfMsgBox No
Return
Else
Gui, Utily: Destroy
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
}
}
Gosub, ExtractURL
FileDelete, ToPDF.html
Return
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
Return True
}
;************************************************************************************************************************
ExtractURL:
;Create header html document
FileAppend,
(
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=AutoHotkey.File>
<meta name=Generator content="AutoHotkey">
</head>
<body lang=es style='font-family:Calibri;font-size:11.0pt'>
), Extracted_Links.html
FormatTime, CurrentDate,, dd-MM-yyyy
DateIncl := "<p style='margin:0in'><span style='font-family:Times New Roman;font-size:11.0pt;color:#1E4D78'>Clipboard Session URLs: </span><span style='font-weight:bold;font-family:Calibri;font-size:12.0pt;color:#860000'>" CurrentDate "</span></p>"
FileAppend, %DateIncl%, Extracted_Links.html
;Add Line
myResult := "<p style='margin:0in;font-family:Calibri;font-size:11.0pt;color:#78230C'><p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>`r
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>`r"
FileAppend, %myResult%, Extracted_Links.html
;Routine loop, origin: https://www.autohotkey.com/docs/commands/LoopReadFile.htm
LinkCount := 0
ImgCount := 0
Loop, read, ToPDF.html, Extracted_Links.html
{
URLSearchString := A_LoopReadLine
Gosub, URLSearch
}
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links.html
Loop, read, Extracted_Links.html
{
If A_Index < 11
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
if A_Index > 11
if RegExMatch(A_LoopReadLine, "\.(jpg<|jpeg<|png<|gif<|svg<)")
{
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
ImgCount++ ; increment by one
}
else If InStr(A_LoopReadLine, "</ul>", True) and A_Index > 17
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links_Img.html
}
;URL number message, Optional
MsgBox %LinkCount% links were found and written to "Extracted_Links.html" `n %ImgCount% Images were found and written to "Extracted_Links_Img.html"
;Opcional, opens the result
FormatTime, CurrentDate,, dd-MM-yyyy
FileURL := "Documents\Extracted_Links_" CurrentDate ".html"
FileURLImg := "Documents\Extracted_Links_Img_" CurrentDate ".html"
FileMove, Extracted_Links.html, %FileURL%
FileMove, Extracted_Links_Img.html, %FileURLImg%
FileDelete, ToPDF.html
Run, %FileURL%
Run, %FileURLImg%
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
URLStart1 := InStr(URLSearchString, "https://")
URLStart2 := InStr(URLSearchString, "http://")
URLStart3 := InStr(URLSearchString, "ftp://")
URLStart4 := InStr(URLSearchString, "www.")
; Find the left-most starting position:
URLStart := URLStart1 ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
ArrayElement := URLStart%A_Index%
if (ArrayElement = "") ; End of the pseudo-array has been reached.
break
if (ArrayElement = 0) ; This element is disqualified.
continue
if (URLStart = 0)
URLStart := ArrayElement
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if (ArrayElement != 0)
if (ArrayElement < URLStart)
URLStart := ArrayElement
}
}
if (URLStart = 0) ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
URL := SubStr(URLSearchString, URLStart) ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%<> ; Find the first space, tab, or angle (if any).
{
URL := A_LoopField
break ; i.e. perform only one loop iteration to fetch the first "field".
}
StringReplace, URLCleansed, URL, ",, All
; Makes a second check to replace extraneous signs.
FixString := % URLCleansed
vList := "
(
%21 !
%23 #
%24 $
%26 &
%27 '
%28 (
%29 )
%2A *
%2B +
%2C ,
%3B ;
%2F /
%3A :
%3D =
%3F ?
%40 @
%5B [
%5D ]
%20
%C2%B4 ´
%2E .
%25 %
%2D -
%3C <
%3E >
%5C \
%5E ^
%5F _
%60 `
%7B {
%7C |
%7D }
%7E ~
%22 ""
\/ \
)"
Loop, Parse, vList, `n
{
oTemp := StrSplit(A_LoopField, "`t")
FixString := StrReplace(FixString, oTemp.1, oTemp.2)
}
oTemp := ""
ClipBoard := "<li style='margin-top:0;margin-bottom:0;vertical-align:middle'><p style='margin:0in;font-family:Calibri;font-size:10.0pt'><a href=" FixString ">" FixString "</a></p></li>"
FileAppend, %ClipBoard%`n
LinkCount += 1
; See if there are any other URLs in this line:
CharactersToOmit := StrLen(URL)
CharactersToOmit += URLStart
URLSearchString := SubStr(URLSearchString, CharactersToOmit)
Gosub, URLSearch ; Recursive call to self.
return
;**********************************************************************************************
^F1::
CaseMenu:
Menu Case, Add
Menu Case, DeleteAll
Menu Case, Add, &UPPERCASE, CCase
Menu Case, Add, &lowercase, CCase
Menu Case, Add, &Title Case, CCase
Menu Case, Add, &a Title to Case, CCase
Menu Case, Add, &Sentence case, CCase
Menu Case, Add
Menu Case, Add, &Remove Spaces, CCase
GetText(Txt)
If NOT ERRORLEVEL
Menu Case, Show
Return
CCase:
p:=A_ThisMenuItemPos
If (p=1)
StringUpper, Txt, Txt
Else If (p=2)
StringLower, Txt, Txt
Else If (p=3)
StringLower, Txt, Txt, T
Else If (p=4)
{
StringLower, Txt, Txt
;IMPORTANT! Change short words to be replaced in the following list according to each language or add more
lowers := ["a", "ha", "el", "y", "pero", "o", "para", "las", "es", "para", "por", "los", "con", "en", "que", "un", "de", "del", "la", "una", "cada", "en", "al", "por", "uno", "mi", "tu", "tú", "no", "ni", "sin", "se", "lo", "e", "su", "sí", "ser", "hay"]
for k, v in lowers
low .= (k = 1 ? "" : "|") . v
;Txt := RegExReplace(Txt, "(*UCP)(^\b|\b(?!(" . low . ")\b))\w+\b|\b\w+\b$", "$T0")
;Txt := RegExReplace(Txt, "((?:^|[.!?-]\s+)[a-z])", "$u1")
Txt := RegExReplace(Txt, "(*UCP)(^|\b(?!(" . low . ")\b))\w|(\.|\?|!)\s*\K\w|-\K\w", "$T0")
}
Else If (p=5)
{
StringLower, Txt, Txt
Txt := RegExReplace(Txt, "((?:^|[.!?]\s+)[a-z])", "$u1")
}
Else If (p=7)
{
Loop
{
StringReplace, Txt, Txt, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0
break
}
}
PutText(Txt)
Return
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^{vk43} ;Ctrl C
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard =
Sleep 20
Clipboard := MyText
Send ^{vk56} ;Ctrl V
Sleep 100
Clipboard := SavedClip
Return
}
ClipToDoc(FileName) {
oWord := ComObjCreate("Word.Application")
Document := oWord.Documents.Add
; oWord.Selection.Paste
oWord.Selection.PasteAndFormat(16) ; wdFormatOriginalFormatting = 16
Document.SaveAs(FileName)
Document.Close()
oWord.Quit
}
GetImageSize(imageFilePath) {
if !hBitmap := LoadPicture(imageFilePath, "GDI+")
throw "Failed to load the image"
VarSetCapacity(BITMAP, size := 4*4 + A_PtrSize*2, 0)
DllCall("GetObject", "Ptr", hBitmap, "Int", size, "Ptr", &BITMAP)
DllCall("DeleteObject", "Ptr", hBitmap)
Return { W: NumGet(BITMAP, 4, "UInt"), H: NumGet(BITMAP, 8, "UInt") }
}
crop(FilePath, x, y, w, h) {
static IP
img := ComObjCreate("WIA.ImageFile")
img.LoadFile(FilePath)
if (!IP) {
IP:=ComObjCreate("WIA.ImageProcess")
ip.Filters.Add(IP.FilterInfos("Crop").FilterID)
}
; x,y,r,b are the number of pixels to crop from each edge. They cannot be negative numbers.
ip.filters[1].properties("Left") := x
ip.filters[1].properties("Top") := y
if ((r := img.width - w - x) < 1)
r := 0
if ((b := img.height - h - y) < 1)
b := 0
ip.filters[1].properties("Right") := r
ip.filters[1].properties("Bottom") := b
img := IP.Apply(img)
FileDelete, %FilePath%
while FileExist(FilePath)
Sleep, 10
img.SaveFile(FilePath)
return
}
;*******************************************************************************
Nothing:
Run, https://www.autohotkey.com/boards/viewtopic.php?t=92963
Return
Tray_Open:
ListLines
return
^!F4::
NewSession:
Gui, Session: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, Session:+Owner
Gui, Session: Font, S10 Bold, Verdana
Gui, Session: Add, Picture, x0 y0 h20 w562 h32, Resources\Fondo_Limp.png
Gui, Session: Add, Text, cYellow BackgroundTrans x35 y6 W560 h32 GuiMove, Session Name
;Gui, RenSession: Add, Text, x5 y6 h20 w549, Session Name:
Gui, Session: Add, Text, x0 y33 w563 0x10 ; 0x7 Black
Gui, Session: Font, S8 Bold, Verdana
Gui, Session: Add, Edit, x5 y40 vSessEdit h20 w544, New Session
Gui Session:Add, Button, x20 y70 w70 h20 gSessionSave, OK
Gui Session:Add, Button, x120 y70 w70 h20 gSessCancel, Cancel
xSess := Floor((A_ScreenWidth/2)-448)
ySess := Floor((A_ScreenHeight/2)-200)
Gui, Session: Show, x%xSess% y%ySess% w562
Return
SessionSave:
FileDelete, SessionTemp.txt
Gui, Session: Submit
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal1 := A_Index
FileCreateDir, HTMLTemp%SessionTotal1%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp" SessionTotal1 "\Session.txt"
FileAppend, %FileSession%, SessionTemp.txt
;Sleep, 3500
FileRead, Directory, SessionTemp.txt
FileAppend, %SessEdit%, %Directory%
Menu, SessionID, DeleteAll
Iniciate:=1
;Gosub, NewWindow
SessEdit :=""
Gosub, ReloadSession
Return
SessCancel:
Gui, Session:Destroy
Gui, RenSession:Destroy
SessEdit :=""
ReSessEdit :=""
Gosub, RButton
Return
LabelSessionAct0:
Position :=0
Gosub, LabelSessionAct
Return
LabelSessionAct1:
Position :=1
;MsgBox, HOLA!!!
Gosub, LabelSessionAct
Return
LabelSessionAct:
Gosub, NewWindow
ReadSess := "HTMLTemp\Session.txt"
FileRead, RenSession, %ReadSess%
Gui, RenSession: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
Gui, RenSession:+Owner
Gui, RenSession: Font, S10 Bold, Verdana
Gui, RenSession: Add, Picture, x0 y0 h20 w564 h32, Resources\Fondo_Limp.png
Gui, RenSession: Add, Text, cYellow BackgroundTrans x35 y6 W560 h32 GuiMove, Session Name
;Gui, RenSession: Add, Text, x5 y6 h20 w549, Session Name:
Gui, RenSession: Add, Text, x0 y33 w563 0x10 ; 0x7 Black
Gui, RenSession: Font, S8 Bold, Verdana
Gui, RenSession: Add, Edit, x5 y40 vReSessEdit h20 w544, %RenSession%
Gui RenSession:Add, Button, x20 y70 w70 h20 gRenSessionSave, OK
Gui RenSession:Add, Button, x120 y70 w70 h20 gSessCancel, Cancel
If Position=0
{
xSess := pXm-846
ySess := pYm-148 ;96
}
If Position=1
{
xSess := Floor((A_ScreenWidth/2)-448)
ySess := Floor((A_ScreenHeight/2)-200)
}
Gui, RenSession: Show, x%xSess% y%ySess% w564
Return
RenSessionSave:
Gui, RenSession: Submit
FileDelete, HTMLTemp\Session.txt
FileAppend, %ReSessEdit%, HTMLTemp\Session.txt
ReSessEdit :=""
Gosub, RButton
Return
/*
Paused:
Paused:=!Paused
IfEqual,Paused,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Orange.ico
IfEqual,Paused,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Pause Script
Menu,Tray,Icon,,,1
Pause,Toggle,1
Return
*/
^F12::
Stanby:
Suspend:=!Suspend
IfEqual,Suspend,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Red.ico
IfEqual,Suspend,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Suspend Hotkeys
Menu,Tray,Icon,,,1
Suspend,Toggle
Return
SuspendThumbnail:
Menu, ThumbnailID, ToggleCheck, Postpone Thumbnail Creation
xSplash1 := A_ScreenWidth-506
ySplash1 := A_ScreenHeight-180
If SuspendThumbnail=0
{
SuspendThumbnail:=1
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Thumbnail Creation Disabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
else
{
SuspendThumbnail:=0
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Thumbnail Creation Enabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
Return
CreateMissing:
CountImg := 0
Loop, %CorpusCount%
if !FileExist("HTMLTemp\Image" A_Index ".jpg")
{
Corpus := A_ScriptDir "\HTMLTemp\Corpus" A_Index ".html"
;MsgBox, %Corpus%
Filecopy %Corpus%, CorpusTemp.html
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 CorpusTemp.html Image_Temp.jpg,,hide
Gosub, ResizeH
ImageCount1 := "HTMLTemp\Image" A_Index ".jpg"
FileMove, Image_Temp.jpg, %ImageCount1%
FileDelete, CorpusTemp.html
CountImg++
}
If CountImg=0
{
MsgBox, All Clipboard already have Thumbnails.
}
Else
{
MsgBox, Finished process.`n`n %CountImg% Thumbnail(s) has been Created.
}
Return
/*
;Loop, 6
MsgBox, %CorpusCount%
Loop, %CorpusCount%
if !FileExist("HTMLTemp\Image" A_Index ".jpg")
{
MsgBox, No existe Imagen %A_Index%
}
;Else
;{
;MsgBox, Sí existe Imagen %A_Index%
;}
idx = 0
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
;MsgBox, %CorpusCount% - %A_Index% - %idx%
Loop, %CorpusCount%
idx++
;MsgBox, %CorpusCount% - %A_Index% - %idx%
;Imagecheck :="HTMLTemp\Image" A_Index ".jpg"
if !FileExist("h:\Download\Script\MultiClipboard Preview 4.1n\HTMLTemp\Image" A_Index ".jpg")
{
MsgBox, No existe Imagen %A_Index% %idx%
}
*/
EditScript:
Run Edit %A_ScriptName%
Return
^!F7::
Reloaded:
Reload
Return
/*
^!F3::
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
^!F3::
Loop, read, SesionName.txt
{
Menu, MyMenu, add,%A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
;Menu, MyMenu, add, Clipboard, ButtonLabelTray
;Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
Menu, MyMenu, Color, FFFFFF
Menu, MyMenu, show
;}
Return
*/
^!F3::
;Loop, Parse, MyListBox, |
;Loop, read, SesionName.txt
;{
Gui, -Caption
Gui, Color, ffffd6
;Gui, Font, S12 Bold, Verdana
Gui, Font, s9, Segoe UI
Gui, Add, ListBox, vsesion w470 h225
;Gui, Add, ListBox, r5, Red|Green|Blue|Black|White
;Gui, MiListBox:Add, ListBox, r5 vColorChoice, %A_LoopReadLine%
;MsgBox Selection number %A_Index% is %A_LoopField%.
;}
Loop, read, SesionName.txt
{
GuiControl,, sesion, %A_LoopReadLine%
}
Gui, Show
/*
;To cancel, press ESCAPE or close this window.
Gui, Add, ListBox, vListBox_pdf x16 y10 w370 h125,
Gui, Add, ListBox, vListBox_ini x16 y145 w370 h125,
Gui, Add, Button, Default, OK
;----------------------------- Start Fill Listboxs
Loop, C:\temp\*.pdf
{
GuiControl,, ListBox_pdf, %A_LoopFileFullPath%
}
Loop, C:\*.ini
{
GuiControl,, ListBox_ini, %A_LoopFileFullPath%
}
Gui, Show
*/
NotifyTrayClick_201:
;xSplash := Floor((A_ScreenWidth/2)-450)
;ySplash := Floor((A_ScreenHeight/2)-200)
xSplash := A_ScreenWidth-506
ySplash := A_ScreenHeight-180
SplashTextOn, 500, 80, Content of the current clipboard, %Clipboard%
WinMove, Content of the current clipboard,, xSplash, ySplash
;SplashTextOn,,, Displays only a title bar.
Sleep, 1000
SplashTextOff
;SplashTextOn,,, %Clipboard%
;WinMove,,, xSplash, ySplash
;Sleep, 1000
;SplashTextOff
Return
Code: Select all
;https://www.autohotkey.com/boards/viewtopic.php?f=76&t=92963
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
;EnvSet, SD, %A_ScriptDir%
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
#Include Library\ViewHtml.ahk
#Include Library\Gdip_All_1.45.ahk
#Include Library\PUM.ahk
#Include Library\PUM_API.ahk
;#Include Library\ToolTipEx.ahk
#SingleInstance, Force
#InstallMousehook
#Persistent
CoordMode, Mouse, Screen
SetBatchLines, -1
Name := "Clipboard Utility - "
Version := "4.2m"
StartTicks:=A_TickCount
ClipBoardHistory:=Object()
ClipBoardEnabled=1
previousClip=%clipboard%
NotifyClip := 1
CorpusCount := 0
DirectoryCount := 0
Iniciate := 0
PDFCount := 0
WordCount := 0
SuspendThumbnail := 0
if !FileExist(HTMLTemp)
{
FileCreateDir, HTMLTemp
}
if !FileExist(TempClip)
{
FileCreateDir, TempClip
}
;Hotkey, LButton Up, off
;loop, HTMLTemp\Corpus*.html
;CorpusCount := % Floor(A_Index)
if FileExist("TempClip\Clip1.clip")
{
Loop, TempClip\Clip*.clip
NumberClip := A_Index
;MsgBox, %NumberClip%
Loop, %NumberClip%
{
ReadClip:= "TempClip\Clip" A_Index ".clip"
FileRead, ClipHsy, %ReadClip%
FileDelete, %ReadClip%
ClipSave(ClipBoardHistory, ClipHsy, A_Index)
}
}
;***************************************************************************************************************************
;Parameters of the PUM object, the manager of the menus
pumParams := { "SelMethod" : "fill" ;item selection method, may be frame,fill
,"selTColor" : 0xFFFFFF ;selection text color
,"selBGColor" : 0x036FC5 ;selection background color, -1 means invert current color
,"oninit" : "PUM_out" ;function which will be called when any of this events happen, se it below
,"onuninit" : "PUM_out"
,"onselect" : "PUM_out"
,"onrbutton" : "PUM_out"
,"onmbutton" : "PUM_out"
,"onrun" : "PUM_out" }
;PUM_Menu parameters
menuParams1 := { "bgcolor" : 0xFFFFF4 ;background color of the menu R
, "iconssize" : 0 ;size of icons in the menu
, "tcolor" : 0x0b7fac} ; text color of the menu items
;create an instance of PUM object, it is best to have only one of such in the program
pm := new PUM( pumParams )
PUM_out( msg, obj )
{
; if ( msg = "onselect" )
; tooltip % obj.tooltip
; if ( msg = "oninit" )
; tooltip % "menu init: " obj.handle
; if ( msg = "onuninit" )
; tooltip % "menu uninit: " obj.handle
; if ( msg = "onrbutton" )
; tooltip % "Right clicked: " obj.name
; if ( msg = "onmbutton" )
; tooltip % "Middle clicked: " obj.name
; if ( msg = "onrun" )
; tooltip % "Item runned: " obj.name
}
;***************************************************************************************************************************
Menu, Tray, Icon, Resources\Scissors_Green.ico
Menu, Tray, NoStandard
Menu, tray, Add, %name% %version%, Nothing
Menu, tray, Icon, %name% %version%, Resources\Clipboard Utility.ico
Menu, Tray, Add
Menu, tray, Add, Exit , Exit
Menu, tray, Icon, Exit , shell32.dll, 132
Menu, Tray, Add
Menu, tray, Add, &Suspend Hotkeys , Stanby
Menu, tray, Icon,&Suspend Hotkeys , %A_ScriptDir%\Resources\Scissors_Red.ico
Menu, Tray, Add
Menu, Tray, Add, Help, HelpButton
Menu, Tray, Icon, Help, %A_ScriptDir%\Resources\Help.ico
Menu, Tray, Add
Menu Tray, Add, Open Info, Tray_Open
Menu Tray, Icon, Open Info, %A_ScriptDir%\Resources\Info.ico
Menu, tray, Add, &Reload this Script , Reloaded
Menu, tray, Icon,&Reload this Script , %A_ScriptDir%\Resources\2488.ico
Menu, tray, Add, &Edit this Script , EditScript
Menu, tray, Icon,&Edit this Script , comres.dll, 7
Menu, tray, Add
Menu, winmanagetID, Add, Clipboard Window Extended, RButtonAlt
Menu, winmanagetID, icon, Clipboard Window Extended, %A_ScriptDir%\Resources\162.ico
Menu, winmanagetID, Add, Clipboard Window Reduced, ReducedAlt
Menu, winmanagetID, icon, Clipboard Window Reduced, %A_ScriptDir%\Resources\Clipboard Utility.ico
Menu, winmanagetID, Add, Utility Window, WUtil
Menu, winmanagetID, icon, Utility Window, %A_ScriptDir%\Resources\75a.ico
Menu, winmanagetID, Add, Copy Clipboard Window, CopyGui
Menu, winmanagetID, icon, Copy Clipboard Window, Resources\Clipboard Utility 5.ico
Menu, Tray, add, Window Management, :winmanagetID
Menu, tray, Icon, Window Management, %A_ScriptDir%\Resources\2036.ico
Menu, BasicClipID, Add, Disable Basic Clipboard, SuspendBasicClip
Menu, BasicClipID, Icon, Disable Basic Clipboard, Resources\Clipboard Utility 4.ico
Menu, BasicClipID, Add, Deactivate Notifications in Tray, SuspendNotifClip
Menu, BasicClipID, Icon, Deactivate Notifications in Tray, Resources\No_Sound.ico
Menu, BasicClipID, Add, Delete all Basic Clipboard, DeleteBasic
Menu, BasicClipID, Icon, Delete all Basic Clipboard, Resources\Recycle 2.ico
Menu, Tray, Add, Basic Clipboard, :BasicClipID
Menu, Tray, Icon, Basic Clipboard, Resources\Clipboard-Blue.ico
Menu, tray, Add
Menu, Tray, Add, Save all Clipboard to PDF File, SavePDF
Menu, Tray, Icon, Save all Clipboard to PDF File, %A_ScriptDir%\Resources\PDF.ico
Menu, Tray, Add, Save all Clipboard to Word File, SaveWord
Menu, Tray, Icon, Save all Clipboard to Word File, %A_ScriptDir%\Resources\Word1.ico
Menu, Tray, Add, Extract URL's from Clipboard, URLButton
Menu, Tray, Icon, Extract URL's from Clipboard, %A_ScriptDir%\Resources\URL.ico
Menu, ThumbnailID, Add, Postpone Thumbnail Creation, SuspendThumbnail
Menu, ThumbnailID, Icon, Postpone Thumbnail Creation, %A_ScriptDir%\Resources\1908.ico
Menu, ThumbnailID, Add, Create Missing Thumbnails, CreateMissing
Menu, ThumbnailID, Icon, Create Missing Thumbnails, %A_ScriptDir%\Resources\949.ico
Menu, Tray, Add, Thumbnail Creation, :ThumbnailID
Menu, Tray, Icon, Thumbnail Creation, %A_ScriptDir%\Resources\989.ico
Menu, DeleteID, Add, Delete Last Clipboard, DeleteLast
Menu, DeleteID, Icon, Delete Last Clipboard, %A_ScriptDir%\Resources\1892.ico
Menu, DeleteID, Add, Delete All Clipboard, DeleteAll
Menu, DeleteID, Icon, Delete All Clipboard, %A_ScriptDir%\Resources\Recycle Bin Full.ico
Menu, Tray, add, Delete Options, :DeleteID
Menu, tray, Icon, Delete Options, %A_ScriptDir%\Resources\Recycle 3.ico
Menu, Tray, add
;**********************************************************************************************
ReloadSession:
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal := A_Index-1
FileDelete, SessionNumber.txt
;If !CorpusCount=0
;{
NumberSessTemp := "HTMLTemp\Session.txt"
FileRead, Session1, %NumberSessTemp%
; Fileappend, %Session1% `n, SessionNumber.txt
;Menu, SessionID, add, %Session1%, LabelSessionAct1
;Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2293.ico
;Menu, SessionID, add
Menu, SessionID, add, Create New Session, NewSession
Menu, SessionID, Icon, Create New Session, %A_ScriptDir%\Resources\178.ico
Menu, SessionID, add, Delete Empty Sessions, DeleteSessions
Menu, SessionID, Icon, Delete Empty Sessions, %A_ScriptDir%\Resources\Recycle 2.ico
Menu, SessionID, add
Menu, SessionID, add, 0: %Session1%, LabelSessionAct1
Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2478.ico
;Menu, SessionID, add, Current Session, LabelSessionAct0
;Menu, SessionID, Icon, Current Session, %A_ScriptDir%\Resources\2478.ico
;************************************************************************
loop, %SessionTotal%
{
FileDelete, SessionCount.txt
FileAppend, %A_ScriptDir%, SessionCount.txt
FullFile:="\HTMLTemp" A_Index "\*.*"
FileAppend, %FullFile%, SessionCount.txt
FileRead, CountFiles, SessionCount.txt
loop, %CountFiles%
FilesCount := % Floor(A_Index/6)
;If FilesCount="" FilesCount=0
NameTemp := ScriptDir "HTMLTemp" A_Index "\Session.txt"
FileRead, Session1, %NameTemp%
Fileappend, %Session1% — %FilesCount% Clipboards`n, SessionNumber.txt
}
Loop, read, SessionNumber.txt
{
Menu, SessionID, add, %A_Index%: %A_LoopReadLine%, LabelSession
}
Menu, Tray, add, Clipboard Sessions, :SessionID
Menu, Tray, Icon, Clipboard Sessions, %A_ScriptDir%\Resources\2036.ico
;**********************************************************************
ReloadMenu:
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
Menu, ClipboardID, add, %A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
Menu, Tray, add, Clipboard, :ClipboardID
Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
}
Menu, Tray, Default, Basic Clipboard
;Menu, Tray, Default, Window Management
;Menu, Tray, Tip, Clipboard Utility 4.1f
Menu, Tray, Tip, This Session has 0%CorpusCount% Clipboards
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption +Owner
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
;Gui, CopyButtom:+Owner
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, Resources\PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, Resources\PauseOff.png
GuiButtonIcon(Icon, "Resources\Clipboard Utility 5.ico", 1, "s90")
/*
if FileExist("HTMLTemp\Text1.html")
MsgBox, 0x1034,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
*/
GoSub, Toggle_Switch
CorpusCount := 0
;DirectoryCount := 0
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
DirectoryCount := A_Index-1
;MsgBox, %DirectoryCount%
Filedelete, WorkingDir.txt
FileAppend, %A_ScriptDir%\, WorkingDir.txt
FileRead, ScriptDir, Workingdir.txt
threeRButton=1
loop, Documents\*.pdf
PDFCount := A_Index
If PDFCount != 0
{
PDFCount := PDFCount+1
}
;MsgBox, %PDFCount%
loop, Documents\*.docx
WordCount := A_Index
If WordCount != 0
{
WordCount := WordCount+1
}
If Iniciate=1
{
Return
}
;If !Iniciate=1
Gosub, RButton
Return
^Up::
;^!v::
MouseGetPos,,, WinUMID
menu := pm.CreateMenu( menuParams1 )
index:=ClipBoardHistory.maxIndex()
if index=
return
while Index>=ClipBoardHistory.minIndex()
{
Description:=ClipBoardHistory[Index]["plain"]
FullDescription:=Description
;if(StrLen(Description)>35)
if(StrLen(Description)>80)
{
;toCut:=StrLen(Description)-18
toCut:=StrLen(Description)-50
StringMid, itemTemp1, Description, 1, 12
StringTrimLeft, itemTemp2, Description, %toCut%
Description=%itemTemp1%...%itemTemp2%
}
if index<10
MenuString:="&" . (ClipBoardHistory.maxindex()-Index+1) . ". " . Description
else
MenuString:= (ClipBoardHistory.maxindex()-Index+1) . ". " . Description
menu.Add( { "name" : MenuString
, "bold" : 1
, "index" : Index
, "tooltip" : ClipBoardHistory[Index]["plain"]})
index--
}
;WinGet, ActiveWindow , ID, A
MouseGetPos, xpos5, ypos5
; item := menu.Show( A_ScreenWidth/3, A_ScreenHeight/3 )
item := menu.Show( xpos5, ypos5 )
;tooltip
WinActivate, ahk_id %WinUMID%
;WinActivate , ahk_id %ActiveWindow%
;WinWaitActive, ahk_id %ActiveWindow%
if item
{
ClipBoardEnabled=0
test:=item.index
tempClip:=clipboard
clipboard:=
clipboard:=ClipBoardHistory[test]["plain"]
;MsgBox, %clipboard%
;Sleep, 1500
send, ^v
Sleep, 1500
clipboard:=tempClip
ClipBoardEnabled=1
}
Menu.destroy()
return
^F4::
GuiUtily:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd +Owner
Gui, Utily: -Caption HwndHwnd +Owner
;Gui, Utily: +Owner
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Utily: Add, Picture, x0 y0 w739 h167, Resources\Clipboard Utility_p_2.png
;Gui, Add, Text, x0 y0 w691 h35 GuiMove ; , `&& Drag
Gui, Utily: Add, Picture, x0 y0 w691 h35 GuiMove, Resources\ArribaIzq1.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "Resources\PDFup.png"
Gui1.Button1.HoverImage := "Resources\PDFhover.png"
Gui1.Button1.PressedImage := "Resources\PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Utily: Add, Picture, x12 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "Resources\WordUp.png"
Gui1.Button2.HoverImage := "Resources\WordOver.png"
Gui1.Button2.PressedImage := "Resources\WordDown.png"
Gui1.Button2.Label := "SaveWord"
Gui, Utily: Add, Picture, x154 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "Resources\PasteUp.png"
Gui1.Button3.HoverImage := "Resources\PasteHover.png"
Gui1.Button3.PressedImage := "Resources\PasteDown.png"
Gui1.Button3.Label := "ControlPaste"
Gui, Utily: Add, Picture, x297 y36 w141 h115 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "Resources\UrlUp.png"
Gui1.Button4.HoverImage := "Resources\UrlHover.png"
Gui1.Button4.PressedImage := "Resources\UrlDown.png"
Gui1.Button4.Label := "URLButton"
Gui, Utily: Add, Picture, x440 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 5
;************************************************************************************************************************
Gui1.Button5 := {} ;Button 5
Gui1.Button5.DefaultImage := "Resources\HelpUp.png"
Gui1.Button5.HoverImage := "Resources\HelpHover.png"
Gui1.Button5.PressedImage := "Resources\HelpDown.png"
Gui1.Button5.Label := "HelpButton"
Gui, Utily: Add, Picture, x583 y36 w141 h115 hwndhwnd, % Gui1.Button5.DefaultImage
Gui1.Handles[ hwnd ] := "Button5" ;The name of the control to point at.
Gui1.Button5.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 6
;************************************************************************************************************************
Gui1.Button6 := {} ;Button 6
Gui1.Button6.DefaultImage := "Resources\ExitUp1.png"
Gui1.Button6.HoverImage := "Resources\ExitHover1.png"
Gui1.Button6.PressedImage := "Resources\ExitDown1.png"
;Gui1.Button6.Label := "ExitLabel"
Gui1.Button6.Label := "GuiClose"
Gui, Utily: Add, Picture, x691 y0 w48 h35 hwndhwnd, % Gui1.Button6.DefaultImage
Gui1.Handles[ hwnd ] := "Button6" ;The name of the control to point at.
Gui1.Button6.Hwnd := hwnd
;************************************************************************************************************************
/*
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
*/
MouseGetPos, xposUtil, yposUtil
If UtilButton=1
{
xposUtil := Floor((A_ScreenWidth/2)-450)
yposUtil := Floor((A_ScreenHeight/2)-200)
}
Gui, Utily: Show, x%xposUtil% y%yposUtil% W739 h167, Hover
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
WUtil:
UtilButton:=1
Gosub, GuiUtily
Return
^F3::
MainProcess:
Gui, Submit
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, Resources\ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
;Data:=clip_GetHtmlString()
accData:= GetAccData()
;******************************************************************************************************************
If not ClipboardGet_HTML( Data )
{
ErrorType :=1
Gosub, ControlError
;MsgBox, The content of the clipboard does not have a valid format to be saved and the operation will be canceled.
Return
}
Else
CorpusCount++
;******************************************************************************************************************
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
;******************************************************************************************************************
FileGetSize, SizeFile, %FileaccData%
If !FileaccData or SizeFile=3
{
ErrorType :=0
Gosub, ControlError
If ErrorTex=0
Return
}
;******************************************************************************************************************
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
;******************************************************************************************************************
FileGetSize, SizeFile1, %FileTex%
If !FileTex or SizeFile1=3
{
ErrorType :=0
Gosub, ControlError
If ErrorTex=0
Return
}
;******************************************************************************************************************
;ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html ;, CP65001
;******************************************************************************************************************
FileGetSize, SizeFile2, Temp.html
;MsgBox, %SizeFile2%
FileHTML := "Temp.html"
If !FileHTML or SizeFile2=3
{
ErrorType :=1
Gosub, ControlError
;If ErrorTex=0
Return
}
;******************************************************************************************************************
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%`n, TempPDF.html
}
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
If SuspendThumbnail=0
{
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
Gosub, ResizeH
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
;**********************
If !ImageCount
{
ErrorType :=2
Gosub, ControlError
}
;**********************
FileDelete, Image_Temp.jpg
}
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
;Gosub, CheckProcess
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Iniciate:=1
Data :=""
Gosub, ReloadMenu
Return
ControlError:
If ErrorType =0
{
MsgBox, 0x1024,, You have not been able to save the name of the clipboard source, you will be able to name it later. `nContinue in every way?
IfMsgBox Yes
{
ErrorTex:=1
Return
}
ErrorText:=0
Return
}
If ErrorType =1
{
MsgBox, The content of the clipboard does not have a valid format to be saved and the operation will be canceled.`n(The source of the text must be from the Internet or from formatted Word or PDF files opened with a browser.)
;CorpusCount++
;FileDelete,
Return
}
If ErrorType =2
;{
;MsgBox, 0x1024,, The clipboard image could not be saved. The clipboard exists, but it won't display an image `nContinue in every way?
MsgBox, The clipboard image could not be saved. The clipboard exists, but it will not display an image.`n It can be created later.
*/
IfMsgBox Yes
{
ErrorImg:=1
Return
}
ErrorImg:=0
*/
Return
;}
Return
ResizeH:
filePath := "Image_Temp.jpg"
size := GetImageSize(filePath)
If size.H !>500
return
else
if ErrorLevel
return
crop(FilePath, 0, 0, W, 500)
Return
/*
CheckProcess:
Corpus:= "HTMLTemp\Corpus" CorpusCount ".html"
Corpus:= "HTMLTemp\Image" CorpusCount ".jpg"
Corpus:= "HTMLTemp\name" CorpusCount ".txt"
Corpus:= "HTMLTemp\TextPlain" CorpusCount ".txt"
Corpus:= "HTMLTemp\URL" CorpusCount ".txt"
Corpus:= "HTMLTemp\Text" CorpusCount ".txt"
Return
*/
CopyGui:
CopyButton:=1
;GoSub, Toggle_Switch
Gosub, Menu2
Return
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
FileDelete, HTMLTemp\Corpus%DelClip%.html
FileDelete, HTMLTemp\image%DelClip%.jpg
FileDelete, HTMLTemp\Name%DelClip%.txt
FileDelete, HTMLTemp\Text%DelClip%.html
FileDelete, HTMLTemp\TextPlain%DelClip%.txt
FileDelete, HTMLTemp\URL%DelClip%.txt
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
;CorpusCount--
;Gosub, RButton
Iniciate:=0
Menu, ClipboardID, DeleteAll
;Gosub, IniciateUtility
Gosub, ReloadMenu
}
Return
^F8::
Menu2:
;MouseGetPos, xpos1, ypos1
MouseGetPos, xposMen, yposMen
If CopyButton=1
{
xposMen := Floor(A_ScreenWidth/2)
yposMen := Floor(A_ScreenHeight/2-100)
}
Gui, CopyButtom:Show, x%xposMen% y%yposMen% W81 h84
Return
+RButton::
RButton:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
;Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
Gui1.Hwnd := hwnd
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x520 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x540 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w20 h20 hwndIcon10 gClipDelete vDeleteButton%A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon9 gTitleEditing vEditing%A_Index%
Gui, ContextClip: Add, Button, x40 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "Resources\clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "Resources\128.ico", 1, "s32")
GuiButtonIcon(Icon8, "Resources\ArrowSmall.ico", 1, "s32")
GuiButtonIcon(Icon10, "Resources\recycle 2.ico", 1, "s32")
GuiButtonIcon(Icon9, "Resources\pencil 1.ico", 1, "s24")
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
;Gui, ContextClip: -Caption +ToolWindow +0x400000 +hWndhMainWnd HwndHwnd ;Menu3s
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd +Owner
;Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
;WinSet, Transparent
;Gui, ContextClip:+Owner
posyExitSess := posyExit+20
;LeeSession:= ScriptDir "\HTMLTemp\Session.txt"
LeeSession:= "HTMLTemp\Session.txt"
FileRead, SessClip, %LeeSession%
Gui, ContextClip: Add, Picture, x0 y%posyExit% W560 h32, Resources\Fondo_p.png
Gui, ContextClip: Add, Picture, x0 y%posyExit% W29 h32 gLabelSessionAct0, Resources\IConChange.png
Gui, ContextClip: Add, Picture, x30 y%posyExit% W435 h32 GuiMove, Resources\Resto1.png
;***********************************************************************
Gui1.Button7 := {} ;Button 7
Gui1.Button7.DefaultImage := "Resources\Reducedcap.png"
,Gui1.Button7.HoverImage := "Resources\Close.png"
Gui1.Button7.PressedImage := "Resources\Reducedcap1.png"
;Gui1.Button7.Label := "ReducedM"
Gui, ContextClip: Add, Picture, x487 y%posyExit% W72 h32 gReducedM hwndhwnd, % Gui1.Button7.DefaultImage
Gui1.Handles[ hwnd ] := "Button7" ;The name of the control to point at.
Gui1.Button7.Hwnd := hwnd
;***********************************************************************
Gui1.Button8 := {} ;Button 8
Gui1.Button8.DefaultImage := "Resources\Close.png"
,Gui1.Button8.HoverImage := "Resources\Close.png"
Gui1.Button8.PressedImage := "Resources\Close1.png"
Gui1.Button8.Label := "ExitLabel"
Gui, ContextClip: Add, Picture, x457 y%posyExit% W30 h32 hwndhwnd, % Gui1.Button8.DefaultImage
Gui1.Handles[ hwnd ] := "Button8" ;The name of the control to point at.
Gui1.Button8.Hwnd := hwnd
;***********************************************************************
Gui, ContextClip: Font, S9 Bold, Verdana
posyExitSess1 := posyExit+08
Gui, ContextClip: Add, Text, cYellow BackgroundTrans +Center x2 y%posyExitSess1% vTextTitle W536 h20, %SessClip%
MouseGetPos, xpos1, ypos1
If threeRButton=1
{
xpos1 := Floor((A_ScreenWidth/2)-450)
ypos1 := Floor((A_ScreenHeight/2)-200)
}
If ControlTwo=1
{
xpos1 := XActTwo-140
ypos1 := yActTwo-13
}
;xpos1 := xpos1-560
;ypos1 := ypos1-alto
AltoSess := Alto+12
Gui, ContextClip: Show, x%xpos1% y%ypos1% w560 h%AltoSess% ;Menu3s
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
OnMessage( 0x201 , "ButtonPress" )
Gosub, NewWindow
return
RButtonAlt:
threeRButton :=1
Gosub, RButton
Return
TitleEditing:
Gosub, NewWindow
StringTrimLeft, REdit, a_guicontrol, 7
FileChange := "HTMLTemp\Name" REdit ".txt"
FileRead, FileCont, %FileChange%
Gui, Edit: -Caption +alwaysontop +ToolWindow +hWndhMainWnd +Owner
;Gui, Edit:+Owner
Gui, Edit: Font, S10 Bold, Verdana
Gui, Edit: Add, Picture, x0 y0 h20 w564 h32, Resources\Fondo_Limp.png
Gui, Edit: Add, Text, cYellow BackgroundTrans x35 y6 W560 h32 GuiMove, Clipboard Title
Gui, Edit: Add, Text, x0 y33 w563 0x10 ; 0x7 Black
Gui, Edit: Font, S8 Bold, Verdana
Gui, Edit:Add, Edit, x5 y40 w544 h20 vMyEdit, %FileCont%
;Gui, Edit: Add, Edit, x12 y9 w460 h20 vMyEdit%REdit%, %FileCont%
Gui, Edit:Add, Button, x20 y70 w70 h20 gTitleSave, OK
Gui, Edit:Add, Button, x120 y70 w70 h20 gTitleCancel, Cancel
Gui, Edit:Add, CheckBox, x240 y70 w210 h20 Checked1 vVeryfyChange, Change also the Title to Paste
EdXm := pXm-846
EdYm := pYm-148 ;96
Gui, Edit:Show, x%EdXm% y%EdYm% w564
Return
TitleSave:
Gui, Edit: Submit, Destroy
fileAdd := FileOpen(FileChange, "w")
fileAdd.Write(MyEdit)
fileAdd.Close()
If VeryfyChange=1
{
ReadURL := "HTMLTemp\URL" REdit ".txt"
Fileread URLTxt, %ReadURL%
ReadText:= "HTMLTemp\Text" REdit ".html"
FileDelete, %ReadText%
myResultSave := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" URLTxt ">" MyEdit "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResultSave%, %ReadText%
}
MyEdit :=""
FileCont :=""
FileChange :=""
Gosub, RButton
Return
TitleCancel:
Gui, Edit: Destroy
MyEdit :=""
FileCont :=""
FileChange :=""
;Gosub, NewWindow
Gosub, RButton
Return
ReducedM:
WinGetPos, XActOne, YActOne,,, A
Gui, ContextClip: Destroy
SoundPlay, Resources\Close Window.mp3
ControlOne :=1
ControlTwo :=0
Gosub, NotifyTrayClick_207
Return
NotifyTrayClick_207:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip1: Add, Button, x0 y%posy% w460 h20 gButtonTwo vTwoButton%A_Index%, %A_LoopReadLine%
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip1: Margin, 2, 2
Gui, ContextClip1: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd +Owner ;Menu31s
Gui, ContextClip1: color,ffffd6
;Gui, Font, S14 Bold, Verdana
;Gui, ContextClip1:+Owner
Gui, ContextClip1: Add, Button, x20 y%posyExit% w380 h20 gExitLabel, Exit Menu
Gui, ContextClip1: Add, Button, x400 y%posyExit% w60 h20 hwndIcon20 gExtendedM
Gui, ContextClip1: Add, Text, x0 y%posyExit% w20 h20 GuiMove
Gui, ContextClip1: Add, Button, x0 y%posyExit% w20 h20 hwndIcon21
AltoT := Floor((CorpusCount+1)*31.5)
XPos:= A_ScreenWidth-(700)
YPos:= A_ScreenHeight-AltoT-60
If threeRButton=1
{
xpos := Floor((A_ScreenWidth/2)-450)
ypos := Floor((A_ScreenHeight/2)-200)
}
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
ExtendedM:
WinGetPos, XActTwo, YActTwo,,, A
Gui, ContextClip1: Destroy
SoundPlay, Resources\Close Window.mp3
ControlOne :=0
ControlTwo :=1
Gosub, RButton
Return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
ReducedAlt:
threeRButton :=1
Gosub, NotifyTrayClick_207
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: New
Gui, Help: -Caption +Owner
;Gui, Help: +Owner
Gui, Help: Color, EEAA99
Gui, Help: Margin, 0, 0
Gui, Help: Add, Picture, x0 y0 w640 h250, Resources\Help.jpg
Gui, Help: Add, Button, x495 y209 w100 h30 gNextButton, More...
Gui, Help: Show, w640 h250
Return
NextButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: Destroy
Gui, Help2: New
Gui, Help2: -Caption +Owner
;Gui, Help2: +Owner
Gui, Help2: Color, EEAA99
Gui, Help2: Margin, 0, 0
Gui, Help2: Add, Picture, x0 y0 w800 h397, Resources\Clipboard Utility Screenshot.jpg
Gui, Help2: Add, Button, x10 y340 w100 h30 gExitButton, Exit
Gui, Help2: Show, w800 h397
Return
ExitButton:
Gui, Help2: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Resources\Close Window.mp3
CopyButton=0
UtilButton :=0
Gui, Hide
Gui, CopyButtom:Hide
Return
;*************************************************************************
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace(status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
Gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
status_button_old:=status_button
return
;*************************************************************************
Deletealert:
if (status_delete=status_delete_old)
return
Gui, 4:default
Gui, destroy
NumberDelete:= RegExReplace(status_delete,"\D")
if !NumberDelete
return
Html =
(
<html><head><Style>
body {background-color: #FFFFF4; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Delete Clipboard Number %NumberDelete%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 4:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 4:margin, 0, 0
Gui, 4:add, ActiveX, vWB w64 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
DelXm := pXm-944
GuiControl, Move, WB, h%maxBottom%
Gui, 4: Show, x%DelXm% y%pYm% w64 h60
status_delete_old:=status_delete
Return
;*************************************************************************
Copyalert:
if (status_Copy=status_Copy_old)
return
Gui, 6:default
Gui, destroy
NumberCopy:= RegExReplace(status_Copy,"\D")
if !NumberCopy
return
Html =
(
<html><head><Style>
body {background-color: #FFFFF4; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Copy Item %NumberCopy% as Current Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 6:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 6:margin, 0, 0
Gui, 6:add, ActiveX, vWB w60 h72, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 6: Show, x%pXm% y%pYm% w60 h72
status_Copy_old:=status_Copy
Return
;*************************************************************************
URLalert:
if (status_URL=status_URL_old)
return
Gui, 5:default
Gui, destroy
NumberURL:= RegExReplace(status_URL,"\D")
URL_file := "HTMLTemp\URL" NumberURL ".txt"
if !URL_file
return
;Gui,2:Destroy
;URL_file := "HTMLTemp\URL" NumberURL ".txt"
FileRead, URLContents, %URL_file%
Html =
(
<html><head><Style>
body {background-color: #FFFFF4; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Go to: %URLContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 5:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 5:margin, 0, 0
Gui, 5:add, ActiveX, vWB w562 h30, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
DelXm := pXm-845
;DelXm := pXm-819
DelYm := pYm-47
;Gui, 5: Show, x%DelXm% y%DelYm% w543 h30
Gui, 5: Show, x%DelXm% y%DelYm% w562 h30
status_URL_old:=status_URL
Return
;*************************************************************************
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace(status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Gui,5:Destroy
FileRead, FileContents, %Text_file%
Html =
(
<html><head><Style>
body {background-color: #FFFFF4; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 3:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 3:margin, 0, 0
Gui, 3:add, ActiveX, vWB w320 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
;*************************************************************************
Editingalert:
if (status_Editing=status_Editing_old)
return
Gui, 6:default
Gui, destroy
EditingNumber:= RegExReplace(status_Editing,"\D")
if !EditingNumber
return
Gui,2:Destroy
Gui,5:Destroy
Html =
(
<html><head><Style>
body {background-color: #FFFFF4; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Edit Title of the %EditingNumber%th Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 7: +AlwaysOnTop -Caption +ToolWindow Border
;Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui, 7:margin, 0, 0
gui, 7:add, ActiveX, vWB w62 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
;DelXm := pXm-953
GuiControl, Move, WB, h%maxBottom%
gui, 7: Show, x%pXm% y%pYm% w62 h60
status_Editing_old:=status_Editing
Return
;*************************************************************************
^F6::
ControlPaste:
MsgBox, 0x1034,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Utily: Destroy
;Gui, Hide
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Resources\Close Window.mp3
Return
^F10::
DeleteAll:
MsgBox, 0x1034,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
SavePDF:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, Utily: Destroy
Sleep, 1000
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, Resources\PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
PDFCount++
FormatTime, CurrentDate,, dd-MM-yyyy
Filedate := "Documents\Final_Document_" CurrentDate "-" PDFCount ".pdf"
Filedateh := "Documents\ToPDF_" CurrentDate "-" PDFCount ".html"
FileMove, Final_Document.pdf, %Filedate%
Run, %Filedate%
FileMove, ToPDF.html, %Filedateh%
;FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Return
^F7::
SaveWord:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a Word File?
IfMsgBox No
Return
Else
Gui, Utily: Destroy
Sleep, 1000
;ToolTip, Saving clipboard to docx file...
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToWord.html, CP65001
;FileRead, Line1, Resources\WordLine.html
;FileAppend, %Line1%, ToWord.html, CP65001
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToWord.html, CP65001
FileRead, Line2, Resources\WordLine.html
FileAppend, %Line2%, ToWord.html, CP65001
}
}
WinClip.Clear()
html := FileOpen("ToWord.html", "r").read()
WinClip.SetHTML(html)
Filedelete, WorkingDir.txt
FileAppend, %A_ScriptDir%\, WorkingDir.txt
FileRead, ScriptDir, Workingdir.txt
Clip:= ScriptDir "Word.docx"
ClipToDoc( clip )
WordCount++
FormatTime, CurrentDate,, dd-MM-yyyy
FileWord := ScriptDir "\Documents\Final_Document_" CurrentDate "-" WordCount ".docx"
FileMove, Word.docx, %FileWord%
Run, %FileWord%
FileDelete, ToWord.html
Return
^F11::
;^!z::
DeleteLast:
MsgBox, 0x1034,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
;FileDelete, HTMLTemp\*%CorpusCount%.*
FileDelete, HTMLTemp\Corpus%CorpusCount%.html
FileDelete, HTMLTemp\image%CorpusCount%.jpg
FileDelete, HTMLTemp\Name%CorpusCount%.txt
FileDelete, HTMLTemp\Text%CorpusCount%.html
FileDelete, HTMLTemp\TextPlain%CorpusCount%.txt
FileDelete, HTMLTemp\URL%CorpusCount%.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
;CorpusCount--
Return
;************************************************************************************************************************
OnClipboardChange:
if (ClipBoardEnabled=1) and ((A_TickCount-StartTicks)>1)
{
currentClip=%clipboard%
;currentClipAll=%clipboardall%
If (A_EventInfo=1) and (currentClip <> previousClip)
{
previousClip=%clipboard%
If NotifyClip=1
{
TrayTip,, %currentClip%
SoundPlay, Close Window.mp3
SetTimer, HideTrayTip, -1000
}
ClipSave(ClipBoardHistory,currentclip, 15)
}
}
Return
ClipSave(ClipBoardHistory,clip,maxclips=15)
{
ClipBoardHistory.insert(Object())
index:=ClipBoardHistory.MaxIndex()
ClipBoardHistory[index]["plain"]:=clip
;ClipBoardHistory[index]["All"]:=clipall
ClipTemp:= "TempClip\Clip" index ".clip"
If Index<=15
{
FileAppend, %Clip%, %ClipTemp%
}
if (index>maxclips)
{
ClipBoardHistory.Remove(ClipBoardHistory.MinIndex())
FileDelete, TempClip\Clip1.clip
Loop 15
if !FileExist("TempClip\Clip" A_Index ".clip")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "TempClip\Clip" Filesup ".clip"
NumF:= "TempClip\Clip" NumberFile ".clip"
Filemove, %Sup%, %NumF%
}
FileAppend, %Clip%, TempClip\Clip15.clip
}
}
;************************************************************************************************************************
^Esc::
Exit:
ExitApp
Return
Borrado:
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, LabelSessionAct1
CorpusCount :=0
;Gosub, ReloadSession
Gosub, ReloadMenu
Return
ButtonTwo:
StringTrimLeft, NumberFile, a_guicontrol, 9
;Gui, 2: Destroy
;Gui, ContextClip: Destroy
Gosub, ButtonLabel
Return
LabelSession:
;NumberFile:=A_ThisMenuItemPos
;Menu, tray, ToggleCheck, &Suspend Hotkeys
;Menu, tray, ToggleCheck, Clipboard Sessions
MsgBox, 0x1024,, You want the session %A_ThisMenuItem% to be the default session?
IfMsgBox No
Return
;Loop, %DirectoryCount%
/*
if !FileExist("HTMLTemp" A_Index)
{
;NumberDir : %A_Index%
MoveDir := "HTMLTemp" A_Index
}
MsgBox, %MoveDir%
*/
FileDelete, SessionTemp*.txt
FileDelete, SessionTemp00.txt
FileDelete, SessionTemp01.txt
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
NumSess := A_Index-1
NumberPos:= A_ThisMenuItemPos-4
;MsgBox, %NumberPos%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp"
FileAppend, %FileSession%, SessionTemp.txt
FileAppend, %A_ScriptDir%, SessionTemp00.txt
FileSession2 := "\HTMLTemp00"
FileAppend, %FileSession2%, SessionTemp00.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;FileMove %DirectorySess%, %DirectorySess00%
FileMoveDir %DirectorySess%, %DirectorySess00%, R
;DirectorySess :=""
;DirectorySess00 :=""
FileAppend, %A_ScriptDir%, SessionTemp01.txt
FileSession3 := "\HTMLTemp" NumberPos
FileAppend, %FileSession3%, SessionTemp01.txt
FileRead, DirectorySess01, SessionTemp01.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;MsgBox, %DirectorySess01%`n%DirectorySess%
FileMoveDir %DirectorySess01%, %DirectorySess%, R
FileMoveDir %DirectorySess00%, %DirectorySess01%, R
Menu, SessionID, DeleteAll
Menu, ClipboardID, DeleteAll
Iniciate:=0
Gosub, ReloadSession
Return
ButtonLabelTray:
If CorpusCount=0
Return
NumberFile:=A_ThisMenuItemPos
Gosub, ButtonLabel
Return
ButtonLabel:
;NumberFile:= RegExReplace(NameTwo,"\D")
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
SoundPlay, Resources\Close Window.mp3
Gui, ContextClip1: Destroy
Gui, ContextClip: Destroy
;Gui, Destroy
Gui,2: Destroy
Gui, Gui1: Destroy
;Gui, 2:default
;Gui, destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
ControlOne :=0
ControlTwo :=0
threeRButton :=0
Alto:=0
Return
TxtLabel:
SoundPlay, Resources\Clipboard_Sound.mp3
StringTrimLeft, TextCopy, a_guicontrol, 5
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
Return
TxtPlane:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
global status_Delete ,tme
global status_URL ,tme
global status_Copy ,tme
global status_Editing ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
status_Delete:=""
status_URL:=""
status_Copy:=""
status_Editing:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
if instr(a_guicontrol,"Delete")
{
status_Delete:=a_guicontrol
SetTimer, Deletealert,-20
}
if instr(a_guicontrol,"URL")
{
status_URL:=a_guicontrol
SetTimer, URLalert,-20
}
if instr(a_guicontrol,"Copy")
{
status_Copy:=a_guicontrol
SetTimer, Copyalert,-20
}
if instr(a_guicontrol,"Editing")
{
status_Editing:=a_guicontrol
SetTimer, Editingalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
status_Delete_old:=""
status_URL_old:=""
status_Copy_old:=""
status_Editing_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
URLButton:
SoundPlay, Resources\Close Window.mp3
MsgBox, 0x1024,, Extract URL's from Clipboards?
IfMsgBox No
Return
Else
Gui, Utily: Destroy
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
}
}
Gosub, ExtractURL
FileDelete, ToPDF.html
Return
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
Return True
}
;************************************************************************************************************************
ExtractURL:
;Create header html document
FileAppend,
(
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=AutoHotkey.File>
<meta name=Generator content="AutoHotkey">
</head>
<body lang=es style='font-family:Calibri;font-size:11.0pt'>
), Extracted_Links.html
FormatTime, CurrentDate,, dd-MM-yyyy
DateIncl := "<p style='margin:0in'><span style='font-family:Times New Roman;font-size:11.0pt;color:#1E4D78'>Clipboard Session URLs: </span><span style='font-weight:bold;font-family:Calibri;font-size:12.0pt;color:#860000'>" CurrentDate "</span></p>"
FileAppend, %DateIncl%, Extracted_Links.html
;Add Line
myResult := "<p style='margin:0in;font-family:Calibri;font-size:11.0pt;color:#78230C'><p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>`r
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>`r"
FileAppend, %myResult%, Extracted_Links.html
;Routine loop, origin: https://www.autohotkey.com/docs/commands/LoopReadFile.htm
LinkCount := 0
ImgCount := 0
Loop, read, ToPDF.html, Extracted_Links.html
{
URLSearchString := A_LoopReadLine
Gosub, URLSearch
}
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links.html
Loop, read, Extracted_Links.html
{
If A_Index < 11
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
if A_Index > 11
if RegExMatch(A_LoopReadLine, "\.(jpg<|jpeg<|png<|gif<|svg<)")
{
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
ImgCount++ ; increment by one
}
else If InStr(A_LoopReadLine, "</ul>", True) and A_Index > 17
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links_Img.html
}
;URL number message, Optional
MsgBox %LinkCount% links were found and written to "Extracted_Links.html" `n %ImgCount% Images were found and written to "Extracted_Links_Img.html"
;Opcional, opens the result
FormatTime, CurrentDate,, dd-MM-yyyy
FileURL := "Documents\Extracted_Links_" CurrentDate ".html"
FileURLImg := "Documents\Extracted_Links_Img_" CurrentDate ".html"
FileMove, Extracted_Links.html, %FileURL%
FileMove, Extracted_Links_Img.html, %FileURLImg%
FileDelete, ToPDF.html
Run, %FileURL%
Run, %FileURLImg%
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
URLStart1 := InStr(URLSearchString, "https://")
URLStart2 := InStr(URLSearchString, "http://")
URLStart3 := InStr(URLSearchString, "ftp://")
URLStart4 := InStr(URLSearchString, "www.")
; Find the left-most starting position:
URLStart := URLStart1 ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
ArrayElement := URLStart%A_Index%
if (ArrayElement = "") ; End of the pseudo-array has been reached.
break
if (ArrayElement = 0) ; This element is disqualified.
continue
if (URLStart = 0)
URLStart := ArrayElement
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if (ArrayElement != 0)
if (ArrayElement < URLStart)
URLStart := ArrayElement
}
}
if (URLStart = 0) ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
URL := SubStr(URLSearchString, URLStart) ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%<> ; Find the first space, tab, or angle (if any).
{
URL := A_LoopField
break ; i.e. perform only one loop iteration to fetch the first "field".
}
StringReplace, URLCleansed, URL, ",, All
; Makes a second check to replace extraneous signs.
FixString := % URLCleansed
vList := "
(
%21 !
%23 #
%24 $
%26 &
%27 '
%28 (
%29 )
%2A *
%2B +
%2C ,
%3B ;
%2F /
%3A :
%3D =
%3F ?
%40 @
%5B [
%5D ]
%20
%C2%B4 ´
%2E .
%25 %
%2D -
%3C <
%3E >
%5C \
%5E ^
%5F _
%60 `
%7B {
%7C |
%7D }
%7E ~
%22 ""
\/ \
)"
Loop, Parse, vList, `n
{
oTemp := StrSplit(A_LoopField, "`t")
FixString := StrReplace(FixString, oTemp.1, oTemp.2)
}
oTemp := ""
ClipBoard := "<li style='margin-top:0;margin-bottom:0;vertical-align:middle'><p style='margin:0in;font-family:Calibri;font-size:10.0pt'><a href=" FixString ">" FixString "</a></p></li>"
FileAppend, %ClipBoard%`n
LinkCount += 1
; See if there are any other URLs in this line:
CharactersToOmit := StrLen(URL)
CharactersToOmit += URLStart
URLSearchString := SubStr(URLSearchString, CharactersToOmit)
Gosub, URLSearch ; Recursive call to self.
return
;**********************************************************************************************
^F1::
CaseMenu:
Menu Case, Add
Menu Case, DeleteAll
Menu Case, Add, &UPPERCASE, CCase
Menu Case, Add, &lowercase, CCase
Menu Case, Add, &Title Case, CCase
Menu Case, Add, &a Title to Case, CCase
Menu Case, Add, &Sentence case, CCase
Menu Case, Add
Menu Case, Add, &Remove Spaces, CCase
GetText(Txt)
If NOT ERRORLEVEL
Menu Case, Show
Return
CCase:
p:=A_ThisMenuItemPos
If (p=1)
StringUpper, Txt, Txt
Else If (p=2)
StringLower, Txt, Txt
Else If (p=3)
StringLower, Txt, Txt, T
Else If (p=4)
{
StringLower, Txt, Txt
;IMPORTANT! Change short words to be replaced in the following list according to each language or add more
lowers := ["a", "ha", "el", "y", "pero", "o", "para", "las", "es", "para", "por", "los", "con", "en", "que", "un", "de", "del", "la", "una", "cada", "en", "al", "por", "uno", "mi", "tu", "tú", "no", "ni", "sin", "se", "lo", "e", "su", "sí", "ser", "hay"]
for k, v in lowers
low .= (k = 1 ? "" : "|") . v
;Txt := RegExReplace(Txt, "(*UCP)(^\b|\b(?!(" . low . ")\b))\w+\b|\b\w+\b$", "$T0")
;Txt := RegExReplace(Txt, "((?:^|[.!?-]\s+)[a-z])", "$u1")
Txt := RegExReplace(Txt, "(*UCP)(^|\b(?!(" . low . ")\b))\w|(\.|\?|!)\s*\K\w|-\K\w", "$T0")
}
Else If (p=5)
{
StringLower, Txt, Txt
Txt := RegExReplace(Txt, "((?:^|[.!?]\s+)[a-z])", "$u1")
}
Else If (p=7)
{
Loop
{
StringReplace, Txt, Txt, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0
break
}
}
PutText(Txt)
Return
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^{vk43} ;Ctrl C
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard =
Sleep 20
Clipboard := MyText
Send ^{vk56} ;Ctrl V
Sleep 100
Clipboard := SavedClip
Return
}
ClipToDoc(FileName) {
oWord := ComObjCreate("Word.Application")
Document := oWord.Documents.Add
; oWord.Selection.Paste
oWord.Selection.PasteAndFormat(16) ; wdFormatOriginalFormatting = 16
Document.SaveAs(FileName)
Document.Close()
oWord.Quit
}
GetImageSize(imageFilePath) {
if !hBitmap := LoadPicture(imageFilePath, "GDI+")
throw "Failed to load the image"
VarSetCapacity(BITMAP, size := 4*4 + A_PtrSize*2, 0)
DllCall("GetObject", "Ptr", hBitmap, "Int", size, "Ptr", &BITMAP)
DllCall("DeleteObject", "Ptr", hBitmap)
Return { W: NumGet(BITMAP, 4, "UInt"), H: NumGet(BITMAP, 8, "UInt") }
}
crop(FilePath, x, y, w, h) {
static IP
img := ComObjCreate("WIA.ImageFile")
img.LoadFile(FilePath)
if (!IP) {
IP:=ComObjCreate("WIA.ImageProcess")
ip.Filters.Add(IP.FilterInfos("Crop").FilterID)
}
; x,y,r,b are the number of pixels to crop from each edge. They cannot be negative numbers.
ip.filters[1].properties("Left") := x
ip.filters[1].properties("Top") := y
if ((r := img.width - w - x) < 1)
r := 0
if ((b := img.height - h - y) < 1)
b := 0
ip.filters[1].properties("Right") := r
ip.filters[1].properties("Bottom") := b
img := IP.Apply(img)
FileDelete, %FilePath%
while FileExist(FilePath)
Sleep, 10
img.SaveFile(FilePath)
return
}
;*******************************************************************************
Nothing:
Run, https://www.autohotkey.com/boards/viewtopic.php?t=92963
Return
Tray_Open:
ListLines
return
^!F4::
NewSession:
Gui, Session: -Caption +alwaysontop +ToolWindow +hWndhMainWnd +Owner
;Gui, Session:+Owner
Gui, Session: Font, S10 Bold, Verdana
Gui, Session: Add, Picture, x0 y0 h20 w562 h32, Resources\Fondo_Limp.png
Gui, Session: Add, Text, cYellow BackgroundTrans x35 y6 W560 h32 GuiMove, Session Name
;Gui, RenSession: Add, Text, x5 y6 h20 w549, Session Name:
Gui, Session: Add, Text, x0 y33 w563 0x10 ; 0x7 Black
Gui, Session: Font, S8 Bold, Verdana
Gui, Session: Add, Edit, x5 y40 vSessEdit h20 w544, New Session
Gui Session:Add, Button, x20 y70 w70 h20 gSessionSave, OK
Gui Session:Add, Button, x120 y70 w70 h20 gSessCancel, Cancel
xSess := Floor((A_ScreenWidth/2)-448)
ySess := Floor((A_ScreenHeight/2)-200)
Gui, Session: Show, x%xSess% y%ySess% w562
Return
SessionSave:
FileDelete, SessionTemp.txt
Gui, Session: Submit
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal1 := A_Index
FileCreateDir, HTMLTemp%SessionTotal1%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp" SessionTotal1 "\Session.txt"
FileAppend, %FileSession%, SessionTemp.txt
;Sleep, 3500
FileRead, Directory, SessionTemp.txt
FileAppend, %SessEdit%, %Directory%
Menu, SessionID, DeleteAll
Iniciate:=1
;Gosub, NewWindow
SessEdit :=""
Gosub, ReloadSession
Return
SessCancel:
Gui, Session:Destroy
Gui, RenSession:Destroy
SessEdit :=""
ReSessEdit :=""
Gosub, RButton
Return
LabelSessionAct0:
Position :=0
Gosub, LabelSessionAct
Return
LabelSessionAct1:
Position :=1
;MsgBox, HOLA!!!
Gosub, LabelSessionAct
Return
LabelSessionAct:
Gosub, NewWindow
ReadSess := "HTMLTemp\Session.txt"
FileRead, RenSession, %ReadSess%
Gui, RenSession: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
; Gui, RenSession:+Owner
Gui, RenSession: Font, S10 Bold, Verdana
Gui, RenSession: Add, Picture, x0 y0 h20 w564 h32, Resources\Fondo_Limp.png
Gui, RenSession: Add, Text, cYellow BackgroundTrans x35 y6 W560 h32 GuiMove, Session Name
;Gui, RenSession: Add, Text, x5 y6 h20 w549, Session Name:
Gui, RenSession: Add, Text, x0 y33 w563 0x10 ; 0x7 Black
Gui, RenSession: Font, S8 Bold, Verdana
Gui, RenSession: Add, Edit, x5 y40 vReSessEdit h20 w544, %RenSession%
Gui RenSession:Add, Button, x20 y70 w70 h20 gRenSessionSave, OK
Gui RenSession:Add, Button, x120 y70 w70 h20 gSessCancel, Cancel
If Position=0
{
xSess := pXm-846
ySess := pYm-148 ;96
}
If Position=1
{
xSess := Floor((A_ScreenWidth/2)-448)
ySess := Floor((A_ScreenHeight/2)-200)
}
Gui, RenSession: Show, x%xSess% y%ySess% w564
Return
RenSessionSave:
Gui, RenSession: Submit
FileDelete, HTMLTemp\Session.txt
FileAppend, %ReSessEdit%, HTMLTemp\Session.txt
ReSessEdit :=""
Gosub, RButton
Return
/*
Paused:
Paused:=!Paused
IfEqual,Paused,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Orange.ico
IfEqual,Paused,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Pause Script
Menu,Tray,Icon,,,1
Pause,Toggle,1
Return
*/
DeleteSessions:
MsgBox, 0x1034,, Do you Really want to Delete the Empty Sessions? `n`n Can be Used on Another Occasion.
IfMsgBox No
Return
IndiDir := 0
SumDir := 0
loop, %SessionTotal%
{
FileDelete, SessionCount.txt
FileAppend, %A_ScriptDir%, SessionCount.txt
FullFile:="\HTMLTemp" A_Index "\*.*"
NameDir := "HTMLTemp" A_Index
FileAppend, %FullFile%, SessionCount.txt
FileRead, CountFiles, SessionCount.txt
loop, %CountFiles%
FilesCount := % Floor(A_Index/6)
;MsgBox, %FilesCount% - %NameDir%
If FilesCount=0
{
FileRemoveDir, %NameDir%, 1
IndiDir--
SumDir++
}
}
If InDir<>DirectoryCount
{
Loop %SumDir%
{
Loop %DirectoryCount%
if !FileExist("HTMLTemp" A_Index)
{
NumberFile1 := A_Index
FileSup1 := NumberFile1+1
Sup1 := ScriptDir "HTMLTemp" Filesup1
NumF1:= ScriptDir "HTMLTemp" NumberFile1
;MsgBox, %Sup1% - %NumF1%
FileMoveDir %Sup1%, %NumF1%, R
;Filemove, %Sup%, %NumF%
;FileMoveDir %DirectorySess%, %DirectorySess00%, R
}
}
DirectoryCount:=DirectoryCount-SumDir
Menu, SessionID, DeleteAll
Gosub, ReloadSession
}
Return
^F12::
Stanby:
Suspend:=!Suspend
IfEqual,Suspend,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Red.ico
IfEqual,Suspend,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Suspend Hotkeys
Menu,Tray,Icon,,,1
Suspend,Toggle
Return
SuspendThumbnail:
Menu, ThumbnailID, ToggleCheck, Postpone Thumbnail Creation
xSplash1 := A_ScreenWidth-506
ySplash1 := A_ScreenHeight-180
If SuspendThumbnail=0
{
SuspendThumbnail:=1
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Thumbnail Creation Disabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
else
{
SuspendThumbnail:=0
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Thumbnail Creation Enabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
Return
SuspendBasicClip:
Menu, BasicClipID, ToggleCheck, Disable Basic Clipboard
xSplash1 := A_ScreenWidth-506
ySplash1 := A_ScreenHeight-180
If ClipBoardEnabled=0
{
ClipBoardEnabled:=1
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Basic Clipboard Enabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
else
{
ClipBoardEnabled:=0
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Basic Clipboard Disabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
Return
SuspendNotifClip:
Menu, BasicClipID, ToggleCheck, Deactivate Notifications in Tray
xSplash1 := A_ScreenWidth-506
ySplash1 := A_ScreenHeight-180
If NotifyClip=0
{
NotifyClip:=1
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification,Notifications in Tray Enabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
else
{
NotifyClip:=0
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Notifications in Tray Disabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
Return
DeleteBasic:
MsgBox, 0x1024,, Want to Delete all Basic Clipboards? `n`n It will be Deleted from the Hard Disk, `n Only the Last one will Remain in Memory.
IfMsgBox No
Return
FileDelete, TempClip\*.*
Reload
Return
CreateMissing:
CountImg := 0
Loop, %CorpusCount%
if !FileExist("HTMLTemp\Image" A_Index ".jpg")
{
Corpus := A_ScriptDir "\HTMLTemp\Corpus" A_Index ".html"
;MsgBox, %Corpus%
Filecopy %Corpus%, CorpusTemp.html
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 CorpusTemp.html Image_Temp.jpg,,hide
Gosub, ResizeH
ImageCount1 := "HTMLTemp\Image" A_Index ".jpg"
FileMove, Image_Temp.jpg, %ImageCount1%
FileDelete, CorpusTemp.html
CountImg++
}
If CountImg=0
{
MsgBox, All Clipboard already have Thumbnails.
}
Else
{
MsgBox, Finished process.`n`n %CountImg% Thumbnail(s) has been Created.
}
Return
/*
;Loop, 6
MsgBox, %CorpusCount%
Loop, %CorpusCount%
if !FileExist("HTMLTemp\Image" A_Index ".jpg")
{
MsgBox, No existe Imagen %A_Index%
}
;Else
;{
;MsgBox, Sí existe Imagen %A_Index%
;}
idx = 0
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
;MsgBox, %CorpusCount% - %A_Index% - %idx%
Loop, %CorpusCount%
idx++
;MsgBox, %CorpusCount% - %A_Index% - %idx%
;Imagecheck :="HTMLTemp\Image" A_Index ".jpg"
if !FileExist("h:\Download\Script\MultiClipboard Preview 4.1n\HTMLTemp\Image" A_Index ".jpg")
{
MsgBox, No existe Imagen %A_Index% %idx%
}
*/
EditScript:
Run Edit %A_ScriptName%
Return
^!F7::
Reloaded:
Reload
Return
NotifyTrayClick_201:
;xSplash := Floor((A_ScreenWidth/2)-450)
;ySplash := Floor((A_ScreenHeight/2)-200)
xSplash := A_ScreenWidth-506
ySplash := A_ScreenHeight-180
SplashTextOn, 500, 80, Content of the current clipboard, %Clipboard%
WinMove, Content of the current clipboard,, xSplash, ySplash
;SplashTextOn,,, Displays only a title bar.
Sleep, 1000
SplashTextOff
;SplashTextOn,,, %Clipboard%
;WinMove,,, xSplash, ySplash
;Sleep, 1000
;SplashTextOff
Return
Code: Select all
; https://www.autohotkey.com/board/topic/73599-ahk-l-pum-owner-drawn-object-based-popup-menu/ - capitalH
#NoEnv
;#Include %A_ScriptDir%
#Include PUM.ahk
#Include PUM_API.ahk
#singleinstance force
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Screen
;MaxCount:=0
StartTicks:=A_TickCount
ClipBoardHistory:=Object()
ClipBoardEnabled=1
previousClip=%clipboard%
if FileExist("TempClip\Clip1.clip")
{
Loop, TempClip\Clip*.clip
NumberClip := A_Index
;MsgBox, %NumberClip%
Loop, %NumberClip%
{
ReadClip:= "TempClip\Clip" A_Index ".clip"
FileRead, ClipHsy, %ReadClip%
FileDelete, %ReadClip%
ClipSave(ClipBoardHistory, ClipHsy, A_Index)
}
}
^Up::
; parameters of the PUM object, the manager of the menus
pumParams := { "SelMethod" : "fill" ;item selection method, may be frame,fill
,"selTColor" : 0xFFFFFF ;selection text color
,"selBGColor" : 0x036FC5 ;selection background color, -1 means invert current color
,"oninit" : "PUM_out" ;function which will be called when any of this events happen, se it below
,"onuninit" : "PUM_out"
,"onselect" : "PUM_out"
,"onrbutton" : "PUM_out"
,"onmbutton" : "PUM_out"
,"onrun" : "PUM_out" }
;PUM_Menu parameters
menuParams1 := { "bgcolor" : 0xFFFFF4 ;background color of the menu R
, "iconssize" : 0 ;size of icons in the menu
, "tcolor" : 0x036FC5 ; text color of the menu items
, "hFont" : Segoe UI 50}
;create an instance of PUM object, it is best to have only one of such in the program
pm := new PUM( pumParams )
PUM_out( msg, obj )
{
; if ( msg = "onselect" )
; tooltip % obj.tooltip
; if ( msg = "oninit" )
; tooltip % "menu init: " obj.handle
; if ( msg = "onuninit" )
; tooltip % "menu uninit: " obj.handle
; if ( msg = "onrbutton" )
; tooltip % "Right clicked: " obj.name
; if ( msg = "onmbutton" )
; tooltip % "Middle clicked: " obj.name
; if ( msg = "onrun" )
; tooltip % "Item runned: " obj.name
}
;^!v::
;^Up::
MouseGetPos,,, WinUMID
menu := pm.CreateMenu( menuParams1 )
index:=ClipBoardHistory.maxIndex()
if index=
return
while Index>=ClipBoardHistory.minIndex()
{
Description:=ClipBoardHistory[Index]["plain"]
FullDescription:=Description
;if(StrLen(Description)>35)
if(StrLen(Description)>80)
{
;toCut:=StrLen(Description)-18
toCut:=StrLen(Description)-50
StringMid, itemTemp1, Description, 1, 12
StringTrimLeft, itemTemp2, Description, %toCut%
Description=%itemTemp1%...%itemTemp2%
}
if index<10
MenuString:="&" . (ClipBoardHistory.maxindex()-Index+1) . ". " . Description
else
MenuString:= (ClipBoardHistory.maxindex()-Index+1) . ". " . Description
menu.Add( { "name" : MenuString
, "bold" : 1
, "index" : Index
, "tooltip" : ClipBoardHistory[Index]["plain"]})
index--
}
;WinGet, ActiveWindow , ID, A
MouseGetPos, xpos2, ypos2
; item := menu.Show( A_ScreenWidth/3, A_ScreenHeight/3 )
item := menu.Show( xpos2, ypos2 )
;WinGet, MenuClip, ID, A
;MsgBox, %MenuClip%
;WinSet, Transparent, 150, %MenuClip%
;WinSet, Redraw,, %MenuClip%
;tooltip
WinActivate, ahk_id %WinUMID%
;WinActivate , ahk_id %ActiveWindow%
;WinWaitActive, ahk_id %ActiveWindow%
hwnd := WinExist()
if item
{
ClipBoardEnabled=0
test:=item.index
tempClip:=clipboard
clipboard:=ClipBoardHistory[test]["plain"]
send, ^v
clipboard:=tempClip
ClipBoardEnabled=1
}
return
Menu.destroy()
;WinSet, Transparent, 255, %MenuClip%
;WinSet, Transparent, off, %MenuClip%
return
HideTrayTip:
TrayTip
Return
OnClipboardChange:
if (ClipBoardEnabled=1) and ((A_TickCount-StartTicks)>1)
{
currentClip=%clipboard%
;currentClipAll=%clipboardall%
If (A_EventInfo=1) and (currentClip <> previousClip)
{
previousClip=%clipboard%
;TrayTip,, %currentClip%
;SoundPlay, Close Window.mp3
;SetTimer, HideTrayTip, -1500
ClipSave(ClipBoardHistory,currentclip, 5)
}
}
Return
ClipSave(ClipBoardHistory,clip,maxclips=5)
{
ClipBoardHistory.insert(Object())
index:=ClipBoardHistory.MaxIndex()
ClipBoardHistory[index]["plain"]:=clip
;ClipBoardHistory[index]["All"]:=clipall
ClipTemp:= "TempClip\Clip" index ".clip"
If Index<=5
{
FileAppend, %Clip%, %ClipTemp%
}
if (index>maxclips)
{
ClipBoardHistory.Remove(ClipBoardHistory.MinIndex())
FileDelete, TempClip\Clip1.clip
Loop 5
if !FileExist("TempClip\Clip" A_Index ".clip")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "TempClip\Clip" Filesup ".clip"
NumF:= "TempClip\Clip" NumberFile ".clip"
Filemove, %Sup%, %NumF%
}
FileAppend, %Clip%, TempClip\Clip5.clip
}
}
Code: Select all
;https://www.autohotkey.com/boards/viewtopic.php?f=76&t=92963
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
;EnvSet, SD, %A_ScriptDir%
#Include Library\WinClipAPI.ahk
#Include Library\WinClip.ahk
#Include Library\ViewHtml.ahk
#Include Library\Gdip_All_1.45.ahk
#Include Library\PUM_API.ahk
#Include Library\PUM.ahk
;#Include Library\ToolTipEx.ahk
#SingleInstance, Force
#InstallMousehook
#Persistent
CoordMode, Mouse, Screen
SetBatchLines, -1
Name := "Clipboard Utility - "
Version := "4.3a"
StartTicks:=A_TickCount
ClipBoardHistory:=Object()
ClipBoardEnabled=1
previousClip=%clipboard%
NotifyClip := 1
CorpusCount := 0
DirectoryCount := 0
Iniciate := 0
PDFCount := 0
WordCount := 0
SuspendThumbnail := 0
SuspendHotkeys := 1
if !FileExist(HTMLTemp)
{
FileCreateDir, HTMLTemp
}
if !FileExist(TempClip)
{
FileCreateDir, TempClip
}
;Hotkey, LButton Up, off
;loop, HTMLTemp\Corpus*.html
;CorpusCount := % Floor(A_Index)
if FileExist("TempClip\Clip1.clip")
{
Loop, TempClip\Clip*.clip
NumberClip := A_Index
;MsgBox, %NumberClip%
Loop, %NumberClip%
{
ReadClip:= "TempClip\Clip" A_Index ".clip"
FileRead, ClipHsy, %ReadClip%
FileDelete, %ReadClip%
ClipSave(ClipBoardHistory, ClipHsy, A_Index)
}
}
;***************************************************************************************************************************
;Parameters of the PUM object, the manager of the menus
pumParams := { "SelMethod" : "fill" ;item selection method, may be frame,fill
,"selTColor" : 0xFFFFFF ;selection text color
,"selBGColor" : 0x036FC5 ;selection background color, -1 means invert current color
,"oninit" : "PUM_out" ;function which will be called when any of this events happen, se it below
,"onuninit" : "PUM_out"
,"onselect" : "PUM_out"
,"onrbutton" : "PUM_out"
,"onmbutton" : "PUM_out"
,"onrun" : "PUM_out" }
;PUM_Menu parameters
menuParams1 := { "bgcolor" : 0xFFFFF4 ;background color of the menu R
, "iconssize" : 0 ;size of icons in the menu
, "tcolor" : 0x064D85} ; text color of the menu items 036FC5 1A86DB 054C84 064D85 02192C 043053
;Create an instance of PUM object, it is best to have only one of such in the program
pm := new PUM( pumParams )
;***************************************************************************************************************************
Menu, Tray, Icon, Resources\Scissors_Green.ico
Menu, Tray, NoStandard
Menu, tray, Add, %name% %version%, Nothing
Menu, tray, Icon, %name% %version%, Resources\Clipboard Utility.ico
Menu, Tray, Add
Menu, tray, Add, Exit , Exit
Menu, tray, Icon, Exit , shell32.dll, 132
Menu, Tray, Add
Menu, tray, Add, &Suspend Clipboard Utility , Stanby
Menu, tray, Icon,&Suspend Clipboard Utility , %A_ScriptDir%\Resources\Scissors_Red.ico
Menu, Tray, Add, Keep Only Hotkeys Necessary, SuspendHotkeys
Menu, Tray, Icon, Keep Only Hotkeys Necessary, Resources\No_Hotkeys.ico
Menu, Tray, Add
Menu, Tray, Add, Help, HelpButton
Menu, Tray, Icon, Help, %A_ScriptDir%\Resources\Help.ico
Menu, Tray, Add
Menu Tray, Add, Open Info, Tray_Open
Menu Tray, Icon, Open Info, %A_ScriptDir%\Resources\Info.ico
Menu, tray, Add, &Reload this Script , Reloaded
Menu, tray, Icon,&Reload this Script , %A_ScriptDir%\Resources\2488.ico
Menu, tray, Add, &Edit this Script , EditScript
Menu, tray, Icon,&Edit this Script , comres.dll, 7
Menu, tray, Add
Menu, winmanagetID, Add, Clipboard Window Extended, RButtonAlt
Menu, winmanagetID, icon, Clipboard Window Extended, %A_ScriptDir%\Resources\162.ico
Menu, winmanagetID, Add, Clipboard Window Reduced, ReducedAlt
Menu, winmanagetID, icon, Clipboard Window Reduced, %A_ScriptDir%\Resources\Clipboard Utility.ico
Menu, winmanagetID, Add, Utility Window, WUtil
Menu, winmanagetID, icon, Utility Window, %A_ScriptDir%\Resources\75a.ico
Menu, winmanagetID, Add, Copy Clipboard Window, CopyGui
Menu, winmanagetID, icon, Copy Clipboard Window, Resources\Clipboard Utility 5.ico
Menu, Tray, add, Window Management, :winmanagetID
Menu, tray, Icon, Window Management, %A_ScriptDir%\Resources\2036.ico
Menu, BasicClipID, Add, Disable Basic Clipboard, SuspendBasicClip
Menu, BasicClipID, Icon, Disable Basic Clipboard, Resources\Clipboard Utility 4.ico
Menu, BasicClipID, Add, Deactivate Notifications in Tray, SuspendNotifClip
Menu, BasicClipID, Icon, Deactivate Notifications in Tray, Resources\No_Sound.ico
Menu, BasicClipID, Add, Delete all Basic Clipboard, DeleteBasic
Menu, BasicClipID, Icon, Delete all Basic Clipboard, Resources\Recycle 2.ico
Menu, Tray, Add, Basic Clipboard, :BasicClipID
Menu, Tray, Icon, Basic Clipboard, Resources\Clipboard-Blue.ico
Menu, tray, Add
Menu, Tray, Add, Save all Clipboard to PDF File, SavePDF
Menu, Tray, Icon, Save all Clipboard to PDF File, %A_ScriptDir%\Resources\PDF.ico
Menu, Tray, Add, Save all Clipboard to Word File, SaveWord
Menu, Tray, Icon, Save all Clipboard to Word File, %A_ScriptDir%\Resources\Word1.ico
Menu, Tray, Add, Extract URL's from Clipboard, URLButton
Menu, Tray, Icon, Extract URL's from Clipboard, %A_ScriptDir%\Resources\URL.ico
Menu, ThumbnailID, Add, Postpone Thumbnail Creation, SuspendThumbnail
Menu, ThumbnailID, Icon, Postpone Thumbnail Creation, %A_ScriptDir%\Resources\1908.ico
Menu, ThumbnailID, Add, Create Missing Thumbnails, CreateMissing
Menu, ThumbnailID, Icon, Create Missing Thumbnails, %A_ScriptDir%\Resources\949.ico
Menu, Tray, Add, Thumbnail Creation, :ThumbnailID
Menu, Tray, Icon, Thumbnail Creation, %A_ScriptDir%\Resources\989.ico
Menu, DeleteID, Add, Delete Last Clipboard, DeleteLast
Menu, DeleteID, Icon, Delete Last Clipboard, %A_ScriptDir%\Resources\1892.ico
Menu, DeleteID, Add, Delete All Clipboard, DeleteAll
Menu, DeleteID, Icon, Delete All Clipboard, %A_ScriptDir%\Resources\Recycle Bin Full.ico
Menu, Tray, add, Delete Options, :DeleteID
Menu, tray, Icon, Delete Options, %A_ScriptDir%\Resources\Recycle 3.ico
Menu, Tray, add
;**********************************************************************************************
ReloadSession:
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal := A_Index-1
FileDelete, SessionNumber.txt
;If !CorpusCount=0
;{
NumberSessTemp := "HTMLTemp\Session.txt"
FileRead, Session1, %NumberSessTemp%
; Fileappend, %Session1% `n, SessionNumber.txt
;Menu, SessionID, add, %Session1%, LabelSessionAct1
;Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2293.ico
;Menu, SessionID, add
Menu, SessionID, add, Create New Session, NewSession
Menu, SessionID, Icon, Create New Session, %A_ScriptDir%\Resources\178.ico
Menu, SessionID, add, Delete Empty Sessions, DeleteSessions
Menu, SessionID, Icon, Delete Empty Sessions, %A_ScriptDir%\Resources\Recycle 2.ico
Menu, SessionID, add
Menu, SessionID, add, 0: %Session1%, LabelSessionAct1
Menu, SessionID, Icon, 0: %Session1%, %A_ScriptDir%\Resources\2478.ico
;Menu, SessionID, add, Current Session, LabelSessionAct0
;Menu, SessionID, Icon, Current Session, %A_ScriptDir%\Resources\2478.ico
;************************************************************************
loop, %SessionTotal%
{
FileDelete, SessionCount.txt
FileAppend, %A_ScriptDir%, SessionCount.txt
FullFile:="\HTMLTemp" A_Index "\*.*"
FileAppend, %FullFile%, SessionCount.txt
FileRead, CountFiles, SessionCount.txt
loop, %CountFiles%
FilesCount := % Floor(A_Index/6)
;If FilesCount="" FilesCount=0
NameTemp := ScriptDir "HTMLTemp" A_Index "\Session.txt"
FileRead, Session1, %NameTemp%
Fileappend, %Session1% — %FilesCount% Clipboards`n, SessionNumber.txt
}
Loop, read, SessionNumber.txt
{
Menu, SessionID, add, %A_Index%: %A_LoopReadLine%, LabelSession
}
Menu, Tray, add, Clipboard Sessions, :SessionID
Menu, Tray, Icon, Clipboard Sessions, %A_ScriptDir%\Resources\2036.ico
;**********************************************************************
ReloadMenu:
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
FileDelete, SesionName.txt
If !CorpusCount=0
{
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
Menu, ClipboardID, add, %A_Index%: %A_LoopReadLine%, ButtonLabelTray
}
Menu, Tray, add, Clipboard, :ClipboardID
Menu, Tray, Icon, Clipboard, C:\Windows\system32\shell32.dll,261
}
Menu, Tray, Default, Basic Clipboard
;Menu, Tray, Default, Window Management
;Menu, Tray, Tip, Clipboard Utility 4.1f
Menu, Tray, Tip, This Session has 0%CorpusCount% Clipboards
; Menu2
Gui, CopyButtom: new
Gui, CopyButtom: -Caption +Owner
Gui, CopyButtom:Color, ffffd6
Gui, CopyButtom:Margin, 12, 12
;Gui, CopyButtom:+Owner
Gui, CopyButtom:Add, Button, x1 y1 w64 h15 gExitCopy, Exit
Gui, CopyButtom:Add, Button, x1 y17 w64 h65 hwndIcon gCopyTexClip
Gui, CopyButtom:Add, Picture, x66 y0 w12 h81 E0x200 vState0 icon1 gSubRoutine1, Resources\PauseOn.png
Gui, CopyButtom:Add, Picture, x66 y0 w14 h83 Border vState1 icon1 gSubRoutine1, Resources\PauseOff.png
GuiButtonIcon(Icon, "Resources\Clipboard Utility 5.ico", 1, "s90")
/*
if FileExist("HTMLTemp\Text1.html")
MsgBox, 0x1034,, There are clipboards from a previous session `n`n Do you want to delete them?
IfMsgBox Yes
Gosub, Borrado
Else
*/
GoSub, Toggle_Switch
CorpusCount := 0
;DirectoryCount := 0
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
DirectoryCount := A_Index-1
;MsgBox, %DirectoryCount%
Filedelete, WorkingDir.txt
FileAppend, %A_ScriptDir%\, WorkingDir.txt
FileRead, ScriptDir, Workingdir.txt
threeRButton=1
loop, Documents\*.pdf
PDFCount := A_Index
If PDFCount != 0
{
PDFCount := PDFCount+1
}
;MsgBox, %PDFCount%
loop, Documents\*.docx
WordCount := A_Index
If WordCount != 0
{
WordCount := WordCount+1
}
If Iniciate=1
{
Return
}
;If !Iniciate=1
Gosub, RButton
Return
;^!v::^
^Up::
^MButton::
ClipBoardEnabled=0
MouseGetPos, mx, my, WinUMID
menu := pm.CreateMenu( menuParams1 )
index:=ClipBoardHistory.maxIndex()
if index=
return
while Index>=ClipBoardHistory.minIndex()
{
Description:=ClipBoardHistory[Index]["plain"]
FullDescription:=Description
;if(StrLen(Description)>35)
if(StrLen(Description)>80)
{
toCut:=StrLen(Description)-25
;toCut:=StrLen(Description)-50
;StringMid, itemTemp1, Description, 1, 12
StringMid, itemTemp1, Description, 1, 50
StringTrimLeft, itemTemp2, Description, %toCut%
Description=%itemTemp1%...%itemTemp2%
}
if index<10
MenuString:="&" . (ClipBoardHistory.maxindex()-Index+1) . ". " . Description
else
MenuString:= (ClipBoardHistory.maxindex()-Index+1) . ". " . Description
menu.Add( { "name" : MenuString
, "bold" : 1
, "index" : Index
, "tooltip" : ClipBoardHistory[Index]["plain"]})
index--
}
;WinGet, ActiveWindow , ID, A
MouseGetPos, xpos5, ypos5
xpos5 := xpos5-200
ypos5 := ypos5-100
;item := menu.Show( A_ScreenWidth/3, A_ScreenHeight/3 )
item := menu.Show( xpos5, ypos5 ), Basic Clipboard ; <<<<Menu
;tooltip
WinActivate, ahk_id %WinUMID%
WinWaitActive, ahk_id %WinUMID%
if item
{
ClipBoardEnabled=0
test:=item.index
;tempClip:=clipboard
WinClip.Clear()
clipboard:=ClipBoardHistory[test]["plain"]
;Sleep, 300
send, ^v
;clipboard:=tempClip
;ClipBoardEnabled=1
}
Menu.destroy()
ClipBoardEnabled=1
return
PUM_out( msg, obj )
{
; if ( msg = "onselect" )
; tooltip % obj.tooltip
; if ( msg = "oninit" )
; tooltip % "menu init: " obj.handle
; if ( msg = "onuninit" )
; tooltip % "menu uninit: " obj.handle
; if ( msg = "onrbutton" )
; tooltip % "Right clicked: " obj.name
; if ( msg = "onmbutton" )
; Clipboard:=obj.name
; ;ClipBoardEnabled=1
; ;tooltip % "Middle clicked: " obj.name
; if ( msg = "onrun" )
; tooltip % "Item runned: " obj.name
}
^F4::
GuiUtily:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
;Gui, -Caption +AlwaysOnTop HwndHwnd +Owner
Gui, Utily: -Caption HwndHwnd +Owner
;Gui, Utily: +Owner
Gui1.Hwnd := hwnd
;Gui, -Caption +alwaysontop +ToolWindow
Gui, Utily: Add, Picture, x0 y0 w739 h167, Resources\Clipboard Utility_p_2.png
;Gui, Add, Text, x0 y0 w691 h35 GuiMove ; , `&& Drag
Gui, Utily: Add, Picture, x0 y0 w691 h35 GuiMove, Resources\ArribaIzq1.png
;BUTTON 1
;************************************************************************************************************************
Gui1.Button1 := {} ;Button 1
Gui1.Button1.DefaultImage := "Resources\PDFup.png"
Gui1.Button1.HoverImage := "Resources\PDFhover.png"
Gui1.Button1.PressedImage := "Resources\PDFDown.png"
Gui1.Button1.Label := "SavePDF"
Gui, Utily: Add, Picture, x12 y36 w141 h115 hwndhwnd, % Gui1.Button1.DefaultImage
Gui1.Handles[ hwnd ] := "Button1" ;The name of the control to point at.
Gui1.Button1.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 2
;************************************************************************************************************************
Gui1.Button2 := {} ;Button 2
Gui1.Button2.DefaultImage := "Resources\WordUp.png"
Gui1.Button2.HoverImage := "Resources\WordOver.png"
Gui1.Button2.PressedImage := "Resources\WordDown.png"
Gui1.Button2.Label := "SaveWord"
Gui, Utily: Add, Picture, x154 y36 w141 h115 hwndhwnd, % Gui1.Button2.DefaultImage
Gui1.Handles[ hwnd ] := "Button2" ;The name of the control to point at.
Gui1.Button2.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 3
;************************************************************************************************************************
Gui1.Button3 := {} ;Button 3
Gui1.Button3.DefaultImage := "Resources\PasteUp.png"
Gui1.Button3.HoverImage := "Resources\PasteHover.png"
Gui1.Button3.PressedImage := "Resources\PasteDown.png"
Gui1.Button3.Label := "ControlPaste"
Gui, Utily: Add, Picture, x297 y36 w141 h115 hwndhwnd, % Gui1.Button3.DefaultImage
Gui1.Handles[ hwnd ] := "Button3" ;The name of the control to point at.
Gui1.Button3.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 4
;************************************************************************************************************************
Gui1.Button4 := {} ;Button 4
Gui1.Button4.DefaultImage := "Resources\UrlUp.png"
Gui1.Button4.HoverImage := "Resources\UrlHover.png"
Gui1.Button4.PressedImage := "Resources\UrlDown.png"
Gui1.Button4.Label := "URLButton"
Gui, Utily: Add, Picture, x440 y36 w141 h115 hwndhwnd, % Gui1.Button4.DefaultImage
Gui1.Handles[ hwnd ] := "Button4" ;The name of the control to point at.
Gui1.Button4.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 5
;************************************************************************************************************************
Gui1.Button5 := {} ;Button 5
Gui1.Button5.DefaultImage := "Resources\HelpUp.png"
Gui1.Button5.HoverImage := "Resources\HelpHover.png"
Gui1.Button5.PressedImage := "Resources\HelpDown.png"
Gui1.Button5.Label := "HelpButton"
Gui, Utily: Add, Picture, x583 y36 w141 h115 hwndhwnd, % Gui1.Button5.DefaultImage
Gui1.Handles[ hwnd ] := "Button5" ;The name of the control to point at.
Gui1.Button5.Hwnd := hwnd
;************************************************************************************************************************
;BUTTON 6
;************************************************************************************************************************
Gui1.Button6 := {} ;Button 6
Gui1.Button6.DefaultImage := "Resources\ExitUp1.png"
Gui1.Button6.HoverImage := "Resources\ExitHover1.png"
Gui1.Button6.PressedImage := "Resources\ExitDown1.png"
;Gui1.Button6.Label := "ExitLabel"
Gui1.Button6.Label := "GuiClose"
Gui, Utily: Add, Picture, x691 y0 w48 h35 hwndhwnd, % Gui1.Button6.DefaultImage
Gui1.Handles[ hwnd ] := "Button6" ;The name of the control to point at.
Gui1.Button6.Hwnd := hwnd
;************************************************************************************************************************
/*
MouseGetPos, xpos2, ypos2
Gui, Show, x%xpos2% y%ypos2% W600 h167, Hover Demo
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
*/
MouseGetPos, xposUtil, yposUtil
If UtilButton=1
{
xposUtil := Floor((A_ScreenWidth/2)-450)
yposUtil := Floor((A_ScreenHeight/2)-200)
}
Gui, Utily: Show, x%xposUtil% y%yposUtil% W739 h167, Hover
OnMessage( 0x200 , "ButtonHover" )
OnMessage( 0x201 , "ButtonPress" )
Return
;************************************************************************************************************************
ButtonHover(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( !Gui1.Active && !Gui1.Pressed && Gui1.Handles[ ctrl ] ){ ;If a button isn't already active (Hover) and if no buttons are being pressed, and there is a match for the control in the Handles array.
Gui1.Active := ctrl ;Assign this control as being the active control
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].HoverImage ;Set the picture to the hover image
SetTimer, WatchLeaveHover, 30 ;Set a timer to watch for the cursor leaving this control (turn off hover)
}
}
WatchLeaveHover: ;checks to see if the control that was being hovered is still being hovered.
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Pressed ){ ;If a button is being pressed, skip for another 30ms
return
}else if( ctrl != Gui1.Active ){ ;if the control under the cursor isn't the same as the control that is being hovered. (if you move your cursor away from the control)
GuiControl,, % Gui1.Active , % Gui1[ Gui1.Handles[ Gui1.Active ] ].DefaultImage ;Set the picture back to the default image
SetTimer, WatchLeaveHover, Off ;Turn off the timer
Gui1.Active := "" ;empty this so that a new control can be hovered.
}
return
ButtonPress(){
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor
if( Gui1.Handles[ctrl] ){ ; if the control under the cursor is a valid control.
Gui1.Pressed := ctrl ;Assign this control as being the pressed control
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].PressedImage ;Set the picture to the pressed image
While( GetKeyState( "LButton" ) ) ;While you continue to hold the mouse down, wait a few ms
Sleep, 30
MouseGetPos,,,, ctrl, 2 ;Get the hwnd of the control under the cursor again
if( ctrl = Gui1.Pressed ){ ;Test to see if it is still the same as the control you clicked on.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].HoverImage ;Set the picture to the Hover image
Gui1.Pressed := "" ;empty
try
gosub, % Gui1[ Gui1.Handles[ ctrl ] ].Label ;if the control has a label, run it.
}else{ ;if the control is not the same. Cancel running that controls label and set the control back to its default image.
GuiControl,, % Gui1.Pressed , % Gui1[ Gui1.Handles[ Gui1.Pressed ] ].DefaultImage ;Set the picture to the Default image
Gui1.Pressed := "" ;empty
}
}
}
;************************************************************************************************************************
WUtil:
UtilButton:=1
Gosub, GuiUtily
Return
^F3::
MainProcess:
Gui, Submit
If !ClipBoardEnabled=0
{
ClipBoardEnabled:=0
ChangeClipEnable=1
}
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
last := Clipboard, Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
} Else If (Clipboard = last) {
SoundPlay, Resources\ambiguity2.mp3
TrayTip, Clipboard Message, REPEATED CLIPBOARD!,, 0x2, 0x10, 0x20
Return
} Else {
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Clipboard Message, %Clipboard%,, 0x1, 0x10, 0x20
}
SetTimer, HideTrayTip, -1500
;Data:=clip_GetHtmlString()
accData:= GetAccData()
;******************************************************************************************************************
If not ClipboardGet_HTML( Data )
{
ErrorType :=1
Gosub, ControlError
;MsgBox, The content of the clipboard does not have a valid format to be saved and the operation will be canceled.
Return
}
Else
CorpusCount++
;******************************************************************************************************************
FileTex := "HTMLTemp\Text" CorpusCount ".html"
aData := accData.1
LenText := StrLen(aData)
StringGetPos, pos, aData, -, r1
length := pos-1
StringLeft, OutText, aData, %length%
FileaccData := "HTMLTemp\Name" CorpusCount ".txt"
FileAppend, %OutText%, %FileaccData%, CP65001
;******************************************************************************************************************
FileGetSize, SizeFile, %FileaccData%
If !FileaccData or SizeFile=3
{
ErrorType :=0
Gosub, ControlError
If ErrorTex=0
Return
}
;******************************************************************************************************************
FileURL := "HTMLTemp\URL" CorpusCount ".txt"
2Data := accData.2
FileAppend, %2Data%, %FileURL%, CP65001
Sleep 300
myResult := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" accData.2 ">" OutText "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResult%, %FileTex%
;******************************************************************************************************************
FileGetSize, SizeFile1, %FileTex%
If !FileTex or SizeFile1=3
{
ErrorType :=0
Gosub, ControlError
If ErrorTex=0
Return
}
;******************************************************************************************************************
;ClipboardGet_HTML( Data )
DataReplace := StrReplace(Data, "<h1", "<p")
DataReplace1 := StrReplace(DataReplace, "</h1", "</p")
FileAppend, %DataReplace1%, Temp.html ;, CP65001
;******************************************************************************************************************
FileGetSize, SizeFile2, Temp.html
;MsgBox, %SizeFile2%
FileHTML := "Temp.html"
If !FileHTML or SizeFile2=3
{
ErrorType :=1
Gosub, ControlError
;If ErrorTex=0
Return
}
;******************************************************************************************************************
clipboard=%clipboard%
Plain := "HTMLTemp\TextPlain" CorpusCount ".txt"
FileAppend, %clipboard%, %Plain%, CP65001
Loop, read, Temp.html
{
If A_Index >6
FileAppend, %A_LoopReadLine%`n, TempPDF.html
}
;NameCopy := "HTMLTemp\Temp" CorpusCount ".html"
;FileCopy, TempPDF.html, %NameCopy%
RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 TempPDF.html temp2.html ,,hide
If SuspendThumbnail=0
{
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 temp2.html Image_Temp.jpg,,hide
Gosub, ResizeH
ImageCount := "HTMLTemp\Image" CorpusCount ".jpg"
FileMove, Image_Temp.jpg, %ImageCount%
;**********************
If !ImageCount
{
ErrorType :=2
Gosub, ControlError
}
;**********************
FileDelete, Image_Temp.jpg
}
NameCount := "HTMLTemp\Corpus" CorpusCount ".html"
FileMove, Temp2.html, %NameCount%
FileDelete, Temp*.html
;Gosub, CheckProcess
SoundPlay, Resources\Clipboard_Sound.mp3
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -1200
Iniciate:=1
Data :=""
If ChangeClipEnable=1
{
WinClip.Clear()
ClipBoardEnabled=1
ChangeClipEnable=0
}
Gosub, ReloadMenu
Return
ControlError:
If ErrorType =0
{
MsgBox, 0x1024,, You have not been able to save the name of the clipboard source, you will be able to name it later. `nContinue in every way?
IfMsgBox Yes
{
ErrorTex:=1
Return
}
ErrorText:=0
Return
}
If ErrorType =1
{
MsgBox, The content of the clipboard does not have a valid format to be saved and the operation will be canceled.`n(The source of the text must be from the Internet or from formatted Word or PDF files opened with a browser.)
;CorpusCount++
;FileDelete,
Return
}
If ErrorType =2
;{
;MsgBox, 0x1024,, The clipboard image could not be saved. The clipboard exists, but it won't display an image `nContinue in every way?
MsgBox, The clipboard image could not be saved. The clipboard exists, but it will not display an image.`n It can be created later.
*/
IfMsgBox Yes
{
ErrorImg:=1
Return
}
ErrorImg:=0
*/
Return
;}
Return
ResizeH:
filePath := "Image_Temp.jpg"
size := GetImageSize(filePath)
If size.H !>500
return
else
if ErrorLevel
return
crop(FilePath, 0, 0, W, 500)
Return
/*
CheckProcess:
Corpus:= "HTMLTemp\Corpus" CorpusCount ".html"
Corpus:= "HTMLTemp\Image" CorpusCount ".jpg"
Corpus:= "HTMLTemp\name" CorpusCount ".txt"
Corpus:= "HTMLTemp\TextPlain" CorpusCount ".txt"
Corpus:= "HTMLTemp\URL" CorpusCount ".txt"
Corpus:= "HTMLTemp\Text" CorpusCount ".txt"
Return
*/
CopyGui:
CopyButton:=1
;GoSub, Toggle_Switch
Gosub, Menu2
Return
ClipDelete:
StringTrimLeft, DelClip, a_guicontrol, 12
MsgBox, 0x1034,, Do you want to delete the %DelClip%st entrance of the clipboard?
IfMsgBox Yes
{
Gui, 4: Destroy
Gui, ContextClip: Destroy
FileDelete, HTMLTemp\Corpus%DelClip%.html
FileDelete, HTMLTemp\image%DelClip%.jpg
FileDelete, HTMLTemp\Name%DelClip%.txt
FileDelete, HTMLTemp\Text%DelClip%.html
FileDelete, HTMLTemp\TextPlain%DelClip%.txt
FileDelete, HTMLTemp\URL%DelClip%.txt
Loop, %CorpusCount%
if !FileExist("TextPlain" A_Index ".txt")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "HTMLTemp\TextPlain" Filesup ".txt"
NumF:= "HTMLTemp\TextPlain" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\URL" Filesup ".txt"
NumF:= "HTMLTemp\URL" NumberFile ".txt"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Corpus" Filesup ".html"
NumF:= "HTMLTemp\Corpus" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Text" Filesup ".html"
NumF:= "HTMLTemp\Text" NumberFile ".html"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Image" Filesup ".jpg"
NumF:= "HTMLTemp\Image" NumberFile ".jpg"
Filemove, %Sup%, %NumF%
Sup := "HTMLTemp\Name" Filesup ".txt"
NumF:= "HTMLTemp\Name" NumberFile ".txt"
Filemove, %Sup%, %NumF%
}
;CorpusCount--
;Gosub, RButton
Iniciate:=0
Menu, ClipboardID, DeleteAll
;Gosub, IniciateUtility
Gosub, ReloadMenu
}
Return
^F8::
Menu2:
;MouseGetPos, xpos1, ypos1
MouseGetPos, xposMen, yposMen
If CopyButton=1
{
xposMen := Floor(A_ScreenWidth/2)
yposMen := Floor(A_ScreenHeight/2-100)
}
Gui, CopyButtom:Show, x%xposMen% y%yposMen% W81 h84
Return
+RButton::
RButton:
global Gui1 := {} ;Main object for everything to do with this gui.
Gui1.Handles := [] ;an array that uses the hwnd of a control as its index position. (this has the name of the controls main object as its values)
;Gui1.Active := "" ;The hwnd of the currently hovered button
Gui1.Pressed := "" ;The hwnd of the currently pressed button
Gui1.Hwnd := hwnd
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip: Add, Button, x0 y%posy% w20 h20 hwndIcon hwndIcon8 gGoURL vTURL%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x520 y%posy% w20 h20 hwndIcon gTxtLabel vTCopy%A_Index%, %A_Index%
Gui, ContextClip: Add, Button, x540 y%posy% w20 h20 hwndIcon1 gTxtPlane vTplane%A_Index%
Gui, ContextClip: Add, Button, x20 y%posy% w20 h20 hwndIcon10 gClipDelete vDeleteButton%A_Index%
Gui, ContextClip: Add, Button, x500 y%posy% w20 h20 hwndIcon9 gTitleEditing vEditing%A_Index%
Gui, ContextClip: Add, Button, x40 y%posy% w460 h20 gButtonLabel vNameButton%A_Index%, %A_LoopReadLine%
GuiButtonIcon(Icon, "Resources\clipboard.ico", 1, "s32")
GuiButtonIcon(Icon1, "Resources\128.ico", 1, "s32")
GuiButtonIcon(Icon8, "Resources\ArrowSmall.ico", 1, "s32")
GuiButtonIcon(Icon10, "Resources\recycle 2.ico", 1, "s32")
GuiButtonIcon(Icon9, "Resources\pencil 1.ico", 1, "s24")
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip: Margin, 2, 2
;Gui, ContextClip: -Caption +ToolWindow +0x400000 +hWndhMainWnd HwndHwnd ;Menu3s
Gui, ContextClip: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd +Owner
;Gui, ContextClip: color,ffffd6
;Gui, Font, S14 Bold, Verdana
;WinSet, Transparent
;Gui, ContextClip:+Owner
posyExitSess := posyExit+20
;LeeSession:= ScriptDir "\HTMLTemp\Session.txt"
LeeSession:= "HTMLTemp\Session.txt"
FileRead, SessClip, %LeeSession%
Gui, ContextClip: Add, Picture, x0 y%posyExit% W560 h32, Resources\Fondo_p.png
Gui, ContextClip: Add, Picture, x0 y%posyExit% W29 h32 gLabelSessionAct0, Resources\IConChange.png
Gui, ContextClip: Add, Picture, x30 y%posyExit% W435 h32 GuiMove, Resources\Resto1.png
;***********************************************************************
Gui1.Button7 := {} ;Button 7
Gui1.Button7.DefaultImage := "Resources\Reducedcap.png"
,Gui1.Button7.HoverImage := "Resources\Close.png"
Gui1.Button7.PressedImage := "Resources\Reducedcap1.png"
;Gui1.Button7.Label := "ReducedM"
Gui, ContextClip: Add, Picture, x487 y%posyExit% W72 h32 gReducedM hwndhwnd, % Gui1.Button7.DefaultImage
Gui1.Handles[ hwnd ] := "Button7" ;The name of the control to point at.
Gui1.Button7.Hwnd := hwnd
;***********************************************************************
Gui1.Button8 := {} ;Button 8
Gui1.Button8.DefaultImage := "Resources\Close.png"
,Gui1.Button8.HoverImage := "Resources\Close.png"
Gui1.Button8.PressedImage := "Resources\Close1.png"
Gui1.Button8.Label := "ExitLabel"
Gui, ContextClip: Add, Picture, x457 y%posyExit% W30 h32 hwndhwnd, % Gui1.Button8.DefaultImage
Gui1.Handles[ hwnd ] := "Button8" ;The name of the control to point at.
Gui1.Button8.Hwnd := hwnd
;***********************************************************************
Gui, ContextClip: Font, S9 Bold, Verdana
posyExitSess1 := posyExit+08
Gui, ContextClip: Add, Text, cYellow BackgroundTrans +Center x2 y%posyExitSess1% vTextTitle W536 h20, %SessClip%
MouseGetPos, xpos1, ypos1
If threeRButton=1
{
xpos1 := Floor((A_ScreenWidth/2)-450)
ypos1 := Floor((A_ScreenHeight/2)-200)
}
If ControlTwo=1
{
xpos1 := XActTwo-140
ypos1 := yActTwo-13
}
;xpos1 := xpos1-560
;ypos1 := ypos1-alto
AltoSess := Alto+12
Gui, ContextClip: Show, x%xpos1% y%ypos1% w560 h%AltoSess% ;Menu3s
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
OnMessage( 0x201 , "ButtonPress" )
Gosub, NewWindow
return
RButtonAlt:
threeRButton :=1
Gosub, RButton
Return
TitleEditing:
Gosub, NewWindow
StringTrimLeft, REdit, a_guicontrol, 7
FileChange := "HTMLTemp\Name" REdit ".txt"
FileRead, FileCont, %FileChange%
Gui, Edit: -Caption +alwaysontop +ToolWindow +hWndhMainWnd +Owner
;Gui, Edit:+Owner
Gui, Edit: Font, S10 Bold, Verdana
Gui, Edit: Add, Picture, x0 y0 h20 w564 h32, Resources\Fondo_Limp.png
Gui, Edit: Add, Text, cYellow BackgroundTrans x35 y6 W560 h32 GuiMove, Clipboard Title
Gui, Edit: Add, Text, x0 y33 w563 0x10 ; 0x7 Black
Gui, Edit: Font, S8 Bold, Verdana
Gui, Edit:Add, Edit, x5 y40 w544 h20 vMyEdit, %FileCont%
;Gui, Edit: Add, Edit, x12 y9 w460 h20 vMyEdit%REdit%, %FileCont%
Gui, Edit:Add, Button, x20 y70 w70 h20 gTitleSave, OK
Gui, Edit:Add, Button, x120 y70 w70 h20 gTitleCancel, Cancel
Gui, Edit:Add, CheckBox, x240 y70 w210 h20 Checked1 vVeryfyChange, Change also the Title to Paste
EdXm := pXm-846
EdYm := pYm-148 ;96
Gui, Edit:Show, x%EdXm% y%EdYm% w564
Return
TitleSave:
Gui, Edit: Submit, Destroy
fileAdd := FileOpen(FileChange, "w")
fileAdd.Write(MyEdit)
fileAdd.Close()
If VeryfyChange=1
{
ReadURL := "HTMLTemp\URL" REdit ".txt"
Fileread URLTxt, %ReadURL%
ReadText:= "HTMLTemp\Text" REdit ".html"
FileDelete, %ReadText%
myResultSave := "<h1><span lang=ES-ES style='font-size:10.0pt;color:#78230C;mso-ansi-language:ES-ES'>Text extracted from:<br></span><span style='font-size:12.0pt'><a href=" URLTxt ">" MyEdit "</a> <o:p></o:p></span></p></h1>"
FileAppend, %myResultSave%, %ReadText%
}
MyEdit :=""
FileCont :=""
FileChange :=""
Gosub, RButton
Return
TitleCancel:
Gui, Edit: Destroy
MyEdit :=""
FileCont :=""
FileChange :=""
;Gosub, NewWindow
Gosub, RButton
Return
ReducedM:
WinGetPos, XActOne, YActOne,,, A
Gui, ContextClip: Destroy
SoundPlay, Resources\Close Window.mp3
ControlOne :=1
ControlTwo :=0
Gosub, NotifyTrayClick_207
Return
NotifyTrayClick_207:
FileDelete, SesionName.txt
Gui, ContextClip: new
Gui, 2: new
Gui, 3: new
Loop, %CorpusCount%
{
NameTemp := "HTMLTemp\Name" A_Index ".txt"
FileRead, Name1, %NameTemp%
FileAppend, %Name1%`n, SesionName.txt
}
Loop, read, SesionName.txt
{
posy:=20*(A_Index-1)
Gui, ContextClip1: Add, Button, x0 y%posy% w460 h20 gButtonTwo vTwoButton%A_Index%, %A_LoopReadLine%
} ; Menu3
Alto := CorpusCount*20+20
posyExit:=20*CorpusCount
;Gui, ContextClip1: Margin, 2, 2
Gui, ContextClip1: -Caption +alwaysontop +ToolWindow +0x400000 +hWndhMainWnd +Owner ;Menu31s
Gui, ContextClip1: color,ffffd6
;Gui, Font, S14 Bold, Verdana
;Gui, ContextClip1:+Owner
Gui, ContextClip1: Add, Button, x20 y%posyExit% w380 h20 gExitLabel, Exit Menu
Gui, ContextClip1: Add, Button, x400 y%posyExit% w60 h20 hwndIcon20 gExtendedM
Gui, ContextClip1: Add, Text, x0 y%posyExit% w20 h20 GuiMove
Gui, ContextClip1: Add, Button, x0 y%posyExit% w20 h20 hwndIcon21
AltoT := Floor((CorpusCount+1)*31.5)
XPos:= A_ScreenWidth-(700)
YPos:= A_ScreenHeight-AltoT-60
If threeRButton=1
{
xpos := Floor((A_ScreenWidth/2)-450)
ypos := Floor((A_ScreenHeight/2)-200)
}
If ControlOne=1
{
xPos := XActOne
yPos := YActOne
}
Gui, ContextClip1: Show, x%XPos% y%YPos% w460 h%Alto% ;Menu3s
GuiButtonIcon(Icon21, "Resources\Hand4.ico", 1, "s32")
GuiButtonIcon(Icon20, "Resources\ArrowExt.png", 1, "W90" "H30")
VarSetCapacity(tme,16,0)
NumPut(16,tme,0), NumPut(2,tme,4), NumPut(hwnd,tme,8)
OnMessage(0x2A3,"OnMouseLeave")
OnMessage(0x200,"OnMouseMove")
Gosub, NewWindow
return
ExtendedM:
WinGetPos, XActTwo, YActTwo,,, A
Gui, ContextClip1: Destroy
SoundPlay, Resources\Close Window.mp3
ControlOne :=0
ControlTwo :=1
Gosub, RButton
Return
~+LButton::start := A_TickCount
~+LButton Up::
If (A_TickCount - start < 1200)
Return
MouseGetPos,,, WinUMID
MouseGetPos, xpos1, ypos1
Gui, CopyButtom:Show, x%xpos1% y%ypos1% W79 h87 ;Menu2S
Return
ReducedAlt:
threeRButton :=1
Gosub, NotifyTrayClick_207
Return
GoURL:
StringTrimLeft, TextURL, a_guicontrol, 4
gURL := "HTMLTemp\URL" TextURL ".txt"
FileRead, WebURL, %gURL%
Run, %WebURL%
Return
HelpButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: New
Gui, Help: -Caption +Owner
;Gui, Help: +Owner
Gui, Help: Color, EEAA99
Gui, Help: Margin, 0, 0
Gui, Help: Add, Picture, x0 y0 w640 h250, Resources\Help.jpg
Gui, Help: Add, Button, x495 y209 w100 h30 gNextButton, More...
Gui, Help: Show, w640 h250
Return
NextButton:
SoundPlay, Resources\Close Window.mp3
Gui, Help: Destroy
Gui, Help2: New
Gui, Help2: -Caption +Owner
;Gui, Help2: +Owner
Gui, Help2: Color, EEAA99
Gui, Help2: Margin, 0, 0
Gui, Help2: Add, Picture, x0 y0 w800 h397, Resources\Clipboard Utility Screenshot.jpg
Gui, Help2: Add, Button, x10 y340 w100 h30 gExitButton, Exit
Gui, Help2: Show, w800 h397
Return
ExitButton:
Gui, Help2: Destroy
Return
!esc::
Gui, 2: Destroy
Gui, ContextClip: Hide
;Gui, 2:default
;Gui, destroy
Return
HideTrayTip:
TrayTip
Return
uiMove:
PostMessage, 0xA1, 2,,, A
Return
GuiEscape:
GuiClose:
ExitCopy:
SoundPlay, Resources\Close Window.mp3
CopyButton=0
UtilButton :=0
Gui, Hide
Gui, CopyButtom:Hide
Return
;*************************************************************************
alert:
if (status_button=status_button_old)
return
Gui, 2:default
Gui, destroy
NumberFile:= RegExReplace(status_button,"\D")
image_file := "HTMLTemp\Image" NumberFile ".jpg"
if !image_file
return
Gui,3:Destroy
Gui,2: -border -caption +toolwindow
Gui, 2: Margin, 2, 2
gui,2: color,202020
gui,2: add,picture,vpic ,%image_file%
Gui,2: Show, x%pXm% y%pYm%
status_button_old:=status_button
return
;*************************************************************************
Deletealert:
if (status_delete=status_delete_old)
return
Gui, 4:default
Gui, destroy
NumberDelete:= RegExReplace(status_delete,"\D")
if !NumberDelete
return
Html =
(
<html><head><Style>
body {background-color: #FFFFF4; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Delete Clipboard Number %NumberDelete%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 4:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 4:margin, 0, 0
Gui, 4:add, ActiveX, vWB w64 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
DelXm := pXm-944
GuiControl, Move, WB, h%maxBottom%
Gui, 4: Show, x%DelXm% y%pYm% w64 h60
status_delete_old:=status_delete
Return
;*************************************************************************
Copyalert:
if (status_Copy=status_Copy_old)
return
Gui, 6:default
Gui, destroy
NumberCopy:= RegExReplace(status_Copy,"\D")
if !NumberCopy
return
Html =
(
<html><head><Style>
body {background-color: #FFFFF4; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Copy Item %NumberCopy% as Current Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 6:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 6:margin, 0, 0
Gui, 6:add, ActiveX, vWB w60 h72, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 6: Show, x%pXm% y%pYm% w60 h72
status_Copy_old:=status_Copy
Return
;*************************************************************************
URLalert:
if (status_URL=status_URL_old)
return
Gui, 5:default
Gui, destroy
NumberURL:= RegExReplace(status_URL,"\D")
URL_file := "HTMLTemp\URL" NumberURL ".txt"
if !URL_file
return
;Gui,2:Destroy
;URL_file := "HTMLTemp\URL" NumberURL ".txt"
FileRead, URLContents, %URL_file%
Html =
(
<html><head><Style>
body {background-color: #FFFFF4; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Go to: %URLContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 5:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 5:margin, 0, 0
Gui, 5:add, ActiveX, vWB w562 h30, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
DelXm := pXm-845
;DelXm := pXm-819
DelYm := pYm-47
;Gui, 5: Show, x%DelXm% y%DelYm% w543 h30
Gui, 5: Show, x%DelXm% y%DelYm% w562 h30
status_URL_old:=status_URL
Return
;*************************************************************************
Planealert:
if (status_plane=status_plane_old)
return
Gui, 3:default
Gui, destroy
NumberPlane:= RegExReplace(status_plane,"\D")
Text_file := "HTMLTemp\TextPlain" NumberPlane ".txt"
if !NumberPlane
return
Gui,2:Destroy
Gui,5:Destroy
FileRead, FileContents, %Text_file%
Html =
(
<html><head><Style>
body {background-color: #FFFFF4; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 10pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">%FileContents%</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 3:+AlwaysOnTop -Caption +ToolWindow Border
Gui, 3:margin, 0, 0
Gui, 3:add, ActiveX, vWB w320 h220, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
GuiControl, Move, WB, h%maxBottom%
Gui, 3: Show, x%pXm% y%pYm% w320 h220
status_plane_old:=status_plane
Return
;*************************************************************************
Editingalert:
if (status_Editing=status_Editing_old)
return
Gui, 6:default
Gui, destroy
EditingNumber:= RegExReplace(status_Editing,"\D")
if !EditingNumber
return
Gui,2:Destroy
Gui,5:Destroy
Html =
(
<html><head><Style>
body {background-color: #FFFFF4; overflow: hidden}
p {font-family: 'Raleway-Thin'; font-size: 9pt; }
.words {color: #3d3c3c;}
.reference {color: #00ffff;}
</style></head><body>
<p class="words">Edit Title of the %EditingNumber%th Clipboard</p>
<p class="reference">%f_ref%</p>
</body></html>
)
Gui, 7: +AlwaysOnTop -Caption +ToolWindow Border
;Gui, +AlwaysOnTop -Caption +ToolWindow Border
gui, 7:margin, 0, 0
gui, 7:add, ActiveX, vWB w62 h60, HTMLfile
WB.write(html)
children := WB.body.children
maxBottom := 0
Loop % children.length {
rect := children[A_Index - 1].getBoundingClientRect()
(rect.bottom > maxBottom && maxBottom := rect.bottom)
}
maxBottom *= 96/A_ScreenDPI
maxBottom += 15 ; some value you want for the padding-bottom
;DelXm := pXm-953
GuiControl, Move, WB, h%maxBottom%
gui, 7: Show, x%pXm% y%pYm% w62 h60
status_Editing_old:=status_Editing
Return
;*************************************************************************
^F6::
ControlPaste:
MsgBox, 0x1034,, You have requested to paste all the contents of the clipboard.`nDo you have an open text editor?`n`nMake sure you do not move the mouse, or change the focus on the application.
IfMsgBox No
Return
Else
Sleep, 1000
Gui, Utily: Destroy
;Gui, Hide
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
WinClip.Clear()
Loop, %CorpusCount% ;Loop, %Number% ;so many loops are given as clipboard exist
{
; if (Errorlevel = 1)
; Break
; else if (Errorlevel = 0)
; {
Sleep, 1200
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" A_Index ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
;WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" A_Index ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
;SendInput {Del}
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
}
;}
TrayTip, Timed TrayTip, Successful Process!, 0x1, 0x10, 0x20
SetTimer, HideTrayTip, -2000
SoundPlay, Resources\Close Window.mp3
Return
^F10::
DeleteAll:
MsgBox, 0x1034,, Do you want to delete all stored clipboards?
IfMsgBox Yes
Gosub, Borrado
Return
^F5::
SavePDF:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a PDF File?
IfMsgBox No
Return
Else
Gui, Utily: Destroy
Sleep, 1000
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
FileRead, html3, Resources\PDFLine.html
FileAppend, %html3%<br/>, ToPDF.html
}
}
;RunWait, %A_WorkingDir%\Addons\conv.exe -b 65001 ToPDF.html TempPDF.html ,,hide
RunWait, %A_WorkingDir%\Addons\wkhtmltopdf.exe ToPDF.html Final_Document.pdf,,hide
PDFCount++
FormatTime, CurrentDate,, dd-MM-yyyy
Filedate := "Documents\Final_Document_" CurrentDate "-" PDFCount ".pdf"
Filedateh := "Documents\ToPDF_" CurrentDate "-" PDFCount ".html"
FileMove, Final_Document.pdf, %Filedate%
Run, %Filedate%
FileMove, ToPDF.html, %Filedateh%
;FileDelete, ToPDF.html
;FileDelete, TempPDF.html
Return
^F7::
SaveWord:
MsgBox, 0x1024,, Convert %CorpusCount% Clipboard to a Word File?
IfMsgBox No
Return
Else
Gui, Utily: Destroy
Sleep, 1000
;ToolTip, Saving clipboard to docx file...
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToWord.html, CP65001
;FileRead, Line1, Resources\WordLine.html
;FileAppend, %Line1%, ToWord.html, CP65001
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToWord.html, CP65001
FileRead, Line2, Resources\WordLine.html
FileAppend, %Line2%, ToWord.html, CP65001
}
}
WinClip.Clear()
html := FileOpen("ToWord.html", "r").read()
WinClip.SetHTML(html)
Filedelete, WorkingDir.txt
FileAppend, %A_ScriptDir%\, WorkingDir.txt
FileRead, ScriptDir, Workingdir.txt
Clip:= ScriptDir "Word.docx"
ClipToDoc( clip )
WordCount++
FormatTime, CurrentDate,, dd-MM-yyyy
FileWord := ScriptDir "\Documents\Final_Document_" CurrentDate "-" WordCount ".docx"
FileMove, Word.docx, %FileWord%
Run, %FileWord%
FileDelete, ToWord.html
Return
^F11::
;^!z::
DeleteLast:
MsgBox, 0x1034,, Do you want to delete the last entrance of the clipboard?
IfMsgBox Yes
;FileDelete, HTMLTemp\*%CorpusCount%.*
FileDelete, HTMLTemp\Corpus%CorpusCount%.html
FileDelete, HTMLTemp\image%CorpusCount%.jpg
FileDelete, HTMLTemp\Name%CorpusCount%.txt
FileDelete, HTMLTemp\Text%CorpusCount%.html
FileDelete, HTMLTemp\TextPlain%CorpusCount%.txt
FileDelete, HTMLTemp\URL%CorpusCount%.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, ReloadMenu
;CorpusCount--
Return
;************************************************************************************************************************
OnClipboardChange:
if (ClipBoardEnabled=1) and ((A_TickCount-StartTicks)>1)
{
currentClip=%clipboard%
;currentClipAll=%clipboardall%
If (A_EventInfo=1) and (currentClip <> previousClip)
{
previousClip=%clipboard%
If NotifyClip=1
{
TrayTip,, %currentClip%
SoundPlay, Close Window.mp3
SetTimer, HideTrayTip, -1000
}
ClipSave(ClipBoardHistory,currentclip, 15)
}
}
Return
ClipSave(ClipBoardHistory,clip,maxclips=15)
{
ClipBoardHistory.insert(Object())
index:=ClipBoardHistory.MaxIndex()
ClipBoardHistory[index]["plain"]:=clip
;ClipBoardHistory[index]["All"]:=clipall
ClipTemp:= "TempClip\Clip" index ".clip"
If Index<=15
{
FileAppend, %Clip%, %ClipTemp%
}
if (index>maxclips)
{
ClipBoardHistory.Remove(ClipBoardHistory.MinIndex())
FileDelete, TempClip\Clip1.clip
Loop 15
if !FileExist("TempClip\Clip" A_Index ".clip")
{
NumberFile := A_Index
FileSup := NumberFile+1
Sup := "TempClip\Clip" Filesup ".clip"
NumF:= "TempClip\Clip" NumberFile ".clip"
Filemove, %Sup%, %NumF%
}
FileAppend, %Clip%, TempClip\Clip15.clip
}
}
;************************************************************************************************************************
^Esc::
Exit:
ExitApp
Return
Borrado:
FileDelete, HTMLTemp\Text*.html
FileDelete, HTMLTemp\Corpus*.html
FileDelete, HTMLTemp\image*.jpg
FileDelete, HTMLTemp\Name*.txt
FileDelete, HTMLTemp\TextPlain*.txt
FileDelete, HTMLTemp\URL*.txt
Iniciate:=1
Menu, ClipboardID, DeleteAll
Gosub, LabelSessionAct1
CorpusCount :=0
;Gosub, ReloadSession
Gosub, ReloadMenu
Return
ButtonTwo:
StringTrimLeft, NumberFile, a_guicontrol, 9
;Gui, 2: Destroy
;Gui, ContextClip: Destroy
Gosub, ButtonLabel
Return
LabelSession:
;NumberFile:=A_ThisMenuItemPos
;Menu, tray, ToggleCheck, &Suspend Clipboard Utility
;Menu, tray, ToggleCheck, Clipboard Sessions
MsgBox, 0x1024,, You want the session %A_ThisMenuItem% to be the default session?
IfMsgBox No
Return
;Loop, %DirectoryCount%
/*
if !FileExist("HTMLTemp" A_Index)
{
;NumberDir : %A_Index%
MoveDir := "HTMLTemp" A_Index
}
MsgBox, %MoveDir%
*/
FileDelete, SessionTemp*.txt
FileDelete, SessionTemp00.txt
FileDelete, SessionTemp01.txt
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
NumSess := A_Index-1
NumberPos:= A_ThisMenuItemPos-4
;MsgBox, %NumberPos%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp"
FileAppend, %FileSession%, SessionTemp.txt
FileAppend, %A_ScriptDir%, SessionTemp00.txt
FileSession2 := "\HTMLTemp00"
FileAppend, %FileSession2%, SessionTemp00.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;FileMove %DirectorySess%, %DirectorySess00%
FileMoveDir %DirectorySess%, %DirectorySess00%, R
;DirectorySess :=""
;DirectorySess00 :=""
FileAppend, %A_ScriptDir%, SessionTemp01.txt
FileSession3 := "\HTMLTemp" NumberPos
FileAppend, %FileSession3%, SessionTemp01.txt
FileRead, DirectorySess01, SessionTemp01.txt
FileRead, DirectorySess, SessionTemp.txt
FileRead, DirectorySess00, SessionTemp00.txt
;MsgBox, %DirectorySess01%`n%DirectorySess%
FileMoveDir %DirectorySess01%, %DirectorySess%, R
FileMoveDir %DirectorySess00%, %DirectorySess01%, R
Menu, SessionID, DeleteAll
Menu, ClipboardID, DeleteAll
Iniciate:=0
Gosub, ReloadSession
Return
ButtonLabelTray:
If CorpusCount=0
Return
NumberFile:=A_ThisMenuItemPos
Gosub, ButtonLabel
Return
ButtonLabel:
;NumberFile:= RegExReplace(NameTwo,"\D")
Gosub, ExitLabel
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
Sleep, 1000
WinClip.Clear()
html := FileOpen("HTMLTemp\Text" NumberFile ".html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line1.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
html := FileOpen("HTMLTemp\Corpus" NumberFile ".html", "r").read()
Sleep, 1000
WinClip.SetHTML(html)
WinClip.Paste()
WinClip.Clear()
Sleep, 300
html := FileOpen("Resources\Line2.html", "r").read()
WinClip.SetHTML(html)
WinClip.Paste()
Send, `n
Sleep, 300
Return
ExitLabel:
SoundPlay, Resources\Close Window.mp3
Gui, ContextClip1: Destroy
Gui, ContextClip: Destroy
;Gui, Destroy
Gui,2: Destroy
Gui, Gui1: Destroy
;Gui, 2:default
;Gui, destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
ControlOne :=0
ControlTwo :=0
threeRButton :=0
Alto:=0
Return
TxtLabel:
SoundPlay, Resources\Clipboard_Sound.mp3
StringTrimLeft, TextCopy, a_guicontrol, 5
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlTx := FileOpen("HTMLTemp\Corpus" TextCopy ".html", "r").read()
WinClip.SetHTML(htmlTx)
Return
TxtPlane:
MouseGetPos,,, WinUMID
WinActivate, ahk_id %WinUMID%
StringTrimLeft, TextPlane, a_guicontrol, 6
Gosub, ExitLabel
Sleep, 300
WinClip.Clear()
htmlPl := FileOpen("HTMLTemp\TextPlain" TextPlane ".txt", "r").read()
Clipboard = %htmlPl%
Send, ^v
Return
Toggle_Switch:
If Toggle=0
{
GuiControl, Hide, State0
GuiControl, Show, State1
Toggle=1
}
Else {
GuiControl, Hide, State1
GuiControl, Show, State0
Toggle=0
}
Return
SubRoutine1:
GoSub,Toggle_Switch
If Toggle=0
{
Hotkey, +LButton Up, on
;Gui, Destroy
Return
}
If Toggle=1
{
Hotkey, +LButton Up, off
;Gui, Destroy
Return
}
CopyTexClip:
Gui, Submit
WinActivate, ahk_id %WinUMID%
Gosub, MainProcess
Return
NewWindow:
WinGetPos pXm, pYm, Width, Height, ahk_id %hMainWnd%
pXm := pXm + Width
If (A_OSVersion ~= "WIN_(7|XP)") {
SysGet BorderW, 32 ; SM_CXFRAME
pXm += BorderW + 1
}
Return
ClipboardGet_HTML( byref Data ) ;www.autohotkey.com/forum/viewtopic.php?p=392624#392624
{
If CBID := DllCall( "RegisterClipboardFormat", Str,"HTML Format", UInt )
If DllCall( "IsClipboardFormatAvailable", UInt,CBID ) <> 0
If DllCall( "OpenClipboard", UInt,0 ) <> 0
If hData := DllCall( "GetClipboardData", UInt,CBID, UInt )
DataL := DllCall( "GlobalSize", UInt,hData, UInt )
, pData := DllCall( "GlobalLock", UInt,hData, UInt )
, VarSetCapacity( data, dataL * ( A_IsUnicode ? 2 : 1 ) ), StrGet := "StrGet"
, A_IsUnicode ? Data := %StrGet%( pData, dataL, 0 )
: DllCall( "lstrcpyn", Str,Data, UInt,pData, UInt,DataL )
, DllCall( "GlobalUnlock", UInt,hData )
DllCall( "CloseClipboard" )
Return dataL ? dataL : 0
}
GuiButtonIcon(Handle, File, Index := 1, Options := "")
{
RegExMatch(Options, "i)w\K\d+", W), (W="") ? W := 16 :
RegExMatch(Options, "i)h\K\d+", H), (H="") ? H := 16 :
RegExMatch(Options, "i)s\K\d+", S), S ? W := H := S :
RegExMatch(Options, "i)l\K\d+", L), (L="") ? L := 0 :
RegExMatch(Options, "i)t\K\d+", T), (T="") ? T := 0 :
RegExMatch(Options, "i)r\K\d+", R), (R="") ? R := 0 :
RegExMatch(Options, "i)b\K\d+", B), (B="") ? B := 0 :
RegExMatch(Options, "i)a\K\d+", A), (A="") ? A := 4 :
Psz := A_PtrSize = "" ? 4 : A_PtrSize, DW := "UInt", Ptr := A_PtrSize = "" ? DW : "Ptr"
VarSetCapacity( button_il, 20 + Psz, 0 )
NumPut( normal_il := DllCall( "ImageList_Create", DW, W, DW, H, DW, 0x21, DW, 1, DW, 1 ), button_il, 0, Ptr ) ; Width & Height
NumPut( L, button_il, 0 + Psz, DW ) ; Left Margin
NumPut( T, button_il, 4 + Psz, DW ) ; Top Margin
NumPut( R, button_il, 8 + Psz, DW ) ; Right Margin
NumPut( B, button_il, 12 + Psz, DW ) ; Bottom Margin
NumPut( A, button_il, 16 + Psz, DW ) ; Alignment
SendMessage, BCM_SETIMAGELIST := 5634, 0, &button_il,, AHK_ID %Handle%
return IL_Add( normal_il, File, Index )
}
OnMouseMove( wParam, lParam, Msg,hwnd ) {
global status_button ,tme
global status_Plane ,tme
global status_Print ,tme
global status_Delete ,tme
global status_URL ,tme
global status_Copy ,tme
global status_Editing ,tme
DllCall( "TrackMouseEvent","uint",&tme )
status_button:=""
status_Plane:=""
Status_Print:=""
status_Delete:=""
status_URL:=""
status_Copy:=""
status_Editing:=""
if instr(a_guicontrol,"BUTTON")
{
status_button:=a_guicontrol
SetTimer, alert,-20
}
if instr(a_guicontrol,"plane")
{
status_Plane:=a_guicontrol
SetTimer, Planealert,-20
}
if instr(a_guicontrol,"Print")
{
status_Print:=a_guicontrol
SetTimer, Printalert,-20
}
if instr(a_guicontrol,"Delete")
{
status_Delete:=a_guicontrol
SetTimer, Deletealert,-20
}
if instr(a_guicontrol,"URL")
{
status_URL:=a_guicontrol
SetTimer, URLalert,-20
}
if instr(a_guicontrol,"Copy")
{
status_Copy:=a_guicontrol
SetTimer, Copyalert,-20
}
if instr(a_guicontrol,"Editing")
{
status_Editing:=a_guicontrol
SetTimer, Editingalert,-20
}
}
OnMouseLeave(){
global
Gosub, NewWindow
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Gui,5: Destroy
Gui,6: Destroy
Gui,7: Destroy
status_button_old:=""
status_plane_old:=""
status_print_old:=""
status_Delete_old:=""
status_URL_old:=""
status_Copy_old:=""
status_Editing_old:=""
}
Printalert:
if (status_Print=status_print_old)
return
URLButton:
SoundPlay, Resources\Close Window.mp3
MsgBox, 0x1024,, Extract URL's from Clipboards?
IfMsgBox No
Return
Else
Gui, Utily: Destroy
Loop, %CorpusCount%
{
if (Errorlevel = 1)
Break
else if (Errorlevel = 0)
{
html1 := "HTMLTemp\Text" A_Index ".html"
FileRead, PDF1, %html1%
FileAppend, %PDF1%<br/>, ToPDF.html
html2 := "HTMLTemp\Corpus" A_Index ".html"
FileRead, PDF2, %html2%
FileAppend, %PDF2%<br/>, ToPDF.html
}
}
Gosub, ExtractURL
FileDelete, ToPDF.html
Return
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
Return True
}
;************************************************************************************************************************
ExtractURL:
;Create header html document
FileAppend,
(
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=AutoHotkey.File>
<meta name=Generator content="AutoHotkey">
</head>
<body lang=es style='font-family:Calibri;font-size:11.0pt'>
), Extracted_Links.html
FormatTime, CurrentDate,, dd-MM-yyyy
DateIncl := "<p style='margin:0in'><span style='font-family:Times New Roman;font-size:11.0pt;color:#1E4D78'>Clipboard Session URLs: </span><span style='font-weight:bold;font-family:Calibri;font-size:12.0pt;color:#860000'>" CurrentDate "</span></p>"
FileAppend, %DateIncl%, Extracted_Links.html
;Add Line
myResult := "<p style='margin:0in;font-family:Calibri;font-size:11.0pt;color:#78230C'><p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>`r
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>`r"
FileAppend, %myResult%, Extracted_Links.html
;Routine loop, origin: https://www.autohotkey.com/docs/commands/LoopReadFile.htm
LinkCount := 0
ImgCount := 0
Loop, read, ToPDF.html, Extracted_Links.html
{
URLSearchString := A_LoopReadLine
Gosub, URLSearch
}
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links.html
Loop, read, Extracted_Links.html
{
If A_Index < 11
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
if A_Index > 11
if RegExMatch(A_LoopReadLine, "\.(jpg<|jpeg<|png<|gif<|svg<)")
{
FileAppend, %A_LoopReadLine%`n, Extracted_Links_Img.html
ImgCount++ ; increment by one
}
else If InStr(A_LoopReadLine, "</ul>", True) and A_Index > 17
FileAppend,
(
</ul>
<p style='margin:0in;font-family:Calibri;font-size:11.0pt'> </p>
<p style='margin:0in'><span style='font-family:Courier;font-size:10.0pt;font-weight:bold'>───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br><ul type=disc style='direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in'>
<!--EndFragment-->
</body>
</html>
), Extracted_Links_Img.html
}
;URL number message, Optional
MsgBox %LinkCount% links were found and written to "Extracted_Links.html" `n %ImgCount% Images were found and written to "Extracted_Links_Img.html"
;Opcional, opens the result
FormatTime, CurrentDate,, dd-MM-yyyy
FileURL := "Documents\Extracted_Links_" CurrentDate ".html"
FileURLImg := "Documents\Extracted_Links_Img_" CurrentDate ".html"
FileMove, Extracted_Links.html, %FileURL%
FileMove, Extracted_Links_Img.html, %FileURLImg%
FileDelete, ToPDF.html
Run, %FileURL%
Run, %FileURLImg%
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
URLStart1 := InStr(URLSearchString, "https://")
URLStart2 := InStr(URLSearchString, "http://")
URLStart3 := InStr(URLSearchString, "ftp://")
URLStart4 := InStr(URLSearchString, "www.")
; Find the left-most starting position:
URLStart := URLStart1 ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
ArrayElement := URLStart%A_Index%
if (ArrayElement = "") ; End of the pseudo-array has been reached.
break
if (ArrayElement = 0) ; This element is disqualified.
continue
if (URLStart = 0)
URLStart := ArrayElement
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if (ArrayElement != 0)
if (ArrayElement < URLStart)
URLStart := ArrayElement
}
}
if (URLStart = 0) ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
URL := SubStr(URLSearchString, URLStart) ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%<> ; Find the first space, tab, or angle (if any).
{
URL := A_LoopField
break ; i.e. perform only one loop iteration to fetch the first "field".
}
StringReplace, URLCleansed, URL, ",, All
; Makes a second check to replace extraneous signs.
FixString := % URLCleansed
vList := "
(
%21 !
%23 #
%24 $
%26 &
%27 '
%28 (
%29 )
%2A *
%2B +
%2C ,
%3B ;
%2F /
%3A :
%3D =
%3F ?
%40 @
%5B [
%5D ]
%20
%C2%B4 ´
%2E .
%25 %
%2D -
%3C <
%3E >
%5C \
%5E ^
%5F _
%60 `
%7B {
%7C |
%7D }
%7E ~
%22 ""
\/ \
)"
Loop, Parse, vList, `n
{
oTemp := StrSplit(A_LoopField, "`t")
FixString := StrReplace(FixString, oTemp.1, oTemp.2)
}
oTemp := ""
ClipBoard := "<li style='margin-top:0;margin-bottom:0;vertical-align:middle'><p style='margin:0in;font-family:Calibri;font-size:10.0pt'><a href=" FixString ">" FixString "</a></p></li>"
FileAppend, %ClipBoard%`n
LinkCount += 1
; See if there are any other URLs in this line:
CharactersToOmit := StrLen(URL)
CharactersToOmit += URLStart
URLSearchString := SubStr(URLSearchString, CharactersToOmit)
Gosub, URLSearch ; Recursive call to self.
return
;**********************************************************************************************
^F1::
CaseMenu:
Menu Case, Add
Menu Case, DeleteAll
Menu Case, Add, &UPPERCASE, CCase
Menu Case, Add, &lowercase, CCase
Menu Case, Add, &Title Case, CCase
Menu Case, Add, &a Title to Case, CCase
Menu Case, Add, &Sentence case, CCase
Menu Case, Add
Menu Case, Add, &Remove Spaces, CCase
GetText(Txt)
If NOT ERRORLEVEL
Menu Case, Show
Return
CCase:
p:=A_ThisMenuItemPos
If (p=1)
StringUpper, Txt, Txt
Else If (p=2)
StringLower, Txt, Txt
Else If (p=3)
StringLower, Txt, Txt, T
Else If (p=4)
{
StringLower, Txt, Txt
;IMPORTANT! Change short words to be replaced in the following list according to each language or add more
lowers := ["a", "ha", "el", "y", "pero", "o", "para", "las", "es", "para", "por", "los", "con", "en", "que", "un", "de", "del", "la", "una", "cada", "en", "al", "por", "uno", "mi", "tu", "tú", "no", "ni", "sin", "se", "lo", "e", "su", "sí", "ser", "hay"]
for k, v in lowers
low .= (k = 1 ? "" : "|") . v
;Txt := RegExReplace(Txt, "(*UCP)(^\b|\b(?!(" . low . ")\b))\w+\b|\b\w+\b$", "$T0")
;Txt := RegExReplace(Txt, "((?:^|[.!?-]\s+)[a-z])", "$u1")
Txt := RegExReplace(Txt, "(*UCP)(^|\b(?!(" . low . ")\b))\w|(\.|\?|!)\s*\K\w|-\K\w", "$T0")
}
Else If (p=5)
{
StringLower, Txt, Txt
Txt := RegExReplace(Txt, "((?:^|[.!?]\s+)[a-z])", "$u1")
}
Else If (p=7)
{
Loop
{
StringReplace, Txt, Txt, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0
break
}
}
PutText(Txt)
Return
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^{vk43} ;Ctrl C
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard =
Sleep 20
Clipboard := MyText
Send ^{vk56} ;Ctrl V
Sleep 100
Clipboard := SavedClip
Return
}
ClipToDoc(FileName) {
oWord := ComObjCreate("Word.Application")
Document := oWord.Documents.Add
; oWord.Selection.Paste
oWord.Selection.PasteAndFormat(16) ; wdFormatOriginalFormatting = 16
Document.SaveAs(FileName)
Document.Close()
oWord.Quit
}
GetImageSize(imageFilePath) {
if !hBitmap := LoadPicture(imageFilePath, "GDI+")
throw "Failed to load the image"
VarSetCapacity(BITMAP, size := 4*4 + A_PtrSize*2, 0)
DllCall("GetObject", "Ptr", hBitmap, "Int", size, "Ptr", &BITMAP)
DllCall("DeleteObject", "Ptr", hBitmap)
Return { W: NumGet(BITMAP, 4, "UInt"), H: NumGet(BITMAP, 8, "UInt") }
}
crop(FilePath, x, y, w, h) {
static IP
img := ComObjCreate("WIA.ImageFile")
img.LoadFile(FilePath)
if (!IP) {
IP:=ComObjCreate("WIA.ImageProcess")
ip.Filters.Add(IP.FilterInfos("Crop").FilterID)
}
; x,y,r,b are the number of pixels to crop from each edge. They cannot be negative numbers.
ip.filters[1].properties("Left") := x
ip.filters[1].properties("Top") := y
if ((r := img.width - w - x) < 1)
r := 0
if ((b := img.height - h - y) < 1)
b := 0
ip.filters[1].properties("Right") := r
ip.filters[1].properties("Bottom") := b
img := IP.Apply(img)
FileDelete, %FilePath%
while FileExist(FilePath)
Sleep, 10
img.SaveFile(FilePath)
return
}
;*******************************************************************************
Nothing:
Run, https://www.autohotkey.com/boards/viewtopic.php?t=92963
Return
Tray_Open:
ListLines
return
^!F4::
NewSession:
Gui, Session: -Caption +alwaysontop +ToolWindow +hWndhMainWnd +Owner
;Gui, Session:+Owner
Gui, Session: Font, S10 Bold, Verdana
Gui, Session: Add, Picture, x0 y0 h20 w562 h32, Resources\Fondo_Limp.png
Gui, Session: Add, Text, cYellow BackgroundTrans x35 y6 W560 h32 GuiMove, Session Name
;Gui, RenSession: Add, Text, x5 y6 h20 w549, Session Name:
Gui, Session: Add, Text, x0 y33 w563 0x10 ; 0x7 Black
Gui, Session: Font, S8 Bold, Verdana
Gui, Session: Add, Edit, x5 y40 vSessEdit h20 w544, New Session
Gui Session:Add, Button, x20 y70 w70 h20 gSessionSave, OK
Gui Session:Add, Button, x120 y70 w70 h20 gSessCancel, Cancel
xSess := Floor((A_ScreenWidth/2)-448)
ySess := Floor((A_ScreenHeight/2)-200)
Gui, Session: Show, x%xSess% y%ySess% w562
Return
SessionSave:
FileDelete, SessionTemp.txt
Gui, Session: Submit
Loop, %A_ScriptDir%\HTMLTemp*, 2, 0
SessionTotal1 := A_Index
FileCreateDir, HTMLTemp%SessionTotal1%
FileAppend, %A_ScriptDir%, SessionTemp.txt
FileSession := "\HTMLTemp" SessionTotal1 "\Session.txt"
FileAppend, %FileSession%, SessionTemp.txt
;Sleep, 3500
FileRead, Directory, SessionTemp.txt
FileAppend, %SessEdit%, %Directory%
Menu, SessionID, DeleteAll
Iniciate:=1
;Gosub, NewWindow
SessEdit :=""
Gosub, ReloadSession
Return
SessCancel:
Gui, Session:Destroy
Gui, RenSession:Destroy
SessEdit :=""
ReSessEdit :=""
Gosub, RButton
Return
LabelSessionAct0:
Position :=0
Gosub, LabelSessionAct
Return
LabelSessionAct1:
Position :=1
;MsgBox, HOLA!!!
Gosub, LabelSessionAct
Return
LabelSessionAct:
Gosub, NewWindow
ReadSess := "HTMLTemp\Session.txt"
FileRead, RenSession, %ReadSess%
Gui, RenSession: -Caption +alwaysontop +ToolWindow +hWndhMainWnd
; Gui, RenSession:+Owner
Gui, RenSession: Font, S10 Bold, Verdana
Gui, RenSession: Add, Picture, x0 y0 h20 w564 h32, Resources\Fondo_Limp.png
Gui, RenSession: Add, Text, cYellow BackgroundTrans x35 y6 W560 h32 GuiMove, Session Name
;Gui, RenSession: Add, Text, x5 y6 h20 w549, Session Name:
Gui, RenSession: Add, Text, x0 y33 w563 0x10 ; 0x7 Black
Gui, RenSession: Font, S8 Bold, Verdana
Gui, RenSession: Add, Edit, x5 y40 vReSessEdit h20 w544, %RenSession%
Gui RenSession:Add, Button, x20 y70 w70 h20 gRenSessionSave, OK
Gui RenSession:Add, Button, x120 y70 w70 h20 gSessCancel, Cancel
If Position=0
{
xSess := pXm-846
ySess := pYm-148 ;96
}
If Position=1
{
xSess := Floor((A_ScreenWidth/2)-448)
ySess := Floor((A_ScreenHeight/2)-200)
}
Gui, RenSession: Show, x%xSess% y%ySess% w564
Return
RenSessionSave:
Gui, RenSession: Submit
FileDelete, HTMLTemp\Session.txt
FileAppend, %ReSessEdit%, HTMLTemp\Session.txt
ReSessEdit :=""
Gosub, RButton
Return
/*
Paused:
Paused:=!Paused
IfEqual,Paused,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Orange.ico
IfEqual,Paused,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Pause Script
Menu,Tray,Icon,,,1
Pause,Toggle,1
Return
*/
DeleteSessions:
MsgBox, 0x1034,, Do you Really want to Delete the Empty Sessions? `n`n Can be Used on Another Occasion.
IfMsgBox No
Return
IndiDir := 0
SumDir := 0
loop, %SessionTotal%
{
FileDelete, SessionCount.txt
FileAppend, %A_ScriptDir%, SessionCount.txt
FullFile:="\HTMLTemp" A_Index "\*.*"
NameDir := "HTMLTemp" A_Index
FileAppend, %FullFile%, SessionCount.txt
FileRead, CountFiles, SessionCount.txt
loop, %CountFiles%
FilesCount := % Floor(A_Index/6)
;MsgBox, %FilesCount% - %NameDir%
If FilesCount=0
{
FileRemoveDir, %NameDir%, 1
IndiDir--
SumDir++
}
}
If InDir<>DirectoryCount
{
Loop %SumDir%
{
Loop %DirectoryCount%
if !FileExist("HTMLTemp" A_Index)
{
NumberFile1 := A_Index
FileSup1 := NumberFile1+1
Sup1 := ScriptDir "HTMLTemp" Filesup1
NumF1:= ScriptDir "HTMLTemp" NumberFile1
;MsgBox, %Sup1% - %NumF1%
FileMoveDir %Sup1%, %NumF1%, R
;Filemove, %Sup%, %NumF%
;FileMoveDir %DirectorySess%, %DirectorySess00%, R
}
}
DirectoryCount:=DirectoryCount-SumDir
Menu, SessionID, DeleteAll
Gosub, ReloadSession
}
Return
^F12::
Stanby:
Suspend:=!Suspend
IfEqual,Suspend,1, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Red.ico
IfEqual,Suspend,0, Menu,Tray,Icon,%A_ScriptDir%\Resources\Scissors_Green.ico
Menu, tray, ToggleCheck, &Suspend Clipboard Utility
Menu,Tray,Icon,,,1
Suspend,Toggle
Return
SuspendHotkeys:
Menu, Tray, ToggleCheck, Keep Only Hotkeys Necessary
xSplash1 := A_ScreenWidth-506
ySplash1 := A_ScreenHeight-180
If SuspendHotkeys=1
{
SuspendHotkeys:=0
Hotkey, ^Up, Toggle
Hotkey, ^F4, Toggle
Hotkey, ^F5, Toggle
Hotkey, ^F6, Toggle
Hotkey, ^F7, Toggle
Hotkey, ^F8, Toggle
Hotkey, ^F10, Toggle
Hotkey, ^F11, Toggle
Hotkey, ^F12, Toggle
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Activated Only the Necessary Hotkeys
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
else
{
SuspendHotkeys:=1
Hotkey, ^Up, Toggle
Hotkey, ^F4, Toggle
Hotkey, ^F5, Toggle
Hotkey, ^F6, Toggle
Hotkey, ^F7, Toggle
Hotkey, ^F8, Toggle
Hotkey, ^F10, Toggle
Hotkey, ^F11, Toggle
Hotkey, ^F12, Toggle
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Activated All Hotkeys
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
Return
SuspendThumbnail:
Menu, ThumbnailID, ToggleCheck, Postpone Thumbnail Creation
xSplash1 := A_ScreenWidth-506
ySplash1 := A_ScreenHeight-180
If SuspendThumbnail=0
{
SuspendThumbnail:=1
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Thumbnail Creation Disabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
else
{
SuspendThumbnail:=0
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Thumbnail Creation Enabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
Return
SuspendBasicClip:
Menu, BasicClipID, ToggleCheck, Disable Basic Clipboard
xSplash1 := A_ScreenWidth-506
ySplash1 := A_ScreenHeight-180
If ClipBoardEnabled=0
{
ClipBoardEnabled:=1
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Basic Clipboard Enabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
else
{
ClipBoardEnabled:=0
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Basic Clipboard Disabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
Return
SuspendNotifClip:
Menu, BasicClipID, ToggleCheck, Deactivate Notifications in Tray
xSplash1 := A_ScreenWidth-506
ySplash1 := A_ScreenHeight-180
If NotifyClip=0
{
NotifyClip:=1
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification,Notifications in Tray Enabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
else
{
NotifyClip:=0
SoundPlay, Resources\Close Window.mp3
SplashTextOn,500, 80, Notification, Notifications in Tray Disabled
WinMove, Notification,, xSplash1, ySplash1
Sleep, 1500
SplashTextOff
}
Return
DeleteBasic:
MsgBox, 0x1024,, Want to Delete all Basic Clipboards? `n`n It will be Deleted from the Hard Disk, `n Only the Last one will Remain in Memory.
IfMsgBox No
Return
FileDelete, TempClip\*.*
Reload
Return
CreateMissing:
CountImg := 0
Loop, %CorpusCount%
if !FileExist("HTMLTemp\Image" A_Index ".jpg")
{
Corpus := A_ScriptDir "\HTMLTemp\Corpus" A_Index ".html"
;MsgBox, %Corpus%
Filecopy %Corpus%, CorpusTemp.html
RunWait, %A_WorkingDir%\Addons\wkhtmltoimage.exe --width 640 CorpusTemp.html Image_Temp.jpg,,hide
Gosub, ResizeH
ImageCount1 := "HTMLTemp\Image" A_Index ".jpg"
FileMove, Image_Temp.jpg, %ImageCount1%
FileDelete, CorpusTemp.html
CountImg++
}
If CountImg=0
{
MsgBox, All Clipboard already have Thumbnails.
}
Else
{
MsgBox, Finished process.`n`n %CountImg% Thumbnail(s) has been Created.
}
Return
/*
;Loop, 6
MsgBox, %CorpusCount%
Loop, %CorpusCount%
if !FileExist("HTMLTemp\Image" A_Index ".jpg")
{
MsgBox, No existe Imagen %A_Index%
}
;Else
;{
;MsgBox, Sí existe Imagen %A_Index%
;}
idx = 0
loop, HTMLTemp\Corpus*.html
CorpusCount := % Floor(A_Index)
;MsgBox, %CorpusCount% - %A_Index% - %idx%
Loop, %CorpusCount%
idx++
;MsgBox, %CorpusCount% - %A_Index% - %idx%
;Imagecheck :="HTMLTemp\Image" A_Index ".jpg"
if !FileExist("h:\Download\Script\MultiClipboard Preview 4.1n\HTMLTemp\Image" A_Index ".jpg")
{
MsgBox, No existe Imagen %A_Index% %idx%
}
*/
EditScript:
Run Edit %A_ScriptName%
Return
^!F7::
Reloaded:
Reload
Return
NotifyTrayClick_201:
;xSplash := Floor((A_ScreenWidth/2)-450)
;ySplash := Floor((A_ScreenHeight/2)-200)
xSplash := A_ScreenWidth-506
ySplash := A_ScreenHeight-180
SplashTextOn, 500, 80, Content of the current clipboard, %Clipboard%
WinMove, Content of the current clipboard,, xSplash, ySplash
;SplashTextOn,,, Displays only a title bar.
Sleep, 1000
SplashTextOff
;SplashTextOn,,, %Clipboard%
;WinMove,,, xSplash, ySplash
;Sleep, 1000
;SplashTextOff
Return