Subject: Timestamp Thingies

Posted on: May 12 2012 @ 03:51 PM
By: Full+Metal+Lion

Content:

As a Person Who Roleplays Sometimes, I copy-paste the roleplay I do into a text file(compulsively). Sometimes, I wish to copy-paste from the text file onto the wiki. However, I'm sure it'd look much better without the "[XXmXXs]|" timestamp. Does anyone have a simple, low effort way to remove the timestamps from a text file, other than just deleting them one by one?



Replies:

Re: Timestamp Thingies

Posted on: May 12 2012 @ 04:03 PM
By: Full+Metal+Lion

Content:

I can also assume nobody speaks in brackets and get rid of the "[", but I'm still looking to get rid of the manual bit.

In Addition Edit: I've noticed that GreaseMonkey has asterisks mean "anything can go here", so maybe other things have that also, which someone else could use to make a beefed-up find-and-replace?


Re: Timestamp Thingies

Posted on: May 12 2012 @ 04:10 PM
By: Trowa

Content:

Yeah... Find and Replace can only take you so far. Maybe there's a trick in GDocs or another fancier word processor to detect numbers?


Re: Timestamp Thingies

Posted on: May 12 2012 @ 03:57 PM
By: Collin-Vee

Content:

Quote by: Full+Metal+Lion

As a Person Who Roleplays Sometimes, I copy-paste the roleplay I do into a text file(compulsively). Sometimes, I wish to copy-paste from the text file onto the wiki. However, I'm sure it'd look much better without the "[XXmXXs]|" timestamp. Does anyone have a simple, low effort way to remove the timestamps from a text file, other than just deleting them one by one?



In notepad, use find and replace. You can eliminate the "s] | " bit right off the bat, which is a lot if it's a long session. Other than that, it's manual.


Re: Timestamp Thingies

Posted on: May 12 2012 @ 09:02 PM
By: Wongo+the+Sane

Content:

How I'd do it (with Office 2007):

Copy-paste into Excel
Select the first column - this is where all your text will be.
Choose the 'Data' tab on the ribbon
Use the 'Text to Columns' function in the 'Data Tools' area
Make sure the 'Delimited' option is selected, and click 'Next'.
In the 'Delimiters' section, check the 'other' box and type ']' into the text box beside it.
Click Next
Click Finish

Hopefully now you will only have the remains of timestamps in the first column and all the important text will be in column 2. You will have to scroll down manually and check this is the case. Once it definitely is the case, copypaste column 2 back into your document format of choice.

Also workable in Open Office.


Re: Timestamp Thingies

Posted on: May 12 2012 @ 10:23 PM
By: Full+Metal+Lion

Content:

Brilliant! I can even just open the text file as a spreadsheet, do the thing, and copy it... to itself. Hmm. Anyway, before I do that, I can use find and replace to get rid of the spaces after the broken bar by hunting down " " and then "".

I award all the people here a (counterfeit) Nobel Prize! (But mostly Wongo)


Re: Timestamp Thingies

Posted on: May 12 2012 @ 11:17 PM
By: Buddleia

Content:

That's a brilliant idea.

However, some people (like me) like to copypasta scenes into a googledoc to preserve the formatting. Or at least the colours. Wouldn't sending it to Excel, doing a fiddle, and then to another file strip it to plaintext?

Back when we could export logs to html, someone * made a little program which stripped out all the timestamps and stuff. (I think he made it for copying scenes to the wiki.) Any volunteers from the ranks of Those Who Know Computers? Anyone know if that could be done to a googledoc, rather than to a plaintext file?


----------------
* Someone who no longer plays. I could email him and ask how he did it, but there's no guarantee of a response, let alone of him being able to find and give us the program.


Re: Timestamp Thingies

Posted on: May 14 2012 @ 10:58 PM
By: Darael

Content:

A quick search turns up FoxReplace, which (for Firefox only - sorry, Chrom[e|ium]/Opera/etc users!) provides regular expression-based search-and-replace. I'll look for a Chrome solution, or a bit of Javascript I can make into a bookmarklet for you.

I haven't used it myself, but the regex you'd want to search for (and replace with an empty string, of course) would look like this:

REGEX Formatted Code
\[[0-9][0-9][dhm][0-9][0-9][hms]\]|

Note that it has a space at the end, after the vertical bar, but that there doesn't seem to be one before it.

