Results 1 to 5 of 5

Thread: What's Wrong with this Script to Open IE URLs in Firefox?

  1. #1
    Join Date
    Nov 2006
    Location
    Melbourne (Victoria, OZ)
    Beans
    914
    Distro
    Ubuntu 13.10 Saucy Salamander

    What's Wrong with this Script to Open IE URLs in Firefox?

    Hi. A while back, I successfully used the guide for registering MHT web archives in this post: http://ubuntuforums.org/showthread.p...05#post3311005. The original purpose of the thread was on how to open .url internet shortcuts (what Internet Explorer puts on the desktop) in Firefox, so I gave it a go, expecting it to work as well as the other guide.

    I've followed all the steps, but when trying to open an .url, Firefox will open, but instead of going to the web page, it gives me this error message:

    Firefox doesn't know how to open this address, because the protocol (basehttp) isn't associated with any program.

    You can read the whole guide via the link above, but here is the script:

    #!/usr/bin/perl

    # Script to make Microsoft Windows Internet Shortcuts (*.url) work on Linux.

    # Oomingmak fixed version. This script now works properly.
    # It no longer cuts off the last character of the URL.

    # Open up the file
    open(F,"<$ARGV[0]") or die "$0: Could not load Internet Shortcut file $ARGV[0]!\n";

    # Find the URL
    while($in = <F> and not $url) {
    chomp($in);
    if($in =~ m/\s*URL\s*\=\s*\S*\s*\015*/) {
    $url = $in;
    $url =~ s/\s*URL\s*\=\s*//; # Filter out the beginning stuff
    $url =~ s/\s*\015+//; # Filter out the nasty DOS carriage return!


    }
    }

    system "firefox $url &";# or die "$0: Could not open $netscape\n"


    If you can see something obvious, please leave suggestions to rectify this. Obviously I've assigned Firefox to open it, which it tries to, so the rest of it is beyond my understanding. Cheers. Frank
    Soylent Green is PEOPLE!!!

    =D> First Stop for Ubuntu Newbies

  2. #2
    Join Date
    Nov 2006
    Location
    Melbourne (Victoria, OZ)
    Beans
    914
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: What's Wrong with this Script to Open IE URLs in Firefox?

    I managed to get an .url to open without that error, by editing its contents. Ideally, you shouldn't need to, and seems others who tried this had success without having to do so (at least on earlier versions of Ubuntu). This would be a pain for a Windows user with hundreds of .urls, but at least it works. Just open each .url file and remove the first 2 lines (as marked in red):

    [DEFAULT]
    BASEURL=http://ubuntugenius.wordpress.com/

    [InternetShortcut]
    URL=http://ubuntugenius.wordpress.com/
    IDList=
    IconFile=http://www.gravatar.com/blavatar/b040b12c9e739ace052197f85996bd27?s=16&d=http://s.wordpress.com/favicon.ico
    IconIndex=1
    [{000214A0-0000-0000-C000-000000000046}]
    Prop3=19,2


    If someone could supply a command that removes the first 2 lines of all files with the .url extension, please post it here.

    PS: I still have no idea why people save .url files in My Documents and on the desktop... I mean, haven't you guys heard of the Favorites menu (Bookmarks in every other browser)? [I'm doing all this for someone who never listened to me regarding this, but now plans to bookmark each of the sites the .urls open]
    Last edited by OzzyFrank; November 27th, 2009 at 12:21 AM.
    Soylent Green is PEOPLE!!!

    =D> First Stop for Ubuntu Newbies

  3. #3
    Join Date
    Oct 2011
    Beans
    3

    Re: What's Wrong with this Script to Open IE URLs in Firefox?

    The regexp that matches the "URL=" will skip the "BASEURL=" if you anchor the URL with ^URL
    Code:
    if($in =~ m/\s*^URL\s*\=\s*\S*\s*\015*/) {

  4. #4
    Join Date
    Jun 2008
    Location
    Tennessee
    Beans
    3,415

    Re: What's Wrong with this Script to Open IE URLs in Firefox?

    Quote Originally Posted by OzzyFrank View Post
    If someone could supply a command that removes the first 2 lines of all files with the .url extension, please post it here.
    Code:
    find ./ -iname "*.url" -exec tail --lines=$[ $(wc -l <{}) - 2 ] {} \;

  5. #5
    Join Date
    Jul 2008
    Location
    The Left Coast of the USA
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: What's Wrong with this Script to Open IE URLs in Firefox?

    Back to sleep.
    The Community Java Wiki * The Community ATI Driver Wiki * Find what you need in the Ubuntu Community wikis

    And seeing the terror on the faces of the people, QIII did speak to them, saying "Fear not the Terminal, for it is a road both swift and secure to the Great Mysteries of Linux without passing through the dangers of The Land of Ten Thousand Competing Desktop Environments."

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •