Es öffnet bei Doppelklick auf eine Textdatei einen Dialog, durch den die Datei, je nachdem welcher Button geklickt wird, entweder mit Notepad oder mit Wordpad geöffnet wird.
Das Script muss in eine Datei TextEditorChoice.vbs gespeichert und in den Ordner /dopusdata\Script AddIns kopiert werden
TextEditorChoice.vbs (Script-AddIn v1.0, VB-Script-Version)
Code: Alles auswählen
' TextEditorChoice
'
'
' This is a script for Directory Opus.
' See http://www.gpsoft.com.au/redirect.asp?page=scripts for development information.
'
'
'
' Called by Directory Opus to initialize the script
Function OnInit(initData)
initData.name = "TextEditorChoice"
initData.desc = "Textdatei mit Notepad oder WordPad Öffnen"
initData.copyright = "(c) 2014 Kundal"
initData.version = "v1.0"
initData.default_enable = true
End Function
' Called when a file or folder is double-clicked
Function OnDoubleClick(doubleClickData)
If doubleClickData.item.ext = ".txt" Then
OnDoubleClick = true ' Prevent the standard double-click action.
Set filename = doubleClickData.item
Set dlg = DOpus.Dlg
dlg.window = DOpus.Listers(0)
dlg.message = "Mit Notepad oder WordPad öffnen"
dlg.title = "Editor wählen"
dlg.buttons = "Notepad|WordPad|Abbrechen"
i = dlg.show
If i = 1 then
DOpus.NewCommand.RunCommand("notepad.exe ") & """" & filename & """"
Elseif i = 2 then
DOpus.NewCommand.RunCommand ("/programfiles\Windows NT\Accessories\wordpad.exe ") & """" & filename & """"
else
End If
End If
End Function