Excursions avatar

Getting Post URL in Drummer

I enjoy writing posts in Drummer. One of the many reasons for that is I can see all my posts in the same editing space. It is so easy to scroll through all your posts and find reference to just that one old post.

One thing that missing, though, was there was no easy way to get the url for that post right in Drummer. So, I got scripting. I have created a script which does just that. Select any node, run the script, and it will present the URL for that post in a dialog box. Here’s how you enable it.

  • Copy the below Drummer script and paste it in your special opml file for Scripts menu (File ⇾ Special files ⇾ Scripts menu…)
  • You will see a new entry in Scripts menu
  • Select any node, even the headline (a titled post), and select the newly added script menu item

You will get the URL for the selected node.

Get Post URL
	var created = op.attributes.getOne("created");
	var baseurl = opml.getHeaders().urlBlogWebsite;
	if(typeof(baseurl) == "undefined"){
		baseurl = "http://oldschool.scripting.com/" + opml.getHeaders().ownerTwitterScreenName + "/";
	}
	var dt = new Date(created)
	var day = (dt.getUTCDate() < 10 ? '0' : '') + dt.getUTCDate();
	var month = ((dt.getUTCMonth() +1) < 10 ? '0' : '') + (dt.getUTCMonth() + 1);
	var year = dt.getUTCFullYear();
	var hour = (dt.getUTCHours() < 10 ? '0' : '') + dt.getUTCHours(); 
	var minutes = (dt.getUTCMinutes() < 10 ? '0' : '') + dt.getUTCMinutes()
	var seconds = (dt.getUTCSeconds() < 10 ? '0' : '') + dt.getUTCSeconds()
	var post = opml.parse(op.getCursorOpml());
	var isTitledPost = typeof(post.opml.body.subs[0].subs) != "undefined";
	var postUrl = "";
	if(isTitledPost) {
		postUrl = baseurl + year + "/" + month + "/" + day + "/" +  hour + minutes + seconds + ".html";
		postUrl = postUrl + "?title=" + op.getLineText();
	} else 
	{
		postUrl = baseurl + year + "/" + month + "/" + day + ".html#a" +  hour + minutes + seconds;
	}
	dialog.ask("This is the URL for the selected post:",  postUrl);

A T20 with less than run a ball required, going into the 19th over, still in balance. Now, that’s not too common. This is going to be a different T20 World Cup.

I really liked what Frank Meeuwsen did with his script to crosspost to WordPress from Drummer. I did attempt to get inspired by it and create a script to crosspost to Micro.blog. But, I hit the CORS issue and then I stopped. I have already signed up for too many side projects to spend my time on. I don’t want to add to the list.

Reminder to self: Don’t join another community now. If you can’t contribute or have strong feeling about any discussion in-progress in there, it’s not for you.

I wish there was another view for the timeline at Micro.blog that displays just the long-form posts one after another. The way the timeline is currently, it is always too busy with micro posts, replies and especially images. The updates with just a link in them tend to get lost. Ideally, what I would want is 3 views minimum – the current one can stay the default. But original posts only and long-form only would be good filters to have.

My daughter wanted to record a different video this week. In her words, she didn’t want to record about any “sciency facts”. She wanted to talk about the first novel that she read. So, that’s what she did.

I am subscribed to too many newsletters. If a day goes by without reading, there’s a huge backlog of unread issues. I think it’s time prune the list a bit.

I hope I didn’t break posting earlier. Did I? This is a test to check that. Fingers crossed that the post fails.

I knew there would soon be a way to post to my blog hosted by Micro.blog via Drummer. I didn’t know Manton will get it done so soon! And more the feature, it is the way it is implemented that impresses me. Kudos @manton!