Zoroxeus Posted November 8, 2006 Posted November 8, 2006 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 !
Zoroxeus Posted November 8, 2006 Author Posted November 8, 2006 FileCreateShortcut ?Thanks, but I am trying to create an web address shortuct (bookmark)Wich file would i have to use ?
Emiel Wieldraaijer Posted November 11, 2006 Posted November 11, 2006 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
Helge Posted November 11, 2006 Posted November 11, 2006 (edited) Or just use INIWrite. Edited December 13, 2006 by Helge
Zoroxeus Posted November 13, 2006 Author Posted November 13, 2006 Or just use INIWrite.Thanks I got this one, a bit of a different way
MHz Posted November 13, 2006 Posted November 13, 2006 Ohh, am I too late 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
Zoroxeus Posted November 16, 2006 Author Posted November 16, 2006 Thanks for all the different version guys Great alternatives !
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