Ja klar, mit ShellExecute / ShellExecuteWait wird das mit der Datei verknüpfte Programm gestartet.
Ich habs mal hier als Bsp. für einen Simple Explorer gemacht.
Die ComboBox habe ich hier rausgelassen, hier kannst du dich mit Doppelklick bewegen, ist einfacher.
Weitere Optionen über Kontextmenü (Ausführen bei Ordner öffnet diesen im Explorer/ Kopieren/ Einfügen/ Umbenennen/ Löschen).
Außerdem findest du eine Variable $Safed - dort sind die Attribute hinterlegt, für Dateien, die für: Ausführen, Umbenennen, Löschen gesperrt sind.
Simple Explorer
#include <GuiListBox.au3>
#include <File.au3>
Global $aFile, $aFolder, $aPath[1] = [@HomeDrive & '\'], $currPath, $sUp = '[ EBENE HÖHER ]'
Global $Safed = '[SHOC]' ; mit diesen Attributen gesperrt für: Ausführen, Umbenennen, Löschen
$GUI = GUICreate("Simple Explorer",400,300)
$label = GUICtrlCreateLabel('', 5, 5, 390, 53)
$List = GUICtrlCreateList( '', 2, 65, 396, 230, BitOR($WS_HSCROLL, $WS_VSCROLL, $WS_BORDER))
$hList = GUICtrlGetHandle($List)
$menu = GUICtrlCreateContextMenu($List)
$itemRun = GUICtrlCreateMenuItem('Ausführen', $menu)
$itemShape = GUICtrlCreateMenuItem('', $menu)
$itemCopy = GUICtrlCreateMenuItem('Kopieren', $menu)
$itemPaste = GUICtrlCreateMenuItem('Einfügen', $menu)
GUICtrlSetState(-1, $GUI_DISABLE)
$itemRen = GUICtrlCreateMenuItem('Umbenennen', $menu)
$itemShape = GUICtrlCreateMenuItem('', $menu)
$itemDel = GUICtrlCreateMenuItem('Löschen', $menu)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
[/autoit] [autoit][/autoit] [autoit]_WriteList($aPath[0])
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $itemRun
_RunFile()
Case $itemCopy
_CopyFile()
Case $itemPaste
_PasteFile()
Case $itemRen
_RenFile()
Case $itemDel
_DelFile()
EndSwitch
Wend
Func _WriteList($PATH)
_GUICtrlListBox_ResetContent($hList) ; alte Inhalte löschen
$aFolder = _FileListToArray($PATH, '*', 2)
$aFile = _FileListToArray($PATH, '*', 1)
If UBound($aPath) > 1 Then _GUICtrlListBox_AddString($hList, $sUp)
If IsArray($aFolder) Then
_GUICtrlListBox_AddString($hList, '--------------- ORDNER ---------------')
For $i = 1 To UBound($aFolder) -1
_GUICtrlListBox_AddString($hList, $aFolder[$i])
Next
EndIf
If IsArray($aFile) Then
_GUICtrlListBox_AddString($hList, '--------------- DATEIEN ---------------')
For $i = 1 To UBound($aFile) -1
_GUICtrlListBox_AddString($hList, $aFile[$i])
Next
EndIf
GUICtrlSetData($label, $PATH)
EndFunc
Func _ListDblClick()
Local $str = _GUICtrlListBox_GetText($hList, _GUICtrlListBox_GetCurSel($hList))
Local $tmpPath = ''
If $str = $sUp Then
ReDim $aPath[UBound($aPath)-1]
$currPath = $aPath[UBound($aPath)-1]
Else
$currPath = $aPath[UBound($aPath)-1] & $str & '\' ; neuer Pfad = letzter Pfad + geklickter Pfad
If Not StringRegExp(FileGetAttrib($currPath), 'D') Then _RunFile() ; ist es kein Ordner ?
ReDim $aPath[UBound($aPath)+1]
$aPath[UBound($aPath)-1] = $currPath ; neuen Pfad hinzufügen
EndIf
_WriteList($currPath)
EndFunc
Func _RunFile()
Local $str = _GUICtrlListBox_GetText($hList, _GUICtrlListBox_GetCurSel($hList))
If $str = '' Then Return
Local $attrib = FileGetAttrib($aPath[UBound($aPath)-1] & $str)
If StringRegExp($attrib, $Safed) Then Return MsgBox(0, 'Geschützt!', $str & ' - Attribut: ' & $attrib)
ShellExecuteWait($aPath[UBound($aPath)-1] & $str)
EndFunc
Func _CopyFile()
Local $str = _GUICtrlListBox_GetText($hList, _GUICtrlListBox_GetCurSel($hList))
If $str = '' Then Return
Local $attrib = FileGetAttrib($aPath[UBound($aPath)-1] & $str)
If StringRegExp($attrib, 'D') Then Return MsgBox(0, 'Achtung', $str & ' ist keine Datei')
ClipPut($aPath[UBound($aPath)-1] & $str)
GUICtrlSetState($itemPaste, $GUI_ENABLE)
EndFunc
Func _PasteFile()
Local $str = _GUICtrlListBox_GetText($hList, _GUICtrlListBox_GetCurSel($hList))
If $str = '' Then Return
Local $attrib = FileGetAttrib($aPath[UBound($aPath)-1] & $str)
If Not StringRegExp($attrib, 'D') Then Return MsgBox(0, 'Achtung', $str & ' - ist kein Ordner')
Local $tmp = ClipGet(), $pos = StringInStr($tmp, '\', -1)
Local $file = StringRight($tmp, StringLen($tmp)-$pos)
If FileExists($aPath[UBound($aPath)-1] & $str & '\' & $file) Then $file = 'Kopie von ' & $file
FileCopy($tmp, $aPath[UBound($aPath)-1] & $str & '\' & $file)
_WriteList($aPath[UBound($aPath)-1])
GUICtrlSetState($itemPaste, $GUI_DISABLE)
EndFunc
Func _RenFile()
Local $str = _GUICtrlListBox_GetText($hList, _GUICtrlListBox_GetCurSel($hList))
If $str = '' Then Return
Local $attrib = FileGetAttrib($aPath[UBound($aPath)-1] & $str)
If StringRegExp($attrib, $Safed) Then Return MsgBox(0, 'Geschützt!', $str & ' - Attribut: ' & $attrib)
Local $tmp = InputBox('Umbenennen', 'Neuer Name:' & @LF & @LF & $aPath[UBound($aPath)-1], $str)
If $tmp <> '' Then FileMove($aPath[UBound($aPath)-1] & $str, $aPath[UBound($aPath)-1] & $tmp)
_WriteList($aPath[UBound($aPath)-1])
EndFunc
Func _DelFile()
Local $str = _GUICtrlListBox_GetText($hList, _GUICtrlListBox_GetCurSel($hList))
If $str = '' Then Return
Local $attrib = FileGetAttrib($aPath[UBound($aPath)-1] & $str)
If StringRegExp($attrib, $Safed) Then Return MsgBox(0, 'Geschützt!', $str & ' - Attribut: ' & $attrib)
FileDelete($aPath[UBound($aPath)-1] & $str)
_WriteList($aPath[UBound($aPath)-1])
EndFunc
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox
If Not IsHWnd($hList) Then $hWndListBox = GUICtrlGetHandle($hList)
$hWndFrom = $ilParam
$iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
$iCode = BitShift($iwParam, 16) ; Hi Word
Switch $hWndFrom
Case $hList, $hWndListBox
Switch $iCode
Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box
_ListDblClick()
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND