Restarting PC forgets formatting of my saved clipboards

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
SleeplessKnight
Posts: 9
Joined: 04 Dec 2021, 16:30

Restarting PC forgets formatting of my saved clipboards

Post by SleeplessKnight » 03 Oct 2022, 11:24

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.

Rohwedder
Posts: 7509
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Restarting PC forgets formatting of my saved clipboards

Post by Rohwedder » 04 Oct 2022, 01:44

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

SleeplessKnight
Posts: 9
Joined: 04 Dec 2021, 16:30

Re: Restarting PC forgets formatting of my saved clipboards

Post by SleeplessKnight » 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.

Lepes
Posts: 141
Joined: 06 May 2021, 07:32
Location: Spain

Re: Restarting PC forgets formatting of my saved clipboards

Post by Lepes » 04 Oct 2022, 07:50

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.

SleeplessKnight
Posts: 9
Joined: 04 Dec 2021, 16:30

Re: Restarting PC forgets formatting of my saved clipboards

Post by SleeplessKnight » 04 Oct 2022, 10:01

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:

Rikk03
Posts: 192
Joined: 12 Oct 2020, 02:44

Re: Restarting PC forgets formatting of my saved clipboards

Post by Rikk03 » 29 Jun 2023, 09:18

This issue seems to be a Windows only problem. I too can't load .clip with HTML formatting after restart, you're not crazy!


Rikk03
Posts: 192
Joined: 12 Oct 2020, 02:44

Re: Restarting PC forgets formatting of my saved clipboards

Post by Rikk03 » 29 Jun 2023, 10:31

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.

Post Reply

Return to “Ask for Help (v1)”