Enquirer Home Page | Twitter | Back to Improbable Island

 Forum Index > Off-Topic > Out-of-Game New Topic Post Reply
 Timestamp Thingies
 |  Printable Version
Full Metal Lion
 Saturday, May 12 2012 @ 03:51 PM UTC (Read 8280 times)  
Forum Improbable Badass
Improbable Badass

Status: offline

Registered: 12/19/11
Posts: 436

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?


 
Profile Email Website
Quote
Collin-Vee
 Saturday, May 12 2012 @ 03:57 PM UTC  
Forum Badass
Badass

Status: offline

Registered: 03/17/12
Posts: 108

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.


 
Profile Email
Quote
Full Metal Lion
 Saturday, May 12 2012 @ 04:03 PM UTC  
Forum Improbable Badass
Improbable Badass

Status: offline

Registered: 12/19/11
Posts: 436

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?


 
Profile Email Website
Quote
Trowa
 Saturday, May 12 2012 @ 04:10 PM UTC  
Forum Improbable Badass
Improbable Badass

Status: offline

Registered: 01/09/11
Posts: 426

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?


Something something unintelligible gibberish something.
 
Profile Email
Quote
Wongo the Sane
 Saturday, May 12 2012 @ 09:02 PM UTC  
Forum Badass
Badass

Status: offline

Registered: 05/14/10
Posts: 104

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.


 
Profile Email
Quote
Full Metal Lion
 Saturday, May 12 2012 @ 10:23 PM UTC  
Forum Improbable Badass
Improbable Badass

Status: offline

Registered: 12/19/11
Posts: 436

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)


 
Profile Email Website
Quote
Buddleia
 Saturday, May 12 2012 @ 11:17 PM UTC  
Forum Improbable Badass
Improbable Badass

Status: offline

Registered: 04/23/10
Posts: 343

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.


Improbable Reference Links - goo.gl/MRBnb -------------- Land Registry (map of Places) ---- goo.gl/bpkRR
 
Profile Email Website
Quote
Darael
 Monday, May 14 2012 @ 10:58 PM UTC  
Forum Newbie
Newbie

Status: offline

Registered: 12/07/09
Posts: 9

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.


 
Profile Email
Quote
Darael
 Monday, May 14 2012 @ 11:16 PM UTC  
Forum Newbie
Newbie

Status: offline

Registered: 12/07/09
Posts: 9

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.


 
Profile Email
Quote
Twosocks Monkey
 Monday, May 14 2012 @ 11:23 PM UTC  
Forum Improbable Badass
Improbable Badass

Status: offline

Registered: 01/28/11
Posts: 246

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


moooooooooo Visit and help me finish the monster list: goo.gl/rpBGe (Ya'll mostly know me as CLOG, fyi)
 
Profile Email Website
Quote
Darael
 Monday, May 14 2012 @ 11:30 PM UTC  
Forum Newbie
Newbie

Status: offline

Registered: 12/07/09
Posts: 9

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.


 
Profile Email
Quote
Buddleia
 Tuesday, May 15 2012 @ 02:22 AM UTC  
Forum Improbable Badass
Improbable Badass

Status: offline

Registered: 04/23/10
Posts: 343

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...


Improbable Reference Links - goo.gl/MRBnb -------------- Land Registry (map of Places) ---- goo.gl/bpkRR
 
Profile Email Website
Quote
Darael
 Tuesday, May 15 2012 @ 07:58 AM UTC  
Forum Newbie
Newbie

Status: offline

Registered: 12/07/09
Posts: 9

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


 
Profile Email
Quote
CavemanJoe
 Tuesday, May 15 2012 @ 08:09 AM UTC  
Forum Admin
Admin

Status: offline

Registered: 02/24/08
Posts: 2281

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?


 
Profile Email Website
Quote
Darael
 Tuesday, May 15 2012 @ 08:14 AM UTC  
Forum Newbie
Newbie


Status: offline

Registered: 12/07/09
Posts: 9

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.


 
Profile Email
Quote
CavemanJoe
 Tuesday, May 15 2012 @ 08:21 AM UTC  
Forum Admin
Admin

Status: offline

Registered: 02/24/08
Posts: 2281

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


 
Profile Email Website
Quote
Darael
 Tuesday, May 15 2012 @ 08:25 AM UTC  
Forum Newbie
Newbie

Status: offline

Registered: 12/07/09
Posts: 9

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.


 
Profile Email
Quote
Count Sessine
 Tuesday, May 15 2012 @ 01:26 PM UTC  
Forum Moderator
Moderator

Status: offline

Registered: 08/16/08
Posts: 1400

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.


 
Profile Email
Quote
Darael
 Tuesday, May 15 2012 @ 03:20 PM UTC  
Forum Newbie
Newbie

Status: offline

Registered: 12/07/09
Posts: 9

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.


 
Profile Email
Quote
Trowa
 Tuesday, May 15 2012 @ 03:38 PM UTC  
Forum Improbable Badass
Improbable Badass

Status: offline

Registered: 01/09/11
Posts: 426

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


Something something unintelligible gibberish something.
 
Profile Email
Quote
Content generated in: 0.84 seconds
New Topic Post Reply



 All times are UTC. The time is now 06:36 PM.

Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content