Jump to content

Problem with FileCreateShortcut() and certain urls


Go to solution Solved by mike1950r,

Recommended Posts

  • Solution
Posted (edited)

Sorry to everybody for my confusion.

Infact the methode creating an internet shortcut i used was completely wrong.

Nevertheless it worked for most urls.

Anyway it must be another procedure like this:

Func FileCreateInternetShortcut($sUrl, $sFileName, $sWorkingDir, $sIcon)
    Local $bSuccess, $iSec, $sIni

    $bSuccess = False

    $sWorkingDir = StringRegExpReplace($sWorkingDir, "\\+\z", "") & "\"

    If FileExists($sWorkingDir) Then
        $sFileName = StringReplace($sFileName, ".url", "") & ".url"

        $sIni = $sWorkingDir & $sFileName
        $iSec = "InternetShortcut"
        $sUrl = StringRegExpReplace($sUrl, "^.*?:/+", "")

        IniWrite($sIni, $iSec, "URL", $sURL)
        IniWrite($sIni, $iSec, "IDList", "")
        IniWrite($sIni, $iSec, "IconFile", $sIcon)
        IniWrite($sIni, $iSec, "IconIndex", "")

        $bSuccess = True
    EndIf

    Return $bSuccess
EndFunc   ;==>FileCreateInternetShortcut

This is not created by me, I just modified it for my use.
It creates another type of file not the same like FileCreateShortcut does.
It accepts all Urls and creates the internet shortcuts like Internet Explorer does.
The icon part is for those, who download the icon first from the internet sites, like me.

Anyway, I want to thank everybody for assisting me and leaving me stealing their time.

Thanks again.

Cheers mike

☺️

Edited by mike1950r
  • 2 years later...
Posted

Hi again,

sorry to jump in another time so lately.

There keeps one problem.

All "https" are written as "http".

Cannot find a way to get that working.

Thanks for assistance.

Cheers mike

Posted

Ok, reverse engineering time !

I took a browser link, dragged it to an editor and this is what I saw:

[InternetShortcut]
URL=https://www.youtube.com/watch?v=5aWWjNwpDDc

in a file named "How to get a lot of money and pay my bills.url"

Ok, so I guess:
IniWrite("How to get a lot of money and pay my bills.url", "InternetShortcut", "URL", "https://www.youtube.com/watch?v=5aWWjNwpDDc")
would recreate that link.

I didn't read much but am guessing that this is all you need. Unless I got the question wrong.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
35 minutes ago, argumentum said:

Ok, reverse engineering time !

I took a browser link, dragged it to an editor and this is what I saw:

[InternetShortcut]
URL=https://www.youtube.com/watch?v=5aWWjNwpDDc

in a file named "How to get a lot of money and pay my bills.url"

Ok, so I guess:
IniWrite("How to get a lot of money and pay my bills.url", "InternetShortcut", "URL", "https://www.youtube.com/watch?v=5aWWjNwpDDc")
would recreate that link.

I didn't read much but am guessing that this is all you need. Unless I got the question wrong.

thanks argumentum,

i found the problem.

I should not use:

$sUrl = StringRegExpReplace($sUrl, "^.*?:/+", "")

before writing the ini file.

Cheers mike

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...