Sign in to follow this  
Followers 0
demando

ConsoleWrite Text to Clipboard

3 posts in this topic

Hallo

sometimes i use the ConsoleWrite Function in my Script. How can i put the text from the ConsolWrite Function

into the clipboard and at the end of the script all text from the ConsoleWrite Functions writes to a File.

Example:

ConsoleWrite("only a test"

ConsoleWrite("also only a test"

When the script is ready , it should create a file ==> log.txt with following content.

only a test

also only a test

thx for the support

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hallo

sometimes i use the ConsoleWrite Function in my Script. How can i put the text from the ConsolWrite Function

into the clipboard and at the end of the script all text from the ConsoleWrite Functions writes to a File.

Example:

ConsoleWrite("only a test"

ConsoleWrite("also only a test"

When the script is ready , it should create a file ==> log.txt with following content.

only a test

also only a test

thx for the support

Hi,

try this:

ClipPut ("") ;reset Clipboard

_mywrite ("only a test") ; see Function
_mywrite ("also only a test") ;see Function
$file = FileOpen ("C:\log.txt", 2) ; Open Textfile in Writemode, erasing contents
FileWrite ($file, ClipGet ()) ; Write Clipboard to File
FileClose ($file) ; Close File
ShellExecute ("c:\log.txt") ; Show File

Func _mywrite ($string)
    ConsoleWrite ($string)
    If ClipGet () <> "" Then ; If Clipboard isn't empty
        $oldvalue = ClipGet () ; save ClipBoard content
        ClipPut ($oldvalue & @CRLF & $string) ; Write to Clipboard, If you don't need a LineFeed just change to ClipPut ($oldvalue & $string)
    Else ; Clipboard is empty
        ClipPut ($string)
    EndIf
EndFunc

;-))

Stefan

Edited by 99ojo

Share this post


Link to post
Share on other sites

Hi Stefan

thank your very much for the very fast help. It' works perfectly.

with the best regards's

johny1099

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

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

Create an account

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


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0