程序快捷管理器1.0.5(附源码)
方便大多时候重装机又使用绿色软件的朋友看看,也帮着优化优化~本想整个图形添加与删除的功能但又多占了几M的内存因此一直没加。双击右键调出config.ini配置文件手动修改即可!
;**** 参数创建于 AutoIt3Wrapper_GUI ****#Region ;**** 参数创建于 AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=D:\My Documents\脚本制作园地\00开源制作\tools\newtools\版本发布\Sherlock.ico
#AutoIt3Wrapper_outfile=exeAutoRun.exe
#AutoIt3Wrapper_Res_Comment=程序快捷管理器
#AutoIt3Wrapper_Res_Description=程序快捷管理器
#AutoIt3Wrapper_Res_Fileversion=1.0.5
#AutoIt3Wrapper_Res_LegalCopyright=Jacky
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Include <Constants.au3>
#include <GUIConstants.au3>
#include <Process.au3>
#Include <Misc.au3>
If _Singleton(@ScriptName, 1) = 0 Then Exit
_RunDOS('path=' & @ScriptDir)
$count=100
$iniFile=@ScriptDir & "\" & "config.ini"
$iniLanguage=@ScriptDir & "\" & "Language.ini"
$regPath="HKCU\Software\Microsoft\Windows\CurrentVersion\Run"
Opt("TrayMenuMode", 1)
Opt("RunErrorsFatal", 0)
Global $menuCommand[$count]
Global $menu[$count]
Global $Command[$count]
Global $Language[4]
If FileExists($iniLanguage) Then
$SectionName=IniReadSectionNames($iniLanguage)
For $k=1 to $SectionName[0]
If $SectionName[$k]="Main" Then
$Languagenum=iniRead($iniLanguage,$SectionName[$k],"Language","")
LanguageChange($Languagenum)
Else
LanguageChange("Def")
EndIf
Next
Else
MsgBox(64,"Error",$iniLanguage & " No Find!")
Exit
EndIf
If FileExists($iniFile) Then
Dim $num=1
$SectionName=IniReadSectionNames($iniFile)
For $j=1 to $SectionName[0]
If $SectionName[$j]="DL100" Then
if $j <> 1 Then TrayCreateItem("")
$var=IniReadSection($iniFile,$SectionName[$j])
For $i=1 To $var[0][0]
$menuCommand[$num]=TrayCreateItem($var[$i][0])
$Command[$num]=$var[$i][1]
$num=$num+1
Next
if $j=1 Then TrayCreateItem("")
Else
$menu[$j]=TrayCreateMenu($SectionName[$j])
$var=IniReadSection($iniFile,$SectionName[$j])
For $i=1 To $var[0][0]
$menuCommand[$num]=TrayCreateItem($var[$i][0],$menu[$j])
$Command[$num]=$var[$i][1]
$num=$num+1
Next
EndIf
Next
TrayCreateItem("")
Else
MsgBox(64,$titleE,$iniFile & " " & $errorM02)
Exit
EndIf
$BootRun=TrayCreateItem($menuAutoRun)
ReadBootAutoStart()
$SetLanguage=TrayCreateMenu("Language")
$Language[1]=TrayCreateItem("Chinese(S)",$SetLanguage)
$Language[2]=TrayCreateItem("Chinese(T)",$SetLanguage)
$Language[3]=TrayCreateItem("English(E)",$SetLanguage)
TrayCreateItem("")
$exititem= TrayCreateItem($menuExit)
TraySetState()
TrayTip($titleS,$traytipMessage,5)
TrayItemSetState($Language[$Languagenum],$TRAY_CHECKED)
While 1
$msg=TrayGetMsg()
Select
Case $msg=$Language[1]
SetLanguage(1)
TrayItemSetState($Language[1],$TRAY_CHECKED)
TrayItemSetState($Language[2],$TRAY_UNCHECKED)
TrayItemSetState($Language[3],$TRAY_UNCHECKED)
Case $msg=$Language[2]
SetLanguage(2)
TrayItemSetState($Language[2],$TRAY_CHECKED)
TrayItemSetState($Language[1],$TRAY_UNCHECKED)
TrayItemSetState($Language[3],$TRAY_UNCHECKED)
Case $msg=$Language[3]
SetLanguage(3)
TrayItemSetState($Language[3],$TRAY_CHECKED)
TrayItemSetState($Language[2],$TRAY_UNCHECKED)
TrayItemSetState($Language[1],$TRAY_UNCHECKED)
Case $msg=$BootRun
SetBootAutoStart()
ReadBootAutoStart()
Case $msg=$TRAY_EVENT_PRIMARYDOUBLE
MsgBox(48,$titleA, @LF & "Copyright: DL100" & @LF & @LF & "Development: Jacky ")
Case $msg=$TRAY_EVENT_SECONDARYDOUBLE
run("notepad " & $iniFile)
Case $msg=$exititem
Exit
EndSelect
exeRun()
WEnd
Func exeRun()
For $i=1 To $num-1
Select
Case $msg=$menuCommand[$i]
if run($Command[$i]) Then
Else
MsgBox(64,$titleE,$Command[$i] & " " & $errorM01)
EndIf
EndSelect
Next
EndFunc
Func ReadBootAutoStart()
$regName=@ScriptName
$Aname = RegRead($regPath, $regName)
If $Aname = @ScriptFullPath Then
TrayItemSetState($bootRun,$TRAY_CHECKED)
TrayTip("",$traytipAutoRunE,5)
Else
TrayItemSetState($bootRun,$TRAY_UNCHECKED)
TrayTip("",$traytipAutoRunD,5)
EndIf
EndFunc
Func SetBootAutoStart()
$regName=@ScriptName
$Aname = RegRead($regPath, $regName)
If $Aname <> @ScriptFullPath Then
RegWrite($regPath, $regName, "REG_SZ", @ScriptFullPath)
Else
RegDelete($regPath, $regName)
EndIf
EndFunc
Func LanguageChange($yy)
If $yy="Def" then
Global $menuAutoRun="AutoRun"
Global $menuExit="Exit"
Global $titleS="Shortcuts"
Global $titleA="About"
Global $titleE="Error"
Global $errorM01=" No Find Or Run Error!"
Global $errorM02=" File No Find!"
Global $traytipAutoRunE="AutoRun State:Enbled"
Global $traytipAutoRunD="AutoRun State:Disabled"
Global $traytipMessage="I'm Here!"
Else
Global $SectionName=IniReadSectionNames($iniLanguage)
Global $menuAutoRun=IniRead($iniLanguage,$SectionName[$yy],"menuAutoRun","")
Global $menuExit=IniRead($iniLanguage,$SectionName[$yy],"menuExit","")
Global $titleS=IniRead($iniLanguage,$SectionName[$yy],"titleS","")
Global $titleA=IniRead($iniLanguage,$SectionName[$yy],"titleA","")
Global $titleE=IniRead($iniLanguage,$SectionName[$yy],"titleE","")
Global $errorM01=IniRead($iniLanguage,$SectionName[$yy],"errorM01","")
Global $errorM02=IniRead($iniLanguage,$SectionName[$yy],"errorM02","")
Global $traytipAutoRunE=IniRead($iniLanguage,$SectionName[$yy],"traytipAutoRunE","")
Global $traytipAutoRunD=IniRead($iniLanguage,$SectionName[$yy],"traytipAutoRunD","")
Global $traytipMessage=IniRead($iniLanguage,$SectionName[$yy],"traytipMessage","")
EndIf
EndFunc
Func SetLanguage($yy)
Global $SectionName=IniReadSectionNames($iniLanguage)
Global $menuAutoRun=IniRead($iniLanguage,$SectionName[$yy],"menuAutoRun","")
Global $menuExit=IniRead($iniLanguage,$SectionName[$yy],"menuExit","")
Global $titleS=IniRead($iniLanguage,$SectionName[$yy],"titleS","")
Global $titleA=IniRead($iniLanguage,$SectionName[$yy],"titleA","")
Global $titleE=IniRead($iniLanguage,$SectionName[$yy],"titleE","")
Global $errorM01=IniRead($iniLanguage,$SectionName[$yy],"errorM01","")
Global $errorM02=IniRead($iniLanguage,$SectionName[$yy],"errorM02","")
Global $traytipAutoRunE=IniRead($iniLanguage,$SectionName[$yy],"traytipAutoRunE","")
Global $traytipAutoRunD=IniRead($iniLanguage,$SectionName[$yy],"traytipAutoRunD","")
Global $traytipMessage=IniRead($iniLanguage,$SectionName[$yy],"traytipMessage","")
TrayItemSetText($BootRun,$menuAutoRun)
TrayItemSetText($exititem,$menuExit)
IniWrite($iniLanguage,"Main","Language",$yy)
EndFunc
posted on 2008-01-18 14:02
疾风随影 阅读(868)
评论(1) 编辑 收藏 引用 所属分类:
Script & Batch column