|
|
|
Generic behavior to create a Shortcut
Added on 1/19/2002
|
This behavior allows to create a Shortcut at Startup, Start Menu, Programs Menu or Desktop
Download PC Source
-- Generic behavior to create a Shortcut at Startup, Start Menu, Programs Menu or Desktop
-- Desktop Xtra 1.0 or later required
-- Compatibilities: Director 6.x, 7.x, 8.x, Windows
property Location, AddInfo, ProgramName, Object, Icon, WrkDirectory
on getPropertyDescriptionList
set description = [:]
addProp description, #Location, [#default:"Startup", #format:#string, #comment:"Shortcut location:" & RETURN & "(Startup, StartMenu, Programs, Desktop)"]
addProp description, #AddInfo, [#default:"", #format:#string, #comment:"AddInfo, if Shortcut location = Programs" & RETURN & "(MyCompanyMyProgram...)"]
addProp description, #ProgramName, [#default:"MyProgramName", #format:#string, #comment:"Shortcut Name"]
addProp description, #Object, [#default:"C:Program FilesMyProgramMyProgram.exe", #format:#string, #comment:"Program Path"]
addProp description, #Icon, [#default:"C:Program FilesMyProgramicon.ico", #format:#string, #comment:"Icon Path"]
addProp description, #WrkDirectory, [#default:"C:Program FilesMyProgram", #format:#string, #comment:"Working Directory"]
return description
end
on getBehaviorDescription
return " " & ¬
"- - Generic Shortcut Behavior - -" & RETURN & ¬
"Creates shortcut at:" & RETURN & ¬
"- Startup group;" & RETURN & ¬
"- Start Menu;" & RETURN & ¬
"- Programs Menu;" & RETURN & ¬
"- Desktop."
end
on mouseDown
newShortcut
end
on newShortcut
set Shortcut = [Location, AddInfo, ProgramName]
set Ok = CreateShortcut(Shortcut)
if getAt(Ok, 1)=0 then
SetShortcutParameter(Shortcut, "Object", Object)
SetShortcutParameter(Shortcut, "Icon", Icon)
SetShortcutParameter(Shortcut, "WrkDirectory", WrkDirectory)
else
-- Error
alert("Error: " & getAt(Ok, 1) & " - base error code")
end if
end
|
|