;添加主窗体右键事件
2GuiContextMenu:	;{主窗体：鼠标右键
    If !robot
        Return
    menu,Menu_Robot,Add 
	menu,Menu_Robot,DeleteAll
    menu,Menu_Robot,Add,robot,Robotmenu
    menu,Menu_Robot,Add 
    Menu,Menu_Robot, Disable, robot
    menu,KyMenu_New,Add 
	menu,KyMenu_New,DeleteAll
	global RulesMode
	global DefaultMode
	loop,% RulesMode.Length()
	{
		TemItem:=RulesMode[A_Index]
		Menu, KyMenu_New, add, %TemItem%,MenuHandle_Checked
	}
	Menu, KyMenu_New, add ; 分隔符
	Menu, KyMenu_New, add, 打开目标文件夹,Label_OpenSingleDir
	loop,% RulesArray.MaxIndex()
	{
		aObj:=RulesArray[A_index]
		Mode_Name:=aObj.name
		if (Mode_Name!=DefaultMode)
			continue
		Mode_Item:=aObj.Rules
		loop,% Mode_Item.MaxIndex()
		{
			bObj:=Mode_Item[A_Index]
			Item_Target:=bObj[4]
			Menu, KyMenu_Sub, add, %Item_Target%,Label_OpenSingleDir
		}
	}
	Menu, KyMenu_New, add, 打开目标文件夹,:KyMenu_Sub

	Menu, KyMenu_New, add ; 分隔符
	Menu, KyMenu_New, check, %DefaultMode%
    
    
    menu,KyMenu_autoit,Add 
	menu,KyMenu_autoit,DeleteAll
    mobj:={}
    
    loop,parse,% YzIni.GetKeys("autoit"),`n
	{
        mObj:=StrSplit(YzIni.autoit[A_LoopField],"|")
        Menu, KyMenu_autoit, add, %A_LoopField%,Label_autoit
        Menu,KyMenu_autoitSub,Add,% mObj[1],Label_OpenSingleDir
    }
    Menu, KyMenu_autoit, add ; 分隔符
    Menu, KyMenu_autoit, add, 打开源文件夹,:KyMenu_autoitSub
    menu,Menu_Robot,Add,dropit,:KyMenu_New
    menu,Menu_Robot,Add,autoit,:KyMenu_autoit
    Menu, Menu_Robot, add ; 分隔符
	Menu, Menu_Robot, add, &E 管理模式,Label_DrawGUI_ManagerRules
    Menu, Menu_Robot, add ; 分隔符
    menu,Menu_Robot,Add,&A 整理规则,Label_autoit_GUI
	menu,Menu_Robot,show
return

Label_autoit:
    FileList:=""
	try
    {
        aObj:=StrSplit(YzIni.autoit[A_ThisMenuItem],"|")
        Loop,Files,% aObj[1] . "\*.*" ,DF
        {
            ActionFunc(A_LoopFilePath,aObj[2])
        }       
    }
		
Return

Label_autoit_GUI:
;【一键整理窗体】-------------------------------------------------------------
	
	Gui AutoItManager:Destroy
	Gui AutoItManager:+HwndAutoItManager_Hwnd
	Gui AutoItManager:Add, ListView, x5 y5 w470 h235 , 名称|源目录|模式
	Gui AutoitManager:Add,  Groupbox, x5 y250 w240 h55,模式
	Gui AutoitManager:Add, button , x15 y272 w150 gManager_modes, &G 模式管理
	Gui AutoItManager:Add,  Groupbox, x250 y250 w220 h55,规则
	Gui AutoItManager:Add, Button, x260 y270 w55 h23 gAutoItManager_Add, &A 添加
	Gui AutoItManager:Add, Button, x330 y270 w55 h23 gAutoItManager_Modify, &M 修改
	Gui AutoItManager:Add, Button, x400 y270 w55 h23 gAutoItManager_Del, &D 删除
	Gui AutoItManager:Add, Text, x10 y318 , 【特别说明】：在更改模式选择列表前，如有修改均要【保存】！
	Gui AutoItManager:Add, Button, x400 y310 w55 h30 gAutoItManager_OK, &K 保存
	Gui AutoItManager:Show, w480 h345, 整理规则
	Gui AutoItManager:Default
	LV_ModifyCol(1, 100)  
	LV_ModifyCol(2, 200)  
	LV_ModifyCol(4, 200)  
	gosub,AutoItManager_ChangeMode
Return
Manager_modes:
    Gui AutoItManager:Destroy
    Gosub,Label_DrawGUI_ManagerRules
Return
AutoItManager_Add:
	CurRow:=""
    S_Name:=""
	Autoit_Source:=""
	gosub,Label_DrawGUI_CreatAutoit
Return
AutoItManager_Modify:
	Gui AutoitManager:Default
	FocusedRowNumber := LV_GetNext(0, "F")  ; 查找焦点行
	CurRow:=FocusedRowNumber
	LV_GetText(S_Name, FocusedRowNumber ,1)
	LV_GetText(Autoit_Source, FocusedRowNumber ,2)
	LV_GetText(R_mode, FocusedRowNumber ,3)
	gosub,Label_DrawGUI_CreatAutoit
Return
AutoItManager_Del:
	CurRow:=""
	Gui AutoitManager:Default
	FocusedRowNumber := LV_GetNext(0, "F")  ; 查找焦点行
	LV_Delete(FocusedRowNumber)
Return
AutoItManager_OK:
    Gui AutoitManager:Default
	GuiControlGet,R_Mode,,R_Mode
    YzIni.DeleteSection("autoit")
	Loop % LV_GetCount()
	{  
		LV_GetText(S_Name, A_Index ,1)
		LV_GetText(Autoit_Source, A_Index ,2)
		LV_GetText(R_mode, A_Index ,3)
		YzIni.autoit[S_Name]:=Autoit_Source . "|" . R_mode
	} 
    YzIni.save()
	;YzIni:=class_EasyIni("yz.ini")
	MsgBox, 64, 提示, 保存成功
    ;Gui AutoitManager:Destroy
Return

AutoItManager_ChangeMode:
	Gui AutoitManager:Default
	LV_Delete()
    ;MsgBox,% YzIni.GetKeys("autoit")
     loop,parse,% YzIni.GetKeys("autoit"),`n
	{
        aObj:=StrSplit(YzIni.autoit[A_LoopField],"|")
        LV_Add("",A_LoopField,aObj[1],aObj[2])
	}
Return

Robotmenu:
Return
;【主窗体】--------------------------------------------------------------------
Label_DrawGUI_Main:	;{主窗体：文件拖动窗体
	;Gui main:+AlwaysOnTop -Caption +E0x00000080	;+E0x00000080  不在任务栏显示
	;Gui main:Add, Picture, x0 y0 w40 h40 , %A_ScriptDir%\ICON\BookStone.bmp
	;~ WinSet, transColor, TransColor 150
	;~ gui color,00FF00
	;Gui 2:Show
	;OnMessage(0x201, "WM_LBUTTONDOWN")		;左键按下 WM_LBUTTONDOWN
	;OnMessage(0x203, "WM_LBUTTONDBLCLK")		;左键双击 WM_LBUTTONDBLCLK
Return
MenuHandle_Checked:
	DefaultMode:=A_thismenuitem
	IniWrite,%DefaultMode%,%INI%,设置,默认模式
	RulesArray:=ReadINIToArray(INI)
return
2GuiDropFiles:	;{主窗体：拖动文件到主窗体
    If !robot
        Return
	;如果有参数传入，则直接处理，否则弹出窗体
	if 0 > 0
	{
		MySel=%1%
		MyMode=%2%
		MySel:=StrReplace(MySel,";","`n")
	}
    else 
    {
		MySel=%A_GuiEvent%
		MyMode=%DefaultMode%
	}
    ;msgbox % MySel
	;无处理模式，使用默认模式
	ActionFunc(MySel,MyMode)
	if 0 > 0
	{
		ExitApp
	}
    else 
    {      
		Gui,2:Show
        Sleep,500
        TrayTip, , 整理完毕, 5, 17
	}	
return
Label_OpenSingleDir:
	try
		run,%A_ThisMenuItem%
return
ActionFunc(MySel,MyMode)
{
    if (MyMode="")
		MyMode:=DefaultMode
	Loop,parse,MySel,`n,`r
	{
		if (A_LoopField="")
			continue
		If InStr(FileExist(A_LoopField), "D") { ;区分是否文件夹,Attrib= D ,则是文件夹
			MyOutNameNoExt:=substr(A_LoopField,instr(A_LoopField,"\",,0,1)+1)
			;~ msgbox % MyOutNameNoExt
			loop,% RulesArray.MaxIndex()
			{
				aObj:=RulesArray[A_index]
				Mode_Name:=aObj.name
				if (Mode_Name!=MyMode)
					continue
				Mode_Item:=aObj.Rules
				loop,% Mode_Item.MaxIndex()
				{
					bObj:=Mode_Item[A_Index]
					Item_Name:=bObj[1]
					Item_Rules:=bObj[2]
					Item_Action:=bObj[3]
					Item_Target:=bObj[4]
					;处理规则
					if(instr(Item_Rules,".")>0)
						continue
					TemStr:=StrReplace(Item_Rules,"*","")
                    
					if(substr(Item_Rules,0)="*" and substr(Item_Rules,1,1)!="*")	{
						;【2】匹配文件名；以abc*开头
						if(instr(MyOutNameNoExt,TemStr)=1 ){
							ifnotexist,%Item_Target%
								FileCreateDir,%Item_Target%
							if(Item_Action="复制"){
								FileCopyDir,%A_LoopField%,%Item_Target%\%MyOutNameNoExt%
							} else if (Item_Action="移动") {
								FileMoveDir,%A_LoopField%,%Item_Target%\%MyOutNameNoExt%
							} else {
								
							}

						}
					}else if (substr(Item_Rules,1,1)="*" and substr(Item_Rules,0)!="*")	{
						;【3】匹配文件名；以*abc结尾
						if(instr(MyOutNameNoExt,TemStr)=strlen(MyOutNameNoExt)-strlen(TemStr)+1){
							ifnotexist,%Item_Target%
								FileCreateDir,%Item_Target%
							if(Item_Action="复制"){
								FileCopyDir,%A_LoopField%,%Item_Target%\%MyOutNameNoExt%
							} else if (Item_Action="移动") {
								FileMoveDir,%A_LoopField%,%Item_Target%\%MyOutNameNoExt%
							} else {
								
							}
						}
					}else if (substr(Item_Rules,0)="*" and substr(Item_Rules,1,1)="*")	{
						;【4】匹配文件名；包*abc*含
						if(instr(MyOutNameNoExt,TemStr)>=1 ){
							ifnotexist,%Item_Target%
								FileCreateDir,%Item_Target%
							if(Item_Action="复制"){
								FileCopyDir,%A_LoopField%,%Item_Target%\%MyOutNameNoExt%
							} else if (Item_Action="移动") {
								FileMoveDir,%A_LoopField%,%Item_Target%\%MyOutNameNoExt%
							} else {
								
							}
						}
					}else{
						
					}
				}
			}
		} else {
			SplitPath,A_LoopField,MyOutFileName,MyOutDir,MyOutExt,MyOutNameNoExt,MyOutDrive
			loop,% RulesArray.MaxIndex()
			{
				aObj:=RulesArray[A_index]
				Mode_Name:=aObj.name
				if (Mode_Name!=MyMode)
					continue
				Mode_Item:=aObj.Rules
				loop,% Mode_Item.MaxIndex()
				{
					bObj:=Mode_Item[A_Index]
					Item_Name:=bObj[1]
					Item_Rules:=bObj[2]
					Item_Action:=bObj[3]
					Item_Target:=bObj[4]
					
					;处理规则
					if(instr(Item_Rules,".")>0){	
						;【1】匹配后缀名
						if(instr(Item_Rules,MyOutExt)>0){
							ifnotexist,%Item_Target%
								FileCreateDir,%Item_Target%
							if(Item_Action="复制"){
								filecopy,%A_LoopField%,%Item_Target%
							} else if (Item_Action="移动") {
								filemove,%A_LoopField%,%Item_Target%
							} else {
								
							}
						}
					} else {
						TemStr:=StrReplace(Item_Rules,"*","")
						if(substr(Item_Rules,0)="*" and substr(Item_Rules,1,1)!="*")	{
							;【2】匹配文件名；以abc*开头
							if(instr(MyOutNameNoExt,TemStr)=1 ){
								ifnotexist,%Item_Target%
									FileCreateDir,%Item_Target%
								if(Item_Action="复制"){
									filecopy,%A_LoopField%,%Item_Target%
								} else if (Item_Action="移动") {
									filemove,%A_LoopField%,%Item_Target%
								} else {
									
								}
							}
						}else if (substr(Item_Rules,1,1)="*" and substr(Item_Rules,0)!="*")	{
							;【3】匹配文件名；以*abc结尾
							if(instr(MyOutNameNoExt,TemStr)=strlen(MyOutNameNoExt)-strlen(TemStr)+1){
								ifnotexist,%Item_Target%
									FileCreateDir,%Item_Target%
								if(Item_Action="复制"){
									filecopy,%A_LoopField%,%Item_Target%
								} else if (Item_Action="移动") {
									filemove,%A_LoopField%,%Item_Target%
								} else {
									
								}
							}
						}else if (substr(Item_Rules,0)="*" and substr(Item_Rules,1,1)="*")	{
							;【4】匹配文件名；包*abc*含
							if(instr(MyOutNameNoExt,TemStr)>=1 ){
								ifnotexist,%Item_Target%
									FileCreateDir,%Item_Target%
								if(Item_Action="复制"){
									filecopy,%A_LoopField%,%Item_Target%
								} else if (Item_Action="移动") {
									filemove,%A_LoopField%,%Item_Target%
								} else {
									
								}
							}
						}
                        else
                        {
							
						}
					}
				}
			}
            ;MsgBox,% Item_Target
		}
	}
}

;【规则管理窗体】-------------------------------------------------------------
Label_DrawGUI_ManagerRules:	;{规则管理窗体：绘制
	loop,% RulesMode.Length()
	{
		if (A_Index=1)
			R_Mode:=RulesMode[1] 
		else
			R_Mode:=R_Mode . "|" . RulesMode[A_Index]
	}
	;~ msgbox % R_Mode
	;Gui 2:Hide
	Gui Manager:Destroy
	Gui Manager:+HwndManager_Hwnd
	Gui Manager:Add, ListView, x5 y5 w470 h235 , 名称|规则|操作|目标
	
	Gui Manager:Add,  Groupbox, x5 y250 w240 h55,模式
	Gui Manager:Add, DropDownList , x15 y272 w150 vR_Mode gManager_ChangeMode ,%R_Mode%
	Gui Manager:Add, Button, x175 y270 w55 h23 gManager_New, &N 新建
	Gui Manager:Add,  Groupbox, x250 y250 w220 h55,规则
	Gui Manager:Add, Button, x260 y270 w55 h23 gManager_Add, &A 添加
	Gui Manager:Add, Button, x330 y270 w55 h23 gManager_Modify, &M 修改
	Gui Manager:Add, Button, x400 y270 w55 h23 gManager_Del, &D 删除
	Gui Manager:Add, Text, x10 y318 , 【特别说明】：在更改模式选择列表前，如有修改均要【保存】！
	Gui Manager:Add, Button, x400 y310 w55 h30 gManager_OK, &K 保存
	Gui Manager:Show, w480 h345, 规则模式
	Gui Manager:Default
	GuiControl, Choose,R_Mode,1
	LV_ModifyCol(1, 100)  
	LV_ModifyCol(2, 100)  
	LV_ModifyCol(3, 50)  
	LV_ModifyCol(4, 200)  
	OnMessage(0x201, "WM_LBUTTONDOWN2")
	gosub,Manager_ChangeMode
Return
;}

WM_LBUTTONDOWN2(){	;规则管理窗体：左键按下，不做操作
}

ManagerGuiClose:	;{规则管理窗体：关闭
	Reload
	;~ Gui,Main:Show, x%StartX% y%StartY%, DropIt(Kawvin)
	;~ OnMessage(0x201, "WM_LBUTTONDOWN")
	;~ Gui Manager:Destroy
return
;}

Manager_New:	;{规则管理窗体：新建模式
	InputBox,MyTemInput,请模式名称,,,200,100
	if ErrorLevel
		return
	if (MyTemInput="")
		return
	Gui Manager:Default
	GuiControl, ,R_Mode,%MyTemInput%
	GuiControl, Choose,R_Mode,%MyTemInput%
return
;}

Manager_Add:	;{规则管理窗体：添加规则
	CurRow:=""
	R_Name:=""
	R_Rule:=""
	R_Action:=""
	R_Target:=""
	gosub,Label_DrawGUI_CreatRules
return
;}

Manager_Modify:	;{规则管理窗体：修改规则
	Gui Manager:Default
	FocusedRowNumber := LV_GetNext(0, "F")  ; 查找焦点行
	CurRow:=FocusedRowNumber
	LV_GetText(R_Name, FocusedRowNumber ,1)
	LV_GetText(R_Rule, FocusedRowNumber ,2)
	LV_GetText(R_Action, FocusedRowNumber ,3)
	LV_GetText(R_Target, FocusedRowNumber ,4)
	gosub,Label_DrawGUI_CreatRules
return
;}

Manager_Del:	;{规则管理窗体：删除规则
	CurRow:=""
	Gui Manager:Default
	FocusedRowNumber := LV_GetNext(0, "F")  ; 查找焦点行
	LV_Delete(FocusedRowNumber)
return
;}

Manager_OK:	;{规则管理窗体：保存数据
	Gui Manager:Default
	GuiControlGet,R_Mode,,R_Mode
	IniDelete,%INI%,%R_Mode%
	Loop % LV_GetCount()
	{
		LV_GetText(R_Name, A_Index ,1)
		LV_GetText(R_Rule, A_Index ,2)
		LV_GetText(R_Action, A_Index ,3)
		LV_GetText(R_Target, A_Index ,4)
		IniWrite,%R_Rule%|%R_Action%|%R_Target%,%INI%,%R_Mode%,%R_Name%
	}
	RulesArray:=ReadINIToArray(INI)
	MsgBox, 64, 提示, 保存成功
return
;}

Manager_ChangeMode:	;{规则管理窗体：模式变动，填充ListView
	Gui Manager:Default
	LV_Delete()
	GuiControlGet,R_Mode,,R_Mode
	loop,% RulesArray.MaxIndex()
	{
		aObj:=RulesArray[A_index]
		Mode_Name:=aObj.name
		Mode_Item:=aObj.Rules
		loop,% Mode_Item.MaxIndex()
		{
			bObj:=Mode_Item[A_Index]
			Item_Name:=bObj[1]
			Item_Rules:=bObj[2]
			Item_Action:=bObj[3]
			Item_Target:=bObj[4]
			if (Mode_Name=R_Mode)
				LV_Add("",Item_Name,Item_Rules,Item_Action,Item_Target)
			;~ msgbox % Mode_Name "--" Item_Name "--" Item_Rules "--" Item_Action "--" Item_Target
		}
	}
return
;}
;【规则创建窗体】-------------------------------------------------------------
Label_DrawGUI_CreatAutoit:	;{创建规则窗体：绘制
    loop,% RulesMode.Length()
	{
		if (A_Index=1)
			R_Mode:=RulesMode[1] 
		else
			R_Mode:=R_Mode . "|" . RulesMode[A_Index]
	}
	Gui AutoitCreat:Destroy
	Gui AutoitCreat:Add, Text, x10 y10 w100 h17 +0x200, 1、名称：
	Gui AutoitCreat:Add, Edit, x10 y30 w450 h21 vS_Name,%S_Name%
    Gui AutoitCreat:Add, Text, x10 y60 w100 h17 +0x200, 2、源文件夹：
	Gui AutoitCreat:Add, Edit, x10 y80 w400 h21 vAutoit_source,%Autoit_source%
	Gui AutoitCreat:Add, Button, x415 y78 w45 h23 gAutoitCreat_Brown, 浏览
	Gui AutoitCreat:Add, Text, x10 y110 w100 h17 +0x200, 3、模式：
	Gui AutoitCreat:Add, DropDownList, x10 y130 w450 vR_Mode, %R_Mode%
	Gui AutoitCreat:Add, Button, x130 y225 w70 h30 gAutoitCreat_Save, &O 确定
	Gui AutoitCreat:Add, Button, x270 y225 w70 h30 gAutoitCreat_Cancel, &C 取消
	Gui AutoitCreat:Show, w470 h270, 新建一键整理
	Gui AutoitCreat:Default
	GuiControl, Choose,R_Mode,%R_Mode%
Return
AutoitCreat_Save:
	gui,AutoitCreat:Submit
	Gui AutoitManager:Default
	if (CurRow=""){
		LV_Add("",S_Name,Autoit_source,R_Mode)
	} else {
		LV_Modify(CurRow,,R_Name,R_Rule,R_Action,R_Target)
		CurRow:=""
	}	
	Gui AutoitCreat:Destroy
Return
AutoitCreat_Cancel:
    Gui AutoitCreat:Destroy
Return
;【规则创建窗体】-------------------------------------------------------------
Label_DrawGUI_CreatRules:	;{创建规则窗体：绘制
	if (R_Action="")
		R_Action:="移动"
	Gui Creat:Destroy
	Gui Creat:Add, Text, x10 y10 w100 h17 +0x200, 1、名称：
	Gui Creat:Add, Edit, x10 y30 w450 h21 vR_Name,%R_Name%
	Gui Creat:Add, Text, x10 y60 w100 h17 +0x200, 2、规则：
	Gui Creat:Add, Edit, x10 y80 w400 h21 vR_Rule,%R_Rule%
	Gui Creat:Add, Button, x415 y78 w45 h23 gCreat_Help, 说明
	Gui Creat:Add, Text, x10 y110 w100 h17 +0x200, 3、操作：
	Gui Creat:Add, DropDownList, x10 y130 w450 vR_Action, 移动||复制
	Gui Creat:Add, Text, x10 y160 w100 h17 +0x200, 4、目标文件夹：
	Gui Creat:Add, Edit, x10 y180 w400 h21 vR_Target,%R_Target%
	Gui Creat:Add, Button, x415 y178 w45 h23 gCreat_Brown, 浏览
	Gui Creat:Add, Button, x130 y225 w70 h30 gCreat_Save, &O 确定
	Gui Creat:Add, Button, x270 y225 w70 h30 gCreat_Cancel, &C 取消
	Gui Creat:Show, w470 h270, 新建规则
	Gui Creat:Default
	GuiControl, Choose,R_Action,%R_Action%
	OnMessage(0x201, "WM_LBUTTONDOWN2")
Return
;}

Creat_Save:	;{创建规则窗体：保存规则
	gui,Creat:Submit
	Gui Manager:Default
	if (CurRow=""){
		LV_Add("",R_Name,R_Rule,R_Action,R_Target)
	} else {
		LV_Modify(CurRow,,R_Name,R_Rule,R_Action,R_Target)
		CurRow:=""
	}	
	Gui Creat:Destroy
return
;}

Creat_Cancel:	;{创建规则窗体：取消
	Gui Creat:Destroy
return
;}

Creat_Help:	;{创建规则窗体：说明
	MsgBox, 0, 规则说明, 【重要说明】：匹配规则上到下，匹配后则跳过下面条件！！！`n--------------------------------------------------------`n【1】匹配后缀名，如*.jpg`;*.pdf，以中文或英文的分号分开；`n【2】匹配文件名：abc*，匹配以abc开头的文件，不区分后缀名；`n【3】匹配文件名：*abc，匹配以abc结尾的文件，不区分后缀名；`n【4】匹配文件名：*abc*，匹配以包含abc的文件，不区分后缀名；
return
;}

Creat_Brown:	;{创建规则窗体：浏览
	;选择目录
	FileSelectFolder, MySelPath, ::{20d04fe0-3aea-1069-a2d8-08002b30309d}, 3,选择目录
	if ErrorLevel
		return
	if MySelPath =
		return
	Gui Creat:Default
	GuiControl,,R_Target,%MySelPath%
return

AutoitCreat_Brown:	;{创建规则窗体：浏览
	;选择目录
	FileSelectFolder, MySouPath, ::{20d04fe0-3aea-1069-a2d8-08002b30309d}, 3,选择目录
	if ErrorLevel
		return
	if MySouPath =
		return
	Gui AutoitCreat:Default
	GuiControl,,Autoit_source,%MySouPath%
return
;}

/*ReadINIToArray	【作用：读取INI文件到数组】
    函数: ReadINIToArray
    作用：读取INI文件到数组
    作者: Kawvin\何许人
    版本: 0.1
    使用方法：
*/
ReadINIToArray(INI){
	TemArray:={}
	iniread,OutModes,%INI%
	global RulesMode
	RulesMode:=[]
	Loop,parse,OutModes,`n,`r
	{
		if (A_LoopField="") or (A_LoopField="设置")
			continue
		CurMode:=A_LoopField
		RulesMode.push(CurMode)
		NewMode:={}
		iniread,OutRules,%INI%,%CurMode%
		Loop,parse,OutRules,`n
		{
			if (A_LoopField="")
				continue
			CurRule:=RegExReplace(A_LoopField,"=.*?$")  	 ;用户自定义变量的key
			OutRules:=RegExReplace(A_LoopField,"^.*?=") 		 ;用户自定义变量的value
			if OutRules=
				continue
			RuleItem:=StrSplit(OutRules,"|")
			Item_Name:=CurRule
			Item_Rules:=RuleItem[1]
			Item_Action:=RuleItem[2]
			Item_Target:=RuleItem[3]
			TemRule:=[Item_Name,Item_Rules,Item_Action,Item_Target]
			NewMode.push(TemRule)
		}
		TemArray[a_index]:={"Name":CurMode,"Rules":NewMode}
	}
	return , TemArray
}


Label_OpenDir:	;{打开默认模式下所有目标文件夹
	loop,% RulesArray.MaxIndex()
	{
		aObj:=RulesArray[A_index]
		Mode_Name:=aObj.name
		if (Mode_Name!=DefaultMode)
			continue
		Mode_Item:=aObj.Rules
		loop,% Mode_Item.MaxIndex()
		{
			bObj:=Mode_Item[A_Index]
			Item_Target:=bObj[4]
			try
				run,%Item_Target%
		}
	}
return
WM_LBUTTONDBLCLK(){	;主窗体：左键双击
	gosub,Label_DrawGUI_ManagerRules
}