Jump to content

AGBear

Member
  • Posts

    5
  • Joined

  • Last visited

Posts posted by AGBear

  1. Hi everyone,

     

    I have to work with Office 365 Advanced Threat Protection 'safelinks' all day long: these are URLs checked for phishing and other cybersecurity issues, then converted into a unique format.

     

    https://aus01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.google.com%2F&data=04|lots of parameters and personally identifiable information that isn't important for this purpose|

     

     

    There are many tools available to decode these URLs - like https://o365atp.com/ .

     

    Rather than pasting URLs into that website every time, I want to use Alfred to process the Office URLs and return the 'real' URL to the clipboard.

     

    Digging into the source of that website, the underlying Javascript is pretty straightforward. However my knowledge of scripting is limited to basic bash (and some Perl ten years ago) so I don't know how to convert that link variable into a query passed from Alfred. Can anyone help with this? Thanks in advance!

     

    function decode_url()
    {
        setTimeout("generate_decode_url()", 20);
    }
    
    function generate_decode_url()
    {
        var link = document.getElementById("safelink").value;
        var url_parts = link.split("?")[1];
        var params = url_parts.split("&");
        var target_url = "Error:  couldn't find target URL.";
        for(n=0;n<params.length;n++)
        {
            namval = params[n].split("=");
            if(namval[0]=="url") target_url = namval[1];
        }
        
        decode_url = decodeURIComponent(target_url);
        document.getElementById("target_url").value = decode_url;
        
    }
    
    function clear()
    {
        location.reload();
    }

     

     

  2. Hi everyone,

     

    I had a couple of great Alfred workflows that worked fine under 10.8, but no longer work after upgrading to Mavericks. I'm on Alfred 2.1 and have enabled accessibility access for Alfred. The malfunctioning workflows are:

     

    - Restart to Windows: Simple Applescript that runs

    do shell script "bless -mount /Volumes/BOOTCAMP/ -legacy -setBoot -nextonly; shutdown -r now" with administrator privileges
    

    It asks for a password and reboots, but it boots back to OS X. Works fine as a bash script using sudo, but unfortunately you can't run a sudo bash script from Alfred (potential feature request!)

     

    - Markdown help: Applescript by MacGeeky that parses browser input/selected text and wraps it in Markdown URL tags. Too large to paste here, but more information is at http://www.alfredforum.com/topic/2745-markdown-help-insert-formatted-text-links-from-browser-and-images/

     

    Any suggestions? Other Applescript and Python workflows work fine...

     

    Cheers,

     

    Alan

×
×
  • Create New...