Hi !I wonder if this is possible to create a shortcut to my HTA coded on same HTA ?The Problem is how can i get the full Name and the full path of my HTA that i can put it on my desktop ?
hackoo2011-03-15 08:36:28
How to create a shortcut to my HTA ?
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
How to create a shortcut to my HTA ?
No (^_^) I know this ! but I wonder with code ?
When running a HTA, we cannot use the default methods for accessing the WScript. like WScript.ScriptFullName for replacing this variable HTA_Name="SMTP-GMAIL.hta" in the code . this what i mean !
hackoo2011-03-15 09:04:48
When running a HTA, we cannot use the default methods for accessing the WScript. like WScript.ScriptFullName for replacing this variable HTA_Name="SMTP-GMAIL.hta" in the code . this what i mean !
Code: Select all
sub Shortcut
dim shell,DesktopPath,link,FSO
Set Shell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
CurrentFolder = shell.CurrentDirectory
MsgBox "This is The First Time for running this Application"&vbCrLf& "So We must Install a shorcut on your Desktop",48,"This is The First Time for running this Application"
MsgBox "The Current Directory is " & CurrentFolder,64,"Current Directory"
DesktopPath = Shell.SpecialFolders("Desktop")
Msgbox "The Target Directory is " & DesktopPath,64,"Target Directory"
HTA_Name="SMTP-GMAIL.hta"
Set link = Shell.CreateShortcut(DesktopPath & "SMTP GMAIL.lnk")
link.Description = "SMTP GMAIL"
link.IconLocation = CurrentFolder & "icon.ico"
link.TargetPath = CurrentFolder & "" & HTA_Name
link.WorkingDirectory = CurrentFolder
link.Save
MsgBox "The Shortcut is installed Sucsessfully ! !",64,"The Shortcut is installed Sucsessfully "
end sub
Sub window_onload()
Dim link,shell,FSO
Set Shell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
DesktopPath = Shell.SpecialFolders("Desktop")
link = DesktopPath & "SMTP GMAIL.lnk"
If FSO.FileExists(link) Then
CenterWindow 475, 620
Else
Call Shortcut
MsgBox "Close This window and Re-Run it From Your Desktop Shortcut" &vbCrLf& "THANK YOU !",48,"Close This window and Re-Run it"
End If
End Sub
Sub CenterWindow(x,y)
window.resizeTo x, y
iLeft = window.screen.availWidth/2 - x/2
itop = window.screen.availHeight/2 - y/2
window.moveTo ileft, itop
End Sub
How to create a shortcut to my HTA ?
Thank you very much ! This is what i need ! it's very Helpful !