Jump to content

Problem with FileCreateShortcut() and certain urls


mike1950r
 Share

Go to solution Solved by mike1950r,

Recommended Posts

21 minutes ago, mike1950r said:

if i create a shortcut with an url example search of google, the shortcut is created with empty url.

Try this :

Local $sURL      = "https://www.google.com/search?q=Katja+Danowski&source=hp&ei=wsb7Y8CsIr2ckdUPoc6E4AI&iflsig=AK50M_UAAAAAY_vU0lweMHBJrgVX974GsDdTFbykQFg7&ved=0ahUKEwjAldnsiLT9AhU9TqQEHSEnASwQ4dUDCAc&uact=5&oq=Katja+Danowski&gs_lcp=Cgdnd3Mtd2l6EAMyBAguEEMyBQgAEIAEMgUIABCABDIFCAAQgAQyBQgAEIAEMgUIABCABDIFCC4QgAQyBQgAEIAEMgUIABCABDIFCAAQgARQAFgAYKQJaABwAHgAgAFNiAFNkgEBMZgBAKABAqABAQ&sclient=gws-wiz&ucbcb=1"
Local $sLinkname = "Google search URL.lnk"
FileCreateShortcut($sURL, @DesktopDir & "\" & $sLinkname)

 

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

Hi, thanks for the reply.

You mean I should use your methode for making a internet shortcut instead of using the function i used? would this be only for local files and yours for internet shortcuts?

Interesting, I'll try.

Is there also one for reading internet shortcut?

Cheers mike

Link to comment
Share on other sites

6 hours ago, mike1950r said:

Is there also one for reading internet shortcut?

with reading what you mine? I thing you mine execute

however if you  want read the data of Shortcut then, in Method 1 with FileGetShortcut() , and in Method 2 with FileReadLine()

;Method 1
Local $sURL = "https://www.google.com/search?q=Katja+Danowski"
Local $sLinkname = "Google search"

FileCreateShortcut($sURL, @ScriptDir & "\" & $sLinkname, "", "", "search for Katja Danowski", @SystemDir & "\shell32.dll", "", -23, @SW_MAXIMIZE)
;FileCreateShortcut ( "file", "lnk" [, "workdir" [, "args" [, "desc" [, "icon" [, "hotkey" [, icon number [, state]]]]]]] )

;Method 2
FileWriteLine(@ScriptDir & "\mike1950r in AutoIT.url", "[InternetShortcut]")
FileWriteLine(@ScriptDir & "\mike1950r in AutoIT.url", "URL=https://www.google.com/search?q=mike1950r%20site:www.autoitscript.com")
;~ FileWriteLine(@ScriptDir & "\mike1950r in AutoIT.url", "IconFile=C:\Windows\System32\SHELL32.dll")
;~ FileWriteLine(@ScriptDir & "\mike1950r in AutoIT.url", "IconIndex=14")

Sleep(5000)

;Is there also one for reading internet shortcut?
ShellExecute(@ScriptDir & "\" & $sLinkname)
ShellExecute(@ScriptDir & "\mike1950r in AutoIT.url")

PS
Informational
i think the empty url in the link it has to do with the ending .lnk that's why I omitted it.
At first when i run @Musashi script it gave me an empty url in the link also,
then I changed it to Google search URL.url  and it worked,
however when I checked it, I noticed that it added to the end the suffix .lnk to my shortcut Google search URL.url.lnk
after that it worked both with the .lnk extension and without extension

Edited by ioa747
corrections

I know that I know nothing

Link to comment
Share on other sites

I just read the link that @Danp2 suggested to you and I noticed that it uses method 2,
only that instead of FileWriteLine() it uses IniWrite()
which makes it even easier to manage the shortcut

Local $sLinkname = @ScriptDir & "\Google search2.url"

IniWrite($sLinkname, "InternetShortcut", "URL", "https://www.google.com/search?q=Katja+Danowski")
IniWrite($sLinkname, "InternetShortcut", "IconFile", "C:\Windows\System32\SHELL32.dll")
IniWrite($sLinkname, "InternetShortcut", "IconIndex", "17")

Local $sURL = IniRead($sLinkname, "InternetShortcut", "URL", "not found")
ConsoleWrite($sURL & @CRLF)

 

I know that I know nothing

Link to comment
Share on other sites

 

Hi again,

I'm very sorry, but whatever I try, I cannot get this working.
 

$sFilePath = $CSIDL_FAVORITES & "\Google Search.lnk"
$sWorkingDir = $CSIDL_FAVORITES
$sUrl = "https://www.google.com/search?q=Katja+Danowski&source=hp&ei=wsb7Y8CsIr2ckdUPoc6E4AI&iflsig=AK50M_UAAAAAY_vU0lweMHBJrgVX974GsDdTFbykQFg7&ved=0ahUKEwjAldnsiLT9AhU9TqQEHSEnASwQ4dUDCAc&uact=5&oq=Katja+Danowski&gs_lcp=Cgdnd3Mtd2l6EAMyBAguEEMyBQgAEIAEMgUIABCABDIFCAAQgAQyBQgAEIAEMgUIABCABDIFCC4QgAQyBQgAEIAEMgUIABCABDIFCAAQgARQAFgAYKQJaABwAHgAgAFNiAFNkgEBMZgBAKABAqABAQ&sclient=gws-wiz&ucbcb=1"

FileCreateShortcut($sUrl, $sFilePath, $sWorkingDir)

I always get an empty url in the created file.
And I always get as result 1 (success) although the url is empty.

cheers mike

😒

 

Link to comment
Share on other sites

have you try?

;Method 1
Local $sURL = "https://www.google.com/search?q=Katja+Danowski"
Local $sLinkname = "Google search"

FileCreateShortcut($sURL, @ScriptDir & "\" & $sLinkname, "", "", "search for Katja Danowski", @SystemDir & "\shell32.dll", "", -23, @SW_MAXIMIZE)
;FileCreateShortcut ( "file", "lnk" [, "workdir" [, "args" [, "desc" [, "icon" [, "hotkey" [, icon number [, state]]]]]]] )

 

Edited by ioa747

I know that I know nothing

Link to comment
Share on other sites

Hi ioa747,

your example works,

but not with my url:

$sUrl = "https://www.google.com/search?q=Katja+Danowski&source=hp&ei=wsb7Y8CsIr2ckdUPoc6E4AI&iflsig=AK50M_UAAAAAY_vU0lweMHBJrgVX974GsDdTFbykQFg7&ved=0ahUKEwjAldnsiLT9AhU9TqQEHSEnASwQ4dUDCAc&uact=5&oq=Katja+Danowski&gs_lcp=Cgdnd3Mtd2l6EAMyBAguEEMyBQgAEIAEMgUIABCABDIFCAAQgAQyBQgAEIAEMgUIABCABDIFCC4QgAQyBQgAEIAEMgUIABCABDIFCAAQgARQAFgAYKQJaABwAHgAgAFNiAFNkgEBMZgBAKABAqABAQ&sclient=gws-wiz&ucbcb=1"

This is what I mentioned above: certain urls do not work

cheers mike

 

Link to comment
Share on other sites

google search need only green part , the other is just info where did he come from

$sUrl = "https://www.google.com/search?q=Katja+Danowski&source=hp&ei=wsb7Y8CsIr2ckdUPoc6E4AI&iflsig=AK50M_UAAAAAY_vU0lweMHBJrgVX974GsDdTFbykQFg7&ved=0ahUKEwjAldnsiLT9AhU9TqQEHSEnASwQ4dUDCAc&uact=5&oq=Katja+Danowski&gs_lcp=Cgdnd3Mtd2l6EAMyBAguEEMyBQgAEIAEMgUIABCABDIFCAAQgAQyBQgAEIAEMgUIABCABDIFCC4QgAQyBQgAEIAEMgUIABCABDIFCAAQgARQAFgAYKQJaABwAHgAgAFNiAFNkgEBMZgBAKABAqABAQ&sclient=gws-wiz&ucbcb=1"

Edited by ioa747

I know that I know nothing

Link to comment
Share on other sites

however, this does not justify the empty url

try changing it

$sFilePath = $CSIDL_FAVORITES & "\Google Search.lnk"   to  $sFilePath = $CSIDL_FAVORITES & "\Google Search"

or to  $sFilePath = $CSIDL_FAVORITES & "\Google Search.url"

Edited by ioa747

I know that I know nothing

Link to comment
Share on other sites

1 hour ago, ioa747 said:

however, this does not justify the empty url

try changing it

$sFilePath = $CSIDL_FAVORITES & "\Google Search.lnk"   to  $sFilePath = $CSIDL_FAVORITES & "\Google Search"

or to  $sFilePath = $CSIDL_FAVORITES & "\Google Search.url"

I've tried but no success.
cheers mike

Link to comment
Share on other sites

1 hour ago, ioa747 said:

google search need only green part , the other is just info where did he come from

$sUrl = "https://www.google.com/search?q=Katja+Danowski&source=hp&ei=wsb7Y8CsIr2ckdUPoc6E4AI&iflsig=AK50M_UAAAAAY_vU0lweMHBJrgVX974GsDdTFbykQFg7&ved=0ahUKEwjAldnsiLT9AhU9TqQEHSEnASwQ4dUDCAc&uact=5&oq=Katja+Danowski&gs_lcp=Cgdnd3Mtd2l6EAMyBAguEEMyBQgAEIAEMgUIABCABDIFCAAQgAQyBQgAEIAEMgUIABCABDIFCC4QgAQyBQgAEIAEMgUIABCABDIFCAAQgARQAFgAYKQJaABwAHgAgAFNiAFNkgEBMZgBAKABAqABAQ&sclient=gws-wiz&ucbcb=1"

this is indeed interesting.
but how shall i verify and cutoff unneeded parts in the url?

Also, I have still no procedure to verify if the shortcut was written with success.
the create shortcut function always outputs 1 (success) even when there is no success.

When i use the function for getting shotcut, i can never find an entry of the url in the output array[0].
if it works or not the output in  array[0] is always empty.

this is really a nightmare.
cheers mike

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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