Kydoimos 916 Posted December 11, 2014 Hi all! I've had a hunt for related threads, but I couldn't find anything to help. Basically, I'd like to know how to copy a script to the clipboard. I've tested copyToClipboard "Working", and it does the job. However, I'd like to include line breaks. As well, when I want to copy text which contains speech marks (example, Lamp_01 = "Land_Camping_Light_F" createVehicle getMarkerPos "_Marker") how do I do that? As the first speech mark will end the copied text - does that make any sense? God, sorry. I found this on line breaks: https://community.bistudio.com/wiki/copyToClipboard, but Benargee's comment didn't seem to work for me. Any ideas? Thanks all! :) Share this post Link to post Share on other sites
jshock 513 Posted December 11, 2014 (edited) You could do a mixture of parseText and format(maybe): copyToClipboard parseText (format ["%1",_var)]; May need to compile the script stuff first. Edited December 11, 2014 by JShock Share this post Link to post Share on other sites
dreadedentity 278 Posted December 11, 2014 copyToClipboard (preprocessFile "myScript.sqf"); Note: this doesn't do anything to add line breaks You could do a mixture of parseText and format(maybe): probably a low chance of this working, it looks like copyToClipboard can only work with strings Share this post Link to post Share on other sites
Greenfist 1863 Posted December 11, 2014 (edited) _newline = toString [0x0D, 0x0A]; // [Carriage Return, new line] copyToClipboard format ["some text %1some more %2third line",_newline,_newline]; And use double quotes "" if you want the string to contain only one -> format ["Lamp_01 = ""Land_Camping_Light_F"" etc. %1",_newline]; If you're copying many lines, remember that you can combine strings to keep the code readable: copiedstring = format ["first line %1second line %2",_newline,_newline]; copiedstring = copiedstring + format ["third line %1 ""Land_Camping_Light_F"" %2",_var,_newline]; copiedstring = copiedstring + format ["last line%1",_newline]; copyToClipboard copiedstring; edit. oh, that was mentioned in the wiki already. :) Edited December 11, 2014 by Greenfist Share this post Link to post Share on other sites
Jona33 51 Posted December 11, 2014 I had a similar question before http://forums.bistudio.com/showthread.php?183964-Line-Break-in-text Check hogscraper's final response on the first page. Worked pretty well for me. Share this post Link to post Share on other sites
Kydoimos 916 Posted December 12, 2014 Thanks chaps! Really helpful! Always appreciate it! :D Share this post Link to post Share on other sites
benargee 20 Posted December 12, 2014 Well, I based my note off of official BIS functions that I went through. Share this post Link to post Share on other sites