mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Some may already know this, but I wanted to suggest it for those who do not know...

When you use [c[/b]ode] tags in the forum, your code is formatted very nicely. Unfortunately, vertical spacing (extra carriage returns) is lost when viewing the code and if you copy/paste it, it gets placed on a single line. Vertical spacing isn't a real problem, but the copy/paste is very much a problem for newbie scripters as they tend to not reformat it before using codes and then they have problems.

Anyhow, here is my suggestion.

1) Always use [c[b]
ode] tags, for one. It makes codes much easier to read. laugh

2) After posting with a code tag, go back and EDIT your post. You don't need to mark it as being edited or even make any changes to it. Just post your "edited" message.

Ok, now look at it. There is vertical spacing. Try copying/pasting it. You now have correctly formatted copy/paste code.

So, I recommend doing that to any posts that you write using code tags so that newbie users (and veterans as well) can easily copy/paste it.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Unfortunately, for users who use Firefox, all the edited code will be spaced out, which is hideous to look at, and causes $& to malfunction.

Other suggestions would be for them to click the "Quote" link from the person that posted the code, and copy it from there in between the code tags.

One other way would be to copy, /run wordpad, paste in wordpad, and then copy/paste from there to the Scripts Editor.


Gone.
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yeah, I use Wordpad often for that. It works well for pasting into mIRC, but not for pasting to the forum here without first going through mIRC because there is no spacing and every line is spaced out like what you say Firefox does.

Using quote is good, though newbies don't know it. For that matter, they don't know to use Wordpad. That's why I had mentioned it. But, if Firefox displays it with extra spacing, then I guess we have to choose which way is better for newbies. Personally, I'd choose to do the Edit method since more users use IE (not positive if that is true on this particular forum, but in general IE is still the leader... site/forum logs could tell us that information) and because it's easier to remove extra vertical spacing between lines than it is to reformat code from one line into many lines or to explain to users to paste it into Wordpad or to use Quote. And for scripts that use the &+ line breaks to prevent scrolling, a note at the top to make sure the lines are spaced vertically would solve that for the most part.

Dunno... maybe it wasn't such a good idea. Just thought it would benefit people to be able to easily copy/paste without losing the formatting.


Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
The code for the forum could just be updated so they worked correctly both in appearance and for copying on all browsers. I brought this up previously but I guess it never happened.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Indeed, I'm aware of that thread and your post, and find it unfortunate that this issue still hasn't been resolved, which from the looks of it, doesn't seem like a great deal of effort to fix.


Gone.
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
In the meantime, those interested can use this solution locally.

Drag this shortcut and drop it on your Links toolbar:

[*] <a href="javascript:(function(){var c=document.all.tags('pre');for(var i=0;i<c.length;i++)with(c(i))void(outerHTML=outerHTML.replace(/\x3CBR\x3E/g, '\n'));try{void(document.styleSheets(0).addRule('PRE','color:darkviolet'))}catch(e){}})()" target="_blank">Fix code tags</a>

A new button, titled "Fix code tags," will be created on the toolbar. Click it before you copy, and when you paste the code will come out formatted properly.

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
It doesn't work o.O it opens an "Action canceled" page in my IE.


Gone.
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Weird. I double-checked it here, with plain IE 6, and it worked.

Anyway, instead of dragging the shortcut, you can right-click it and select "Add to favorites..."
In the Add Favorite dialog, make sure that the shortcut is created in the Favorites\Links directory. Then it will appear as a button in your Links toolbar.

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Yes those are the steps I've used. However I'm using Avantbrowser which is like Maxthon, simply a layer over IE, and there it didn't work.

Trying it on pure IE, it did work there, nice work smile, although I'd only really call it nice if it works on Avant, since I don't use IE (no tabs = no good)


Gone.
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
It seems to work in Avant. Here's how I set it up.
  1. Right-click this shortcut and select "Add to Favorites..."

    <a href="javascript:(function(){var c=document.all.tags('pre');for(var i=0;i<c.length;i++)with(c(i))void(outerHTML=outerHTML.replace(/\x3CBR\x3E/g, '\n'));try{void(document.styleSheets(0).addRule('PRE','color:darkviolet'))}catch(e){}})()" target="_blank">Fix code tags</a>

    The Add Favorite dialog opens. Click "Create In >>" to expand the dialog to include the subdirectory list. In that list, click "Links" to highlight it, and click OK.
  2. Tools > Avant Browser Options > New Window > [ ] Favorites (uncheck) > OK
  3. View > [x] Links Bar (check)
You can now use the button in the same way you would use it in native IE:



I hope it now works for you.

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Aha, the problem was that I had the option on to open a new window when clicking one of my favourites. I'm gonna contemplate now whether to still enable that function (because I like it), or not have it enabled and be able to copy code properly.

I don't really ever need to copy code from these boards (my only problem is others copying my code incorrectly), so I suppose for me it won't matter much, though for those who do, this little trick will be great.

Great work again, nice initiative.


Gone.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
For some reason, and I don't have a clue as to why, I can't drag & drop that shortcut to my Links toolbar..or any toolbar for that matter. Running Windows XP SP2 with all updates, and Internet Explorer Version 6.0.2900.2180.xpsp_sp2_gdr.050301-151915

I honestly don't know why the version number is that long, but that's what shows for the version when I click Help - About Internet Explorer.

If more information is required, please let me know and I'll supply it. I would love to be able to copy & paste from these forums without having to search the copied line for the appropriate locations where there should be an <Enter> key

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
It didn't work for me either to drag it but you can just right click the link and click "Add to favorites" which will accomplish the same thing.


Gone.

Link Copied to Clipboard