TextExpander URL Subdomain Slicer
Today's snippet example is highlighting the power of built in JavaScript utilities with TextExpander. Both are pretty powerful tools and lots of flexibility. Together they make you super productive.
JavaScript has a lot of very cool built in text utilities. You can easily implement some of these in TextExpander. This week we are going to look at a cool use of the JavaScript slice tool.
In my testing enviroment we have different subdomains and sometimes I just need to reference the one I am working on. So I created this simple TextExpander JavaScript snippet:
JavaScript Snippet
var mylocation = '%clipboard';
var start = mylocation.indexOf("://")+3;
var end = mylocation.indexOf(".")
var domain = mylocation.slice(start,end);
domain;
Snippet Abbreviation
ddomain
Real World Use
When I comment in a ticket, I can now easily reference the server that I am working on as part of the description text:
I am encountering a problem on the dev20 server when trying to login:
https://dev20.serverbot.com/login