Looking for ABC bookmarklet

Looking for ABC bookmarklet

Hello all,

I’m looking for a bookmarklet that will allow me to select ABC formated text on a webpage, and have it converted to either sheet music or a MIDI (preferably a bookmarklet for each one!) I use premade bookmarklets to do all kinds of things: translate a page, test the reading level, post on Twitter, suppress ads, etc. Has anyone come across an ABC bookmarklet, or has the savvy to create one?

Thanks

Re: Looking for ABC bookmarklet

What’s a bookmarklet?

Posted by .

Re: Looking for ABC bookmarklet

Here ya go:

javascript:function se(d) {return d.selection ? d.selection.createRange().text : d.getSelection()} s = se(document); for (i=0; i<frames.length && !s; i++) s = se(frames[i].document); if (!s || s==”) s = prompt(‘Enter ABC’,”); open(‘http://www.concertina.net’ + (s ? ‘/tunes_detail.html?action=convert&creator=&body=’+ encodeURIComponent(s) : ”)).focus();

Re: Looking for ABC bookmarklet

Just a hunch but I think this page < http://music.gordfisch.net/montrealsession/editor.php > was written by a member known as lildogturpy. If I wanted to try what you’re doing I’d begin with an email to him or her. I don’t really use javascript myself. I grab the text & run it through abcm2ps using batchfiles.

Posted by .

crosspost. Reverend Pete, I’m sure that’s it! ๐Ÿ˜‰

Posted by .

Re: Looking for ABC bookmarklet

When do we get one of those?

Posted by .

Re: Looking for ABC bookmarklet

For those that haven’t done bookmarklets before, create a new bookmark in your browser, and then edit the URL that it points to. Then you copy the code above (make sure it doesn’t have line breaks in it, from when you copy it from this page), and paste it into the URL for the bookmark.

Then you can test it by selecting some ABC from the archive here, and then clicking that bookmarklet. It copies the ABC that you have selected, and submits it to the tune converter on concertina.net.

Pete

Re: Looking for ABC bookmarklet

Hmm. Just created the bookmarklet and it didn’t quite do "as advertised." It works great on the abc files here, but when I grab an abc file from John Chamber’s site it does not work. This is apparently because carriage returns on the chambers site are not seen as carriage returns when the file is ported to concertina site. The result is that the entire abc file is seen as a title! The same thing happens on the abcnotation.com site.

Want to work with me on debugging this? It is a very useful tool if we can get it to work "anywhere."

email cboody at mchsi dot com

Re: Looking for ABC bookmarklet

If it doesn’t work on all of JC’s it definitely won’t work of AK’s.
I bet it works with mustard files.

Posted by .

Re: Looking for ABC bookmarklet

Works fine at the mustard site, but has not worked on any other collection I’ve tried it with. Hence my note to Rev. Pete.

Re: Looking for ABC bookmarklet

You could urlencode the input, and do an alert of it, to see what character is actually there, and then do a regexp to change it to the proper newline.

Unfortunately, I won’t have time until later tonight to take a look at it in more detail.

John Chambers site is using every known online source.
Fiddler’s Companion (for instance) has spaces between the lines; when copied & pasted.

Posted by .

Re: Looking for ABC bookmarklet

If you guys want, give me a list of different URLs that copy/pasting from doesn’t work, and I can dig into it later.

It’s also probable that different browsers on different operating systems will treat it all differently. Which makes this kind of stuff "fun".

Re: Looking for ABC bookmarklet

The issue is always the same when it doesn’t work, so if you solve one you will have solved the others. I think it may be the old carriage return issues that differentiate Mac (what I’m using) and PC. I’ve been using Foxpro. I’ll try Safari, see what happens there, and report back.

Re: Looking for ABC bookmarklet

Works right on Safari, so it is a Foxpro issue on the Mac. Grrrr. If you can code around it great. If not, I do have a solution. I may give up on Foxpro yet.

Re: Looking for ABC bookmarklet

OK, I worked on it for far too long this evening. Here’s an updated bookmarklet, which will convert selected ABC into the sheet music in Safari, Chrome, and Firefox (and probably others…) I tested it in Mac and Windows.

So basically, it works in every browser except Internet Explorer (surprise, surprise ๐Ÿ˜)

I haven’t tested it with every tune archive, but it works with both thesession and JC tunefinder…

Here’s the script: Copy/Paste it into the URL field of a bookmark in your browser, and then you can select ABC, and click the bookmark, to convert it into sheet music (and Midi, on that page, if you want.

javascript:var s;if (window.getSelection) {if (String(window.getSelection()).indexOf(‘\n’) > 0) {s =window.getSelection();} else {s=window.getSelection().getRangeAt(0); }} else if (document.selection){s =document.selection.createRange();}if (!s || s==”) s = prompt(‘Enter ABC’,”);open(‘http://www.concertina.net’ + (s ? ‘/tunes_detail.html?action=convert&creator=&body=’+ escape(s) : ”)).focus();

Re: Looking for ABC bookmarklet

Pete, you are brilliant! … as we knew already ๐Ÿ™‚ Thanks!

— Michael

Re: Looking for ABC bookmarklet

Heh, thanks, Michael! The first attempt at the script took me all of 5 minutes. The second one took me about 3 hours, which I wouldn’t exactly call "brilliant" ๐Ÿ˜‰

Re: Looking for ABC bookmarklet

The one that works is the one that you can call "brilliant". That’s the rule I’ve always used, anyway.

Re: Looking for ABC bookmarklet

Works great, Pete. Thanks!

Posted by .

Re: Looking for ABC bookmarklet

Bravo! Works everywhere I tried it. I’d like permission to let some other folks know about this. It is truly useful for a quick look at things. Let me know if I can publicize it. YOUR credit of course and not mine!

Brilliant seems a reasonable word. I don’t have quite enough java to "get it," but it works great and that’s the real issue!

Re: Looking for ABC bookmarklet

javascript
wooden flute db doesn’t include the reference# on their abcs, & of course Knutz’s site has the spaces between lines. There are simply too many tune collections online which aren’t maintained. (Who’d want to?) But, hey, Pete’s brill ~ because he does take the time.

Posted by .

kuntz
Andre Kuntz has gaps …

Posted by .

Re: Looking for ABC bookmarklet

I’ve now found a few places where the source doesn’t show empty lines but when the materials are passed to Concertina.net the material is "double spaced." If you are having a sleepless night you can check out
http://www.ibiblio.org/fiddlers/LIAM_LITE.htm
and try the abc of Liberty…

Don’t do it for me. I’m very happy with what you’ve done. But I’m also a programmer and I know most of us like feedback and love to struggle with the tough stuff….

Re: Looking for ABC bookmarklet

Pete, you need to set your minimum fee.

Posted by .

Re: Looking for ABC bookmarklet

LOL

I don’t mind you passing this stuff on. It’s still a "beta" because I haven’t taken time to make it work in IE.

And at some point, I’ll look at the other issues. (But the 5 hours of sleep last night, because I couldn’t put it down was probably a bad idea) ๐Ÿ˜‰

Re: Looking for ABC bookmarklet

@Ben, you say that, but I haven’t updated the ABC database for abctunesearch.com in a LONG time. So it is probably missing thousands of recent submissions to this site and others… Sigh.

Re: Looking for ABC bookmarklet

They’re only Abcs. Time spent developing software is time spent not playing tunes. Who uses Internet Explorer?

Posted by .

Re: Looking for ABC bookmarklet

"(But the 5 hours of sleep last night, because I couldn’t put it down was probably a bad idea) ๐Ÿ˜‰"

Been there. Bought the T-shirt. Once was enough but unfortunately is wasn’t.

Thanks for all you’ve done.

Ben’s right about playing….