?? camouflage.au3
字號(hào):
#cs
發(fā)現(xiàn)AutoIt很強(qiáng)大,所以想嘗試?yán)肁utoIt寫一些程序,此腳本完成了對(duì)于一般文件夾的偽裝,并建立了特殊目錄"lock..\"
此特殊目錄可以防止偽裝的文件夾被簡(jiǎn)單的刪除或者復(fù)制。
陳大衛(wèi) 20080718
#ce
#include <GuiConstantsEx.au3>
#include <AVIConstants.au3>
#include <TreeViewConstants.au3>
Opt("GUIOnEventMode", 1) ; 切換為 OnEvent 模式
Opt("TrayIconHide", 1) ;隱藏托盤圖標(biāo)
Opt("GUICloseOnESC", 1) ;按下 ESC 將關(guān)閉窗
; GUI
$handle_win=GuiCreate("文件夾偽裝", 320, 280)
GUISetOnEvent($GUI_EVENT_CLOSE, "closewindow")
; MENU
$filemenu = GUICtrlCreateMenu ("幫助(&H)")
$fileitem = GUICtrlCreateMenuitem ("關(guān)于(&A)",$filemenu)
GUICtrlSetOnEvent(-1, "about")
$separator1 = GUICtrlCreateMenuitem ("",$filemenu,2) ; 分隔線
$exititem = GUICtrlCreateMenuitem ("退出(&X)",$filemenu)
GUICtrlSetOnEvent(-1, "closewindow")
;偽裝
GUICtrlCreateGroup (" 偽裝 ", 10, 10, 300, 130)
GUICtrlCreateLabel("目標(biāo)文件夾",20,35)
GUICtrlCreateLabel("偽裝類型",20,70)
$inputdir=GuiCtrlCreateInput("",90,32,150)
$selectmode=GUICtrlCreateCombo("回收站",90,68,200)
GUICtrlSetData(-1,"我的電腦|控制面板|打印機(jī)|拔號(hào)網(wǎng)絡(luò)|網(wǎng)上鄰居|收藏夾|我的文檔|Internet 臨時(shí)文件|公文包","回收站") ; 添加其它項(xiàng)目并設(shè)置新的默認(rèn)值
GUICtrlCreateButton ("瀏覽...", 250, 30)
GUICtrlSetOnEvent(-1, "getdir")
$check = GUICtrlCreateCheckbox ("增強(qiáng)防刪除功能", 20, 110, 120, 20)
GUICtrlSetState(-1,$GUI_CHECKED)
$BtnCamouflage=GUICtrlCreateButton("偽裝",140,105,60)
GUICtrlSetOnEvent(-1, "camouflage")
GUICtrlCreateGroup ("",-99,-99,1,1) ;封閉組框
;解鎖
GUICtrlCreateGroup (" 解鎖 ", 10, 150,300, 100)
GUICtrlCreateLabel("解鎖文件夾",20,175)
$inputdir2=GuiCtrlCreateInput("",90,172,150)
GUICtrlSetState(-1,$GUI_FOCUS)
GUICtrlCreateButton ("瀏覽...", 250, 170)
GUICtrlSetOnEvent(-1, "getdir2")
GUICtrlSetState(-1,$GUI_DEFBUTTON)
$BtnOpen=GUICtrlCreateButton("打開(kāi)(&O)",40,210,60)
GUICtrlSetOnEvent(-1, "opendir")
$BtnClose=GUICtrlCreateButton("關(guān)閉(&C)",100,210,60)
GUICtrlSetOnEvent(-1, "closedir")
$BtnUnlock=GUICtrlCreateButton("解鎖",180,210,60)
GUICtrlSetOnEvent(-1, "Unlock")
GUICtrlCreateGroup ("",-99,-99,1,1) ;封閉組框
GuiSetState()
While True
Sleep(1000)
WEnd
Func camouflage();偽裝
$dir=GUICtrlRead($inputdir)
$mode=GUICtrlRead ($selectmode)
Select
Case $mode="回收站"
$mode="回收站.{645FF040-5081-101B-9F08-00AA002F954E}"
Case $mode="我的電腦"
$mode="我的電腦.{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
Case $mode="控制面板"
$mode="控制面板.{21ec2020-3aea-1069-a2dd-08002b30309d}"
Case $mode="打印機(jī)"
$mode="打印機(jī).{2227a280-3aea-1069-A2de-08002b30309d}"
Case $mode="拔號(hào)網(wǎng)絡(luò)"
$mode="拔號(hào)網(wǎng)絡(luò).{992CFFA0-F557-101A-88EC-00DD010CCC48}"
Case $mode="網(wǎng)上鄰居"
$mode="網(wǎng)上鄰居.{208D2C60-3AEA-1069-A2D7-08002B30309D}"
Case $mode="收藏夾"
$mode="收藏夾.{1a9ba3a0-143a-11cf-8350-444553540000}"
Case $mode="我的文檔"
$mode="我的文檔.{450D8FBA-AD25-11D0-98A8-0800361B1103}"
Case $mode="Internet 臨時(shí)文件"
$mode="Internet 臨時(shí)文件.{7BD29E00-76C1-11CF-9DD0-00A0C9034933}"
Case $mode="公文包"
$mode="公文包.{85BBD920-42A0-1069-A2E4-08002B30309D}"
Case Else
Return "error"
EndSelect
If StringRight($dir,1)="\" then $dir=StringLeft($dir,stringlen($dir)-1)
$count=StringSplit($dir, "\" )
If $count[0]=1 Then
MsgBox(0,"提示","僅可以偽裝文件夾,不能偽裝磁盤分區(qū),請(qǐng)重新選擇")
Return
EndIf
$basedir=StringLeft($dir,stringlen($dir)-StringLen($count[$count[0]]))
$objectdir=$basedir & $mode
DirMove($dir,$objectdir)
if GUICtrlRead($check)=1 then
FileChangeDir($objectdir)
RunWait(@ComSpec & " /c " & 'md lock..\',$objectdir,@SW_HIDE)
EndIf
MsgBox(0,"","偽裝完成")
Run("explorer " & $basedir)
Exit
EndFunc
Func opendir();打開(kāi)偽裝的目錄
askpassword()
$dir=GUICtrlRead($inputdir2)
If include($dir,"{")=False Or include($dir,"}")=False Or include($dir,"-")=False Then
MsgBox(0,"提示","無(wú)效文件夾,請(qǐng)重新選擇.")
Return
EndIf
RunWait(@ComSpec & " /c " & "subst z: " & $dir,"",@SW_HIDE)
Run("explorer z:")
EndFunc
Func closedir();關(guān)閉偽裝目錄的磁盤映射
RunWait(@ComSpec & " /c " & "subst z: /d","",@SW_HIDE)
EndFunc
Func Unlock();解鎖
askpassword()
$dir=GUICtrlRead($inputdir2)
If include($dir,"{")=False Or include($dir,"}")=False Or include($dir,"-")=False Then
MsgBox(0,"提示","無(wú)效文件夾,請(qǐng)重新選擇.")
Return
EndIf
FileChangeDir($dir)
RunWait(@ComSpec & " /c " & 'rd lock..\',$dir,@SW_HIDE)
$count=StringSplit($dir,".")
$dirobject=StringLeft($dir,Stringlen($dir)-StringLen($count[$count[0]])-1)
DirMove($dir,$dirobject)
Sleep(1000)
DirRemove($dir, 0)
Run("explorer " & $dirobject)
Exit
EndFunc
Func getdir2();得到解鎖路徑
$dir=FileSelectFolder("請(qǐng)選擇一個(gè)文件夾:", "")
ControlSetText("文件夾偽裝","",$inputdir2,$dir)
EndFunc
Func getdir();得到偽裝路徑
$dir=FileSelectFolder("請(qǐng)選擇一個(gè)文件夾:", "")
ControlSetText("文件夾偽裝","",$inputdir,$dir)
EndFunc
Func about();關(guān)于
MsgBox(0,"","簡(jiǎn)單的文件夾偽裝程序,密碼:芝麻開(kāi)門" & @CRLF & "作者: 陳大衛(wèi)")
EndFunc
Func closewindow();退出
Exit
EndFunc
Func include($str,$flag);查找是否包含某特定字符串
$count=StringSplit($str,$flag)
If $count[0]=1 Then
Return False
Else
Return True
EndIf
EndFunc
Func askpassword();密碼驗(yàn)證
$answer=InputBox("請(qǐng)輸入打開(kāi)或解鎖密碼","你的口令是: ","","*")
If $answer<>"zhimakaimen" Then Exit
EndFunc
Exit
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -