Jump to content

Clipboard


Recommended Posts

situation for example:

I write some document in a WORD PROCESSOR PROGRAM => WPP

In this WPP I COPY some CONTENT of this document to clipboard (CTRL+C)

my Question:

How to write clipboard to file in a specific way that give me posibility

to read that file in to clipboard in a future,

and then PASTE (using CTRL+V) the CONTENT (with specific text formating used by WPP)

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

You could use INIWrite/INIRead, ClipPut/ClipGet i s'pose

~cdkid

Edited by cdkid
AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to comment
Share on other sites

situation for example:

I write some document in a WORD PROCESSOR PROGRAM => WPP

In this WPP I COPY some CONTENT of this document to clipboard (CTRL+C)

my Question:

How to write clipboard to file in a specific way that give me posibility

to read that file in to clipboard in a future,

and then PASTE (using CTRL+V) the CONTENT (with specific text formating used by WPP)

You use ClipGet to read the contents into a variable, and then write the contents to a file using FileOpen (search the help file for these)

The clipboard won't contain or save your word processor formatting codes as they are application specific and not in a readable text format. The only way to save these codes with the contents is to save the word processor file from the WP.

Link to comment
Share on other sites

The clipboard won't contain or save your word processor formatting codes as they are application specific and not in a readable text format. The only way to save these codes with the contents is to save the word processor file from the WP.

I know about FileOpen function.

But I need exacly that what You write BINARY CLIPBOARD SAVE/LOAD Method.

This give me a new posibility for example I can save a screenshot....

hm... I have another question similar to the first one:

Can I in AutoIt check that something:

where in memory is located actual CLIPBOARD content

I just thinking how to save memory block to binary file

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

I made this to work as a clipboard tool. This may help you. I run mine so it uses a hotsetkey. Usually F6 will work fine. If someone wants to improve the script, please feel free to tweak to your heart's content! :)

ODE
#include<GuiConstants.au3>
#include<file.au3>

#endregion

;-----------------------------



$main_gui = GUICreate("QuickPaste 2.0", 600, 85)

$filemenu = GUICtrlCreateMenu ("&File")

$fileitem = GUICtrlCreateMenuitem ("Paste",$filemenu)

$fileitem1 = GUICtrlCreateMenuitem ("Clean then Paste",$filemenu)

$separator1 = GUICtrlCreateMenuitem ("",$filemenu,2) ; create a separator line

$fileitem2 = GUICtrlCreateMenuitem ("Add Entry",$filemenu)

$fileitem3 = GUICtrlCreateMenuitem ("Remove Entry",$filemenu)

;$separator2 = GUICtrlCreateMenuitem ("",$filemenu,2) ; create a separator line

$fileitem4 = GUICtrlCreateMenuitem ("Open QuickPaste.ini",$filemenu)

$fileitem5 = GUICtrlCreateMenuitem ("Cancel",$filemenu)

$filemenu1 = GUICtrlCreateMenu ("&Help")

$fileitem6 = GUICtrlCreateMenuitem ("Help",$filemenu1)

$fileitem7 = GUICtrlCreateMenuitem ("About",$filemenu1)

$Combo_2 = GUICtrlCreateCombo("", 20, 5, 500, 80)

$data1 = _LoadData(@ScriptDir & "\quickpaste.ini", $Combo_2)

$button1 = GUICtrlCreateButton("Paste", 530, 5, 60, 20)

$button2 = GUICtrlCreateButton("Clean then Paste", 500, 32, 90, 20)

$button3 = GUICtrlCreateButton("Add", 20, 32, 60, 20)

$button4 = GUICtrlCreateButton("Remove", 100, 32, 60, 20)

$button5 = GUICtrlCreateButton("Cancel", 180, 32, 60, 20)

;$button10 = GUICtrlCreateButton("About", 260, 32, 60, 20)

; Run the GUI until it is closed

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

;When button1 is pressed, label text is copied to the clipboard

Case $msg = $button1 or $msg = $fileitem

$data = GUICtrlRead($Combo_2)

ClipPut($data)

Sleep(200)

GUISetState(@SW_HIDE, $main_gui)

sleep(200)

Send("^v")

Exit

;When button2 is pressed, it will clean the edit field in the application, then paste the contents from the clipboard.

Case $msg = $button2 or $msg = $fileitem1

$data = GUICtrlRead($Combo_2)

ClipPut($data)

Sleep(200)

GUISetState(@SW_HIDE, $main_gui)

sleep(200)

Send("^a")

sleep(200)

Send("{DELETE}")

Send("^v")

Exit

;---------------------------------------

;this will open a sub GUI window to allow for adding or removing data

Case $msg = $button3 or $msg = $fileitem2

GUISetState(@SW_HIDE, $main_gui)

