Page 1 of 1

Restarting PC forgets formatting of my saved clipboards

Posted: 03 Oct 2022, 11:24
by SleeplessKnight
Hello.

I use the following script to save my clipboards into a file:

Code: Select all

InputBox, mjmenosouboru, Save pasta to file:
cesta = c:\Users\...\AHK Files\%mjmenosouboru%.clip
FileDelete, %cesta%
FileAppend, %ClipboardAll%, %cesta%
and the following to load pasta from file:

Code: Select all

InputBox, mjmenosouboru, Load pasta to file:
cesta = c:\Users\...\AHK Files\%mjmenosouboru%.clip
FileRead, clipvariable, *c %cesta%
if not ErrorLevel
{
Clipboard := clipvariable
}
else
{
MsgBox, Pasta does not exist.
}
I use this to save my clipboards that are text with formatting, one example is the text "THIS IS A BOLD RED STATEMENT" that is bold and red as well. Now when I load the clipboard from file, it works fine as long as I don't restart my PC.

If I restart my PC, the pasta loads but all the formatting is forgotten, i.e. it loads just the text "THIS IS A BOLD RED STATEMENT".

Is there any way how can I make it so that it loads all the formatting?

The same thing happens for my drawings in Xournal - I can save and load my drawings from/to clipboard as long as I don't restart my PC. After I do, they will no longer load and I have to draw and save them again.

Thank you.

Re: Restarting PC forgets formatting of my saved clipboards

Posted: 04 Oct 2022, 01:44
by Rohwedder
Hallo,
I tried this:

Code: Select all

q::
cesta = Clip.clip
FileDelete, %cesta% ; unnecessary,
; as FileAppend with ClipboardAll overwrites the file
FileAppend, %ClipboardAll%, %cesta%
cesta := ClipBoard := ""
Return
w::
cesta = Clip.clip
FileRead, clipvariable, *c %cesta%
Clipboard := clipvariable
Return
and the formatting is fully restored

Re: Restarting PC forgets formatting of my saved clipboards

Posted: 04 Oct 2022, 07:12
by SleeplessKnight
Really? Did you try doing the following?

1) Save your clipboard that includes formatting into a file.
2) Restart your PC.
3) Load the clipboard.

I did it with your code (which is really the same as mine) and in the step 3) it loads the clipboard without formatting.

Re: Restarting PC forgets formatting of my saved clipboards

Posted: 04 Oct 2022, 07:50
by Lepes
SleeplessKnight wrote:
04 Oct 2022, 07:12
Really? Did you try doing the following?

1) Save your clipboard that includes formatting into a file.
2) Restart your PC.
3) Load the clipboard.

I did it with your code (which is really the same as mine) and in the step 3) it loads the clipboard without formatting.
I tested and it works. I pasted on LibreOffice Writer.
Although clip.clip is a binary format, i can read this:

Code: Select all

SourceURL:https://www.autohotkey.com/boards/viewtopic.php?f=76&t=109054
<html><body>
<!--StartFragment--><strong class="text-strong"><span style="color:#FF0000">THIS IS A BOLD RED STATEMENT</span></strong><!--EndFragment-->
</body>
</html 
so the color is still there, try a different editor where you press w and then paste the result.

Re: Restarting PC forgets formatting of my saved clipboards

Posted: 04 Oct 2022, 10:01
by SleeplessKnight
Hey. I tried to save formatted text in LibreOffice writer, but after restarting pc (even after log out and then log in) the formatting is not loaded into clipboard.

Is something wrong with my pc then? :cry:

Re: Restarting PC forgets formatting of my saved clipboards

Posted: 29 Jun 2023, 09:18
by Rikk03
This issue seems to be a Windows only problem. I too can't load .clip with HTML formatting after restart, you're not crazy!

Re: Restarting PC forgets formatting of my saved clipboards

Posted: 29 Jun 2023, 09:20
by Rikk03

Re: Restarting PC forgets formatting of my saved clipboards

Posted: 29 Jun 2023, 10:31
by Rikk03
Found the problem, in my case that is. Make sure your .clp files are associated with notepad and your clips will load fine.

Mine was associated with infraview and after changing it back to notepad it works fine.