To explain: [ and ] are special in regular expressions, so we escape the two we want to match with a \.
A set of characters between [] matches any character in that set. [0-9] is thus any digit, and [dhm] is any of the letters d, h or m.
Also note that the vertical bar that's used doesn't seem to be the same character as the pipe (|), which is the closest thing on my keyboard but renders differently, so you probably want to copy-paste it, and not from here, since I've used a pipe because the forum software turns the actual character into "│" within the code block.


Re: Timestamp Thingies

Posted on: May 14 2012 @ 11:16 PM
By: Darael

Content:

Since I can't edit my last post any more, I will point out that there is a Chrome extension equivalent to FoxReplace.

Additionally, if you're using a program rather than, say, Google Docs, have a look to see if it does some kind of pattern-matching search-and-replace.


Re: Timestamp Thingies

Posted on: May 14 2012 @ 11:23 PM
By: Twosocks+Monkey

Content:

Can someone explain the foxreplace in english for those of us who don't understand complicated code language things?

Yes I know I've fiddled in programming, I'm still a dolt when it comes to these things. And I REALLY WANT an easy way to suck all those little timestamp gremlins out of my gdocs.

MOO!

-Rose


Re: Timestamp Thingies

Posted on: May 14 2012 @ 11:30 PM
By: Darael

Content:

Basically, install the addon, and open up the new find-and-replace tool. In the "Replace" box, copy-paste the line in the Code section from my first post in the thread. Replace the | with the actual bar, copy-pasted from the Island or the copy to be edited, and make sure it ends with a space. Open up the googledoc containing the log, and make sure the "With" box is empty. Press the "replace" button.

Bear in mind I'm using Chrome at this moment, so I only have some screenshots to work from, and they were taken in Spanish. Nevertheless, that should do the trick.
I've also discovered that, unfortunately, the Chrome extension I pointed at, which claimed to support regex, doesn't.


Re: Timestamp Thingies

Posted on: May 15 2012 @ 02:22 AM
By: Buddleia

Content:

I've installed FoxReplace to try this out. After some fighting, I think I've got the substitution set up. But when I try to run it on a googledoc, it a) doesn't work and b) crashes the doc. (I have to close the tab and reopen it from my Docs list - just refreshing the tab doesn't uncrash it.)

Click for fullsize. The "|" at the end is the cursor, not something I typed.

I tried setting it as text, and setting it as a regular expression.
I tried it with and without the .


Right, so, what am I doing wrong?


And incidentally, why on earth does the FoxReplace help have to be so hard to find? "If you need usage instructions, you can find them at Tools -> FoxReplace -> Help" - Firefox doesn't seem to have a tools menu, unless I'm missing something really obvious. And why is FoxReplace's help filed under Chrome? (chrome://foxreplace/content/help.xhtml)


I am obviously not cut out for a career in computing...


Re: Timestamp Thingies

Posted on: May 15 2012 @ 07:58 AM
By: Darael

Content:

I'll actually install the thing and get back to you.


Re: Timestamp Thingies

Posted on: May 15 2012 @ 08:09 AM
By: CavemanJoe

Content:

Hey guys! One day soon I will re-do the old Commentary Export thingy, but until then, do you know what might be useful?

The timestamps are right there in the output! Just view the page source to get it. A single comment looks like this:

PHP Formatted Code
<span class='singlecomment'><span id='comment_1' style='font-family: Courier New, Courier, monospace;' commenttime='1337068988'>[<span class='colDkYellow'></span><span class='colDkCyan'>03</span>m<span class='colDkRed'>25</span>s</i>]</span><span class='typingstatus' typingstatus_acctid='1' chatsection='village_aux' style='display:none; color:#ffffff;'>&#9474;</span><span class='onlinestatus' onlinestatus_acctid='1' chatsection='village_aux'><span style='color:#009900'>&#9474;</span></span></i><a href='bio.php?char=1' target="_blank" class="commentarymouseoverlink"><span class='colLtWhite'><b></span><span class='colLtMagenta'>Admin</b> </span><span class='colLtRed'>Caveman</span><span class='colDkGreen'>Joe</span></i><span class="commentarymouseover"><span id='commentarymouseover_physdesc'><table width=100% border=0 cellpadding=1 cellspacing=0><tr><td><img align='left' src='images/avatars/201111301536CavemanJoe.jpg'  height="81"  width="100" >A ridiculous-looking gentleman in a leather jacket.</tr></td></table></span><br>
</i><span id='commentarymouseover_race'>Male Vicious Wild Admin</span><br /></i><span id='commentarymouseover_armour'>Wearing: Tattered Leather Jacket</span><br /></i><span id='commentarymouseover_weapon'>Wielding: Test Weapon</span><br /></i></span></a>&nbsp;<span class='colLtWhite'>says "</span><span class='colDkGreen'></i>Hey guys this is a test</i></span><span class='colLtWhite'>&quot;</span></i></span><br />


