Windows verknüpfung erzeugen

Programmierung unter AOO/LO (StarBasic, Python, Java, ...)

Moderator: Moderatoren

Mobbi
**
Beiträge: 23
Registriert: Do, 11.12.2008 21:52

Windows verknüpfung erzeugen

Beitrag von Mobbi »

Hallo alle zusammen!

Ich bin beim Programmieren auf ein kleines Problem gestoßen und kann es leider nicht selbst in OOO lösen:

Ich möchte mit einem Makro eine Windowsverknüpfung erzeugen. Diese soll dann in einem bestimmten Sammelordner liegen.
Der Zweck dahinter besteht darin, in verschiedenen Projekten erstellte Versandlisten mit einer Verknüpfung für die Dispositio zugänglich zu machen, ohne das diese in jedes Projekt hinein müssen.
Das Verschieben der Verknüpfungen per Makro ist auch kein Problem.
Ich hab zwar eine Lösung über eine VB-Script im Netz gefunden und diese funktioniert auch:

Code: Alles auswählen

' This code creates a shortcut.
set objWSHShell = CreateObject("WScript.Shell")
' Pass the path to the shortcut
set objSC = objWSHShell.CreateShortcut("d:\mylog.lnk") 
' Description - Description of the shortcut
objSC.Description = "Shortcut to MyLog file"
' HotKey � hot key sequence to launch the shortcut
objSC.HotKey = "CTRL+ALT+SHIFT+X"
' IconLocation � Path of icon to use for the shortcut file
objSC.IconLocation = "notepad.exe, 0"  ' 0 is the index
' TargetPath = Path to source file or folder
objSC.TargetPath = "c:\windows\notepad.exe"
' Arguments � Any additional parameters to pass to TargetPath
objSC.Arguments = "c:\mylog.txt"
' WindowStyle � Type of window to create
objSC.WindowStyle = 1   ' 1 = normal; 3 = maximize window; 7 = minimize
' WorkingDirectory � Location of the working directory for the source app
objSC.WorkingDirectory = "c:\"
objSC.Save
WScript.Echo "Shortcut to mylog created"
[/code]
Diese ist aber nicht befriedigend.
Ich wollte wenn möglich alles im OOO lösen