mike1950r Posted February 26, 2023 Share Posted February 26, 2023 Hi, if i create a shortcut with an url example search of google, the shortcut is created with empty url. URL: Google search URL Thanks for assistance. Cheers mike Link to comment Share on other sites More sharing options...
mike1950r Posted February 26, 2023 Author Share Posted February 26, 2023 Forgot to say, that I get not zero as result. (say no error) cheers mike Link to comment Share on other sites More sharing options...
Musashi Posted February 26, 2023 Share Posted February 26, 2023 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) "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 More sharing options...
mike1950r Posted February 26, 2023 Author Share Posted February 26, 2023 Hi, thanks for the answer. It's just like I also did. And the result is an empty url in the link. cheers mike Link to comment Share on other sites More sharing options...
Danp2 Posted February 26, 2023 Share Posted February 26, 2023 The method described below still appears to work -- ioa747 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
mike1950r Posted February 27, 2023 Author Share Posted February 27, 2023 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 More sharing options...
ioa747 Posted February 27, 2023 Share Posted February 27, 2023 (edited) 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") PSInformational 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 February 27, 2023 by ioa747 corrections I know that I know nothing Link to comment Share on other sites More sharing options...
ioa747 Posted February 27, 2023 Share Posted February 27, 2023 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 More sharing options...
mike1950r Posted February 27, 2023 Author Share Posted February 27, 2023 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 More sharing options...
ioa747 Posted February 27, 2023 Share Posted February 27, 2023 (edited) 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 February 27, 2023 by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
mike1950r Posted February 27, 2023 Author Share Posted February 27, 2023 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 More sharing options...
ioa747 Posted February 27, 2023 Share Posted February 27, 2023 (edited) 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 February 27, 2023 by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
ioa747 Posted February 27, 2023 Share Posted February 27, 2023 (edited) 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 February 27, 2023 by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
Danp2 Posted February 27, 2023 Share Posted February 27, 2023 Have you tried encoding the URL prior to calling FileCreateShortcut? That will likely resolve the issue. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
mike1950r Posted February 27, 2023 Author Share Posted February 27, 2023 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 More sharing options...
mike1950r Posted February 27, 2023 Author Share Posted February 27, 2023 51 minutes ago, Danp2 said: Have you tried encoding the URL prior to calling FileCreateShortcut? That will likely resolve the issue. I also tried this, also no success. cheers mike Link to comment Share on other sites More sharing options...
mike1950r Posted February 27, 2023 Author Share Posted February 27, 2023 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 More sharing options...
ioa747 Posted February 27, 2023 Share Posted February 27, 2023 https://www.google.com/search?q={searchTerms} for the others i don't know, but it doesn't change with the full url I know that I know nothing Link to comment Share on other sites More sharing options...
mike1950r Posted February 27, 2023 Author Share Posted February 27, 2023 Hi, FileGetShortcut works fine with local files. But it does not work with link files which include an internet url as target. How can i retrieve the internet url in a .lnk file? thanks for assistance cheers mike Link to comment Share on other sites More sharing options...
ioa747 Posted February 27, 2023 Share Posted February 27, 2023 (edited) Edited February 27, 2023 by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now