Thomas P Posted January 30, 2018 Posted January 30, 2018 Hi mates, I did a search and couldn't find anything to my basic question admittedly simple question: How can I copy code posted in a post, i.e. a block of code, all at once? Thanks, Thomas
Thomas P Posted February 3, 2018 Author Posted February 3, 2018 Hi folks, maybe a sample helps to explain or gives someone the opportunity to tell me how to copy that line correctly: Get-Content c:serverlist.txt | ForEach-Object {Get-WinEvent -LogName System -maxevent 3 -FilterXPath ‘*[System[(EventID=1074)]]’ –ComputerName $_} | format-table machinename, userid, timecreated –autosize That is a one-liner and imo hard to copy - unless you have a hint how to do it right, i.e. correctly. Thanks, Thomas
Cyboman Posted February 3, 2018 Posted February 3, 2018 Not sure, if I understand your issue... To copy the code: Click on "quote" and it will be displayed in your editor. After that you could delete other text around it. Triple click on the "code line" (= 3 fast clicks on the content line) and copy it (CTRL+C). Tripple clicking selects the whole line / paragraph, at least in MS windows
opentype Posted February 3, 2018 Posted February 3, 2018 1 hour ago, Thomas P said: That is a one-liner and imo hard to copy - unless you have a hint how to do it right, i.e. correctly. I click inside the paragraph and drag down until the end of the paragraph. If it’s just one line, the way to drag down is short, but it works just the same. That selects the whole line.
Thomas P Posted February 3, 2018 Author Posted February 3, 2018 1 hour ago, Cyboman said: Triple click on the "code line" (= 3 fast clicks on the content line) and copy it (CTRL+C). Tripple clicking selects the whole line / paragraph, at least in MS windows I like that one, thanks. What I mean is something more convenient, like here:https://stackoverflow.com/questions/22581345/click-button-copy-to-clipboard-using-jquery try the example, it uses pretty basic HTML. You surely have seen websites where code is posted and there is a button/icon next to it, where you can Copy the code instantly to your clipboard. Especially for scripting/coding forums that would be helpful.
Nathan Explosion Posted February 3, 2018 Posted February 3, 2018 Quick bit of code....basis for you to build on.... <script type="text/javascript"> $(document).ready(function(){ $("pre.ipsCode").append("<i class='fa fa-clipboard neCodeCopy' style='float:left';></i>"); $("i.neCodeCopy").on('click',function(e){ var $neTemp = $("<textarea>"); $("body").append($neTemp); $neTemp.val($(this).parent(".ipsCode").text()).select(); document.execCommand("copy"); $neTemp.remove(); }); }); </script> Add that in via the Google Analytics tracking code box.
Thomas P Posted February 6, 2018 Author Posted February 6, 2018 Awesome This style here for code boxes is pretty cool and clean & easy from a user's point of view: https://www.security-blog.eu/raspberry-pi-als-accesspoint-einrichten/
Recommended Posts
Archived
This topic is now archived and is closed to further replies.