In there, you'll see, towards the start, a span tag with a "commenttime" attribute. That's there for a Javascript-related reason. It's a Unix timestamp!

...maybe that'll be helpful for converting to an absolute time?


Re: Timestamp Thingies

Posted on: May 15 2012 @ 08:14 AM
By: Darael

Content:

CMJ: My understanding was that people were looking for an easy way to strip out the timestamps, rather than to convert them to the actual times.

On the other hand, that information leaves me tempted to produce a Greasemonkey script that replaces the xx[dhm]xx[hms] with a proper timestamp.


Re: Timestamp Thingies

Posted on: May 15 2012 @ 08:21 AM
By: CavemanJoe

Content:

You could use a regular expression...? I don't really grok them myself, but this is exactly what they're for.


Re: Timestamp Thingies

Posted on: May 15 2012 @ 08:25 AM
By: Darael

Content:

Been there, done that. It's exactly what I would do, but we're talking nontechnical players using Google Docs, which removed their regex search-and-replace ages ago, and the browser plugins supposed to provide that feature don't seem to be working.

I provided a regex (a POSIX.2 one, so it should work just about anywhere) that ought to match the timestamp part in my first post in this thread, but...

In any case, a Greasemonkey script that they could toggle on for the copying would probably be better just because it would be one less step that needed any real thought.


Re: Timestamp Thingies

Posted on: May 15 2012 @ 01:26 PM
By: Count+Sessine

Content:

Quote by: Darael

Been there, done that. It's exactly what I would do, but we're talking nontechnical players using Google Docs, which removed their regex search-and-replace ages ago, and the browser plugins supposed to provide that feature don't seem to be working.

I provided a regex (a POSIX.2 one, so it should work just about anywhere) that ought to match the timestamp part in my first post in this thread, but...

In any case, a Greasemonkey script that they could toggle on for the copying would probably be better just because it would be one less step that needed any real thought.

Many of us have started using Google Docs for scene logs because when you copy and paste with Chrome, the text colours and fonts are preserved, and it will even grab embedded graphics. You can also copy over Place descriptions if you want, or anything else that's appropriate to complete the story. There's a template (created by Shiloh) with a background colour that's a good match for the Default skins. This produces sharable archive results nice enough that they are, in my opinion, superior to the old commentary export files. (Example.)

That example still retains its timestamps, but often I do strip them out by hand. Manually deleting timestamps only takes a few minutes, even for fairly lengthy scenes; any script or plugin intended to save time should be easier than that. Other browsers don't capture any colours and formatting, they only copy the text, so for this use any 'Timestamp-Stripper' Greasemonkey script definitely needs to work in Chrome.

On the other hand, for uploading to the Wiki, a text-only file with no span tags at all is what's required, and for that it would also be nice to have \\ inserted before newlines.


Re: Timestamp Thingies

Posted on: May 15 2012 @ 03:20 PM
By: Darael

Content:

Quote by: Count+SessineMany of us have started using Google Docs for scene logs because when you copy and paste with Chrome, the text colours and fonts are preserved, and it will even grab embedded graphics. You can also copy over Place descriptions if you want, or anything else that's appropriate to complete the story. There's a template (created by Shiloh) with a background colour that's a good match for the Default skins. This produces sharable archive results nice enough that they are, in my opinion, superior to the old commentary export files. (Example.)

That example still retains its timestamps, but often I do strip them out by hand. Manually deleting timestamps only takes a few minutes, even for fairly lengthy scenes; any script or plugin intended to save time should be easier than that. Other browsers don't capture any colours and formatting, they only copy the text, so for this use any 'Timestamp-Stripper' Greasemonkey script definitely needs to work in Chrome.

On the other hand, for uploading to the Wiki, a text-only file with no span tags at all is what's required, and for that it would also be nice to have \\ inserted before newlines.


