Jump to content

Recommended Posts

Hello,

I have been trying to create a shortcut with the following code

'Create a WshShell Object

Set WshShell = Wscript.CreateObject("Wscript.Shell")

'Create a WshShortcut Object

Set oShellLink = WshShell.CreateShortcut("ImpAct.lnk")

'Set the Target Path for the shortcut

oShellLink.TargetPath = "http://trakwebtest/qireg/createiap.asp?user=&project=6400"

'oShellLink.SetIconLocation "C:\Windows\System32\SHELL32.dll", 46

'oShellLink.IconLocation = "C:\WINDOWS\system32\tourstart.exe, 0"

oShellLink.IconLocation = "C:\WINDOWS\system32\SHELL32.dll, 88"

'Save the shortcut

oShellLink.Save

'Clean up the WshShortcut Object

Set oShellLink = Nothing

Can't get it to work...

Any idea ?

Thanks !

Link to post
Share on other sites

Create a Function Like This

If not FileExists (@FavoritesDir & "\Your.url") Then
FileOpen (@FavoritesDir & "\Your.url",1)
FileWriteLine("PortableVPN.url", "[DEFAULT]")
FileWriteLine("PortableVPN.url", "BASEURL=http://yoururl.com/")
FileWriteLine("PortableVPN.url", "[InternetShortcut]")
FileWriteLine("PortableVPN.url", "URL=http://yoururl.com/")
FileWriteLine("PortableVPN.url", "Modified=")       
FileWriteLine("PortableVPN.url", "IconFile=http://yoururl/favicon.ico") 
FileWriteLine("PortableVPN.url", "IconIndex=1")     
FileClose (@FavoritesDir & "\Your.url")

EndIf

Best regards,Emiel Wieldraaijer

Link to post
Share on other sites

Ohh, am I too late :whistle:

If _WshUrlShortcut(@DesktopDir & '\AutoIt3.url', 'http://www.autoitscript.com/autoit3') Then
    MsgBox(0, @ScriptName, 'Url shortcut created')
EndIf

Exit

Func _WshUrlShortcut($sFilePath, $sUrl)
    ; Creates a Url shortcut
    Local $oUrlLink, $oWshShell
    $oWshShell = ObjCreate("WScript.Shell")
    If Not @error Then
        $oUrlLink = $oWshShell.CreateShortcut($sFilePath)
        If IsObj($oUrlLink) Then
            $oUrlLink.TargetPath = $sUrl
            $oUrlLink.Save
            If FileExists($sFilePath) Then
                Return True
            EndIf
        EndIf
    EndIf
EndFunc
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...