$var = StringSplit(RegRead("HKEY_CLASSES_ROOT\au3_auto_file\shell\open\command", ""), '"', 1)
If $var[2] = 0 Then
ShellExecute($var[2])
Else ;下面的都需要先操作一部分代码,所以不适合用 ElseIf。当然这里要用也行,方式2
$var2 = IniRead("manager.ini", "SCITE", "START", "")
If FileExists($var2) Then
ShellExecute($var2)
Else
Local $message = "打开SCITE..."
Local $var3 = FileOpenDialog($message, "", "应用程序 (*.exe)", 1)
If @error Then
MsgBox(4096, "", "放弃打开SCITE!")
Else
IniWrite(@ScriptDir & "\manager.ini", "SCITE", "START", $var3)
;Ini函数在处理相对路径时会加上@WorkingDir,所以最好不要使用相对路径
ShellExecute($var3)
EndIf
EndIf
EndIf
;===================方式2
$var = StringSplit(RegRead("HKEY_CLASSES_ROOT\au3_auto_file\shell\open\command", ""), '"', 1)
If $var[2] = 0 Then
ShellExecute($var[2])
ElseIf FileExists(IniRead("manager.ini", "SCITE", "START", "")) Then
ShellExecute($var2)
Else
Local $message = "打开SCITE..."
Local $var3 = FileOpenDialog($message, "", "应用程序 (*.exe)", 1)
If Not @error Then
IniWrite(@ScriptDir & "\manager.ini", "SCITE", "START", $var3)
ShellExecute($var3)
EndIf
EndIf
|