$add_gui = GUICreate("Add entry to QuickPaste", 520, 165)

$file = GUICtrlCreateedit("", 10, 5, 500, 130, $SS_LEFT + $WS_VSCROLL) ; , )

GUICtrlSetState(-1, $GUI_ACCEPTFILES)

$button6 = GUICtrlCreateButton("Ok", 10, 140, 60, 20)

$button7 = GUICtrlCreateButton("Cancel", 90, 140, 60, 20)

GUISetState(@SW_SHOW, $add_gui)



$msg2 = 0

While $msg2 <> $GUI_EVENT_CLOSE

$msg2 = GUIGetMsg()

Select

Case $msg2 = $button6 ; this will add data to the quickpaste.ini file. It will make the file if it is missing

$adddata = GUICtrlRead($file)

_SaveData(@ScriptDir & "\quickpaste.ini", $data1 & $adddata & "|")

ExitLoop



Case $msg2 = $button7



ExitLoop

EndSelect



WEnd

GUIDelete($add_gui)

$data1 = _LoadData(@ScriptDir & "\quickpaste.ini", $Combo_2)

GUISetState(@SW_SHOW, $main_gui)



;----------------------------------------

;this will open a window that will remove a entry selected from the drop down list.

Case $msg = $button4 or $msg = $fileitem3

$rem_item = GUICtrlRead($Combo_2)

If StringLen($rem_item) Then

GUISetState(@SW_HIDE, $main_gui)

$del_gui = GUICreate("Remove entry from QuickPaste?", 500, 130)

$file = GUICtrlCreateLabel ("Are you sure you wish to delete the entry:", 5, 5)

$file1 = GUICtrlCreateedit ($rem_item, 5, 25, 490, 80, $WS_VSCROLL + $ES_READONLY)

GUICtrlSetState(-1, $GUI_ACCEPTFILES)

$button8 = GUICtrlCreateButton("Yes, remove it", 150, 108, 100, 20)

$button9 = GUICtrlCreateButton("Cancel", 270, 108, 60, 20)

GUISetState(@SW_SHOW, $del_gui)



$msg2 = 0

While $msg2 <> $GUI_EVENT_CLOSE

$msg2 = GUIGetMsg()

Select

Case $msg2 = $button8 ; this will remove an entry from the quickpaste.ini file.

$data1 = StringReplace($data1, $rem_item & "|", "")

_SaveData(@ScriptDir & "\quickpaste.ini", $data1)



ExitLoop



Case $msg2 = $button9

ExitLoop

EndSelect

WEnd

GUIDelete($del_gui)

$data1 = _LoadData(@ScriptDir & "\quickpaste.ini", $Combo_2)

GUISetState(@SW_SHOW, $main_gui)

EndIf



Case $msg = $button5 or $msg = $fileitem5

exit



Case $msg = $fileitem4

If fileexists("quickpaste.ini") == 0 then

MsgBox(4096,"", "You have not added any entries to this file. Add a entry, then you can open Quickpaste.ini for editing ")

else

Run(@ComSpec & " /c " & 'quickpaste.ini', "", @SW_hide)

endif



Case $msg = $fileitem6

MsgBox(0 + 64, "How to use QuickPaste", "- To select what you want pasted to your current work, use the " & @CRLF _

& " dropdown to select the item you want. Once selected, click PASTE." & @CRLF _

& " If you want to delete the contents from the field you are editing before" & @CRLF _

& " hand, click CLEAN THEN PASTE" & @CRLF _

& "" & @CRLF _

& "- To enter a new item in the list, click ADD" & @CRLF _

& " Type in what you want to have entered, then click OK." & @CRLF _

& "" & @CRLF _

& "- To remove a entry, select the item you wanto to remove, then click on REMOVE" & @CRLF _

& " If you are sure this is what you wish to remove, click YES, REMOVE IT." & @CRLF _

& "" & @CRLF _

& "- You can click CANCEL to back out if needed.")



Case $msg = $fileitem7

MsgBox(0 + 64, "About QuickPaste 2.0", "Designed and written by Martin Hawes" & @CRLF _

& " Richmond Headquarters CTS" & @CRLF _

& "" & @CRLF _

& " To report a bug, call STnet 632-9139")



EndSelect





WEnd

Exit

Func _LoadData($s_file, ByRef $h_Combo)

;$note1 = IniRead($s_file, "QuickType", "items", "")

$note1 = IniRead($s_file, @UserName, "items", "")



GUICtrlSetData($h_Combo, "|" & $note1)

Return $note1

EndFunc ;==>_LoadData

Func _SaveData($s_file, $s_data)

IniWrite($s_file, @UserName, "items", $s_data)

;IniWrite($s_file, "QuickType", "items", $s_data)

EndFunc ;==>_SaveData

 

Edited by Jon
Broken formatting
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...