I'd gathered that people were using Google Docs, and why. I was mostly thinking that it's easier to push a button and they disappear before you copy-paste than it is to run something on the doc afterwards. Thanks, though, for the reminder that I need not to use any GM-specific functions if I do write this thing, to make sure it does work in Chrome.

For Wiki-uploads, it's probably easiest to copy-paste into, say, Notepad++, and use its search-and-replace to strip timestamps and/or insert backslashes before newlines. That would also strip formatting, of course. Incidentally, the same script that cut timestamps for copypasting to the GDoc should work for taking it to a plain-text editor, and could have an option to change as much formatting as possible into the appropriate wiki-syntax (which would probably only be italics; I don't believe Doku allows changing font colours, does it?).

All this assumes I'll actually have time to write the thing.


Re: Timestamp Thingies

Posted on: May 15 2012 @ 03:38 PM
By: Trowa

Content:

Quote by: Darael

I was mostly thinking that it's easier to push a button and they disappear before you copy-paste than it is to run something on the doc afterwards. Thanks, though, for the reminder that I need not to use any GM-specific functions if I do write this thing, to make sure it does work in Chrome.


That would be awesome!! Mr. Green


Re: Timestamp Thingies

Posted on: May 15 2012 @ 03:40 PM
By: Darael

Content:

Quote by: Trowa


That would be awesome!! Mr. Green



I'll try, but seriously: No promises. For a start I'm more of a Lispnik than a JS hacker, and I haven't had much time for my own projects recently.

