demando Posted July 30, 2009 Share Posted July 30, 2009 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 Link to comment Share on other sites More sharing options...
99ojo Posted July 30, 2009 Share Posted July 30, 2009 (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 July 30, 2009 by 99ojo Link to comment Share on other sites More sharing options...
demando Posted July 30, 2009 Author Share Posted July 30, 2009 Hi Stefan thank your very much for the very fast help. It' works perfectly. with the best regards's johny1099 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now