EDIT: Incidentally, I wonder if CMJ (or whoever handles the wiki software if it's someone else) could be persuaded to add the dokuwiki "color" plugin, with colornames.php adjusted such that the one-character colour codes from the game worked? That'd be kind of cool, and would mean that version 1.0 of this little script could be able to fully convert to wiki syntax. It need not be the one-character codes, of course, since the HTML source doesn't use those but some longer names, but it would be more familiar, I think, for manual usage.


Re: Timestamp Thingies

Posted on: May 15 2012 @ 04:28 PM
By: Laurence

Content:

Quote by: Count+Sessine

On the other hand, for uploading to the Wiki, a text-only file with no span tags at all is what's required, and for that it would also be nice to have \\ inserted before newlines.



While it's no good for gdoc beautifying, this sucker should do the trick if you wanted plaintext with the timestamp stripped and \\ before newlines:

https://docs.google.com/spreadsheet/ccc?key=0AtMwg_m_OXS-dE1iWHNoRnBQbWpQOEtKSG1nSVhGSVE

(The magic being the formula for the B column, of course.)


Re: Timestamp Thingies

Posted on: July 08 2016 @ 09:04 AM
By: Full+Metal+Lion

Content:

Quote by: Full+Metal+Lion

As a Person Who Roleplays Sometimes, I copy-paste the roleplay I do into a text file(compulsively). Sometimes, I wish to copy-paste from the text file onto the wiki. However, I'm sure it'd look much better without the "[XXmXXs]|" timestamp. Does anyone have a simple, low effort way to remove the timestamps from a text file, other than just deleting them one by one?


Ha ha, look at this adorable guy who doesn't know how to use regexes! WOOK AT HIS WIDDLE FACE.

Ahem. Anyhow, Darael had it mostly right, but the regex I would recommend is
^.*?│ ?
because this will catch everything from the beginning of the line up through the "│" and will catch the space before a character's name, if there is one (characters with no title have a space in front of their names). This fixes an edge case where a player might literally type "[01h01m]│" or something that fits the pattern into chat. I suppose that you could use
^\[[0-9][0-9][dhm][0-9][0-9][hms]\]│ ?
but why would you?

(You might want to if, say, a player has figured out how to sneak newlines into chat and keeps typing "│" after everything he types for some reason, but fuck that guy! He doesn't deserve to have his chat logged!)

As noted, the vertical line is not a pipe ("|"), but rather U+2502 : BOX DRAWINGS LIGHT VERTICAL.

Using this regex is the hard part, because the text editor you most likely have on your computer is Notepad, which won't help you here. If you don't want to install a better text editor (gedit and Notepad++ are fine, user-friendly options) then you can use various websites on the internet to apply your regexes. Just type "apply regex online" into your preferred search engine and pick the first thing that comes up. You will need to specify for these sites that you are using the flags/modifiers "g" for global and "m" for multi-line. You may also need to find the button that lets you actually use the regex to replace what it matches (you want to replace the matches with the empty string, of course).


Re: Timestamp Thingies

Posted on: July 08 2016 @ 02:12 PM
By: Trowa

Content:

Quote by: Trowa

Quote by: Darael

I was mostly thinking that it's easier to push a button and they disappear before you copy-paste than it is to run something on the doc afterwards. Thanks, though, for the reminder that I need not to use any GM-specific functions if I do write this thing, to make sure it does work in Chrome.


That would be awesome!! Mr. Green



Quote by: Full+Metal+Lion

Quote by: Full+Metal+Lion

As a Person Who Roleplays Sometimes, I copy-paste the roleplay I do into a text file(compulsively). Sometimes, I wish to copy-paste from the text file onto the wiki. However, I'm sure it'd look much better without the "[XXmXXs]|" timestamp. Does anyone have a simple, low effort way to remove the timestamps from a text file, other than just deleting them one by one?


Ha ha, look at this adorable guy who doesn't know how to use regexes! WOOK AT HIS WIDDLE FACE.





Good grief, I totally forgot about this thread. And you know what I did? I went and made a GDoc that deletes the time stamps at the push of a button!

https://docs.google.com/document/d/1gdujlgQ7eSpL61afkknPJQUe8-gqgGQXZ-1EFwrjzj8/edit?usp=sharing

I just never shared it here because CMJ was working on one already (has produced one by now), and didn't want to compete with his. I shared my doc with other people, though, who shared it with other people, who shared it with more people, and so on. >_>

Mine goes a couple steps further now, though. Some people asked if they could use it with old logs copied with CMJ's old export tool (before the chat was all upgraded and fancified), and if I could also get it to delete time stamps from Rentoraa's chat logging script. I did all this, and more! For place owners (or just those with the right keys), you can copy and paste an entire log including the GREM'd posts, and my script will highlight them.

For the nuts and bolts, I used...

Quote by: Full+Metal+Lion

I suppose that you could use

^[[0-9][0-9][dhm][0-9][0-9][hms]]│ ?
but why would you?



::stares at his own script::
bodyElement.replaceText('\\[[0-9]{2}[mhd][0-9]{2}[smh]\]\!? ?✓?X?│? *', '');

....

DAMNIT.


On the other hand... your shortened and very awesome tidbit of code fails on Special Comments. So I'm gonna go test on that when I have time this weekend. But to be honest, I had no idea what I was doing or how regular expressions worked until I started this project three years ago. My original version of this script had about five different lines for some reason! Rolling Eyes


For reference, in the copy of log snippets I received to test on, Rentoraa's script was replacing the "box drawings light vertical" with a regular pipe. However, that script does this to moderators that were copy/pasting their logs:
X [Tue 10 Mar 2015 18:59:02]| The Dandy Wallguard TrowaX│The Dandy Wallguard Trowa says "Hello, Quinn!"


And the "legacy" (as I call them) logs looked like this:
2011-03-10 18:33:37: Lizard of Fury Ryushi: : comes out of Booz with glowing red eyes of rage. Though, he seems like he's handling it well... "Neat."


PS: You the man, FML!


Re: Timestamp Thingies

Posted on: July 09 2016 @ 07:54 AM
By: Full+Metal+Lion

Content:

Quote by: Trowa

your shortened and very awesome tidbit of code fails on Special Comments.


Dang. You are so right.

I mean, you should be able to fix this using
^.*?\]\!? ?✓?X?│? ?
(I don't know what that exclamation mark and first space are doing but I trust you) but it's also just struck me that this makes it theoretically impossible to tell what should be included by using a regex and plain text. What if, for example, I wanted to make the special comment"*│"? This would show up as "[00m00s]|" and be caught by the regex. Even worse, the special comment "*X|" would match if a person without the right keys copy-pasted it.

This is only unsolvable in theory, of course. The practical answer is that no one cares.

No, you da man!


Re: Timestamp Thingies

Posted on: July 19 2016 @ 02:27 PM
By: Snow+Gray

Content:

Totally irrelevant to the current coding back and forth, but I just wanted to pipe up that I still use Trowa's log gdoc for my RPs! Big Grin


The Improbable Island Enquirer - Forum
http://enquirer.improbableisland.com/forum/viewtopic.php?showtopic=27949