Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv
- #Persistent
- #SingleInstance, Force
- #MaxMem 4095
- #MaxThreads 99999
- #MaxThreadsBuffer On
- SendMode, Input
- SetWorkingDir, %A_ScriptDir%
- Process, Priority,, H
- SetBatchLines, -1
- SetTitleMatchMode, 2
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- FileCreateDir, %A_ScriptDir%\DATA
- FileInstall , SEARCH-EXTENSION.ahk, %A_ScriptDir%\DATA\SEARCH-EXTENSION.ahk, 1
- FileInstall , Milikymac.msstyles, %A_ScriptDir%\DATA\Milikymac.msstyles, 1
- FileInstall , USkin.dll, %A_ScriptDir%\DATA\USkin.dll, 1
- FileSetAttrib +HS, %A_ScriptDir%\DATA\SEARCH-EXTENSION.ahk, 2
- FileSetAttrib +HS, %A_ScriptDir%\DATA\Milikymac.msstyles, 2
- FileSetAttrib +HS, %A_ScriptDir%\DATA\USkin.dll, 2
- FileSetAttrib +HS, %A_ScriptDir%\DATA, 2
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- SkinForm(Apply, A_ScriptDir . "\DATA\USkin.dll", A_ScriptDir . "\DATA\Milikymac.msstyles")
- OnExit, GetOut
- sleep(period := 1, Mode := "P")
- {
- static Frequency, MinSetResolution, PID
- if (Mode = "P")
- {
- pBatchLines := A_BatchLines
- SetBatchLines, -1
- if !Frequency
- DllCall("QueryPerformanceFrequency", "Int64*", Frequency)
- DllCall("QueryPerformanceCounter", "Int64*", Start)
- Finish := Start + ( Frequency * (period/1000))
- loop
- DllCall("QueryPerformanceCounter", "Int64*", Current)
- until (Current >= Finish)
- SetBatchLines, %pBatchLines%
- }
- return
- }
- icon:="ICON.ico"
- iconURL:="http://www.iconarchive.com/download/i24880/mayosoft/azullustre-2/search-folder.ico"
- if (!FileExist(A_Temp "\" icon))
- URLDownloadToFile, % iconURL, %A_Temp%\%icon%
- Menu, Tray, Icon, %A_Temp%\%icon%
- Menu, Tray, NoStandard
- Menu, Tray, add, Search Extension, InputBox
- Menu, Tray, add, Created by: Najeeb Shah Khan, MenuHandler
- Menu, Tray, add, Exit, ExitHandler
- FileToolz()
- ;----------------------begin func
- FileToolz() {
- global Percent, tCount, sDir, EXTM, EXT
- inputbox:
- InputBox, EXT, Najeeb Choose Extension,%a_space%%a_space%%a_space%Default is EXE if left blank.`n Format: JPG "*." not required.,, 200, 145
- EXT=%EXT%
- EXTM:=EXT "-LIST.txt"
- if EXT=
- {
- EXT:="exe"
- }
- dMaster:=A_ScriptDir "\" EXTM
- dTmp:=A_Temp "\" "temp.txt"
- ;----------------------setting the search directory
- sDir=%sDir%
- Thread, NoTimers
- FileSelectFolder, sDir, *C:, 3, Select Your Search Folder
- Thread, NoTimers, false
- if sDir= ; blank
- {
- SetTimer, ChangeButtonNames, 50
- MsgBox, 4, Nothing Selected, %A_UserName%,`n`nDo you know how to work a dialog box?
- IfMsgBox, No
- return
- else
- return
- return
- }
- ;----------------------Checking for pre-existing files
- list_check:
- if (!FileExist(dMaster)){
- FileAppend,, % dMaster
- }if (FileExist(dTmp)){
- FileDelete, % dTmp
- }
- ;----------------------Nothing crucial going on here... taking file count before hand for progress bar
- SetTimer, WatchTip, 50
- tCount := 0
- Loop, %sDir%*.%EXT%, ,1
- {
- tCount++
- }
- ;----------------------Again, just for show...
- SetTimer, WatchTip, Off
- ToolTip ; <-destroys tooltip
- Progress, b C0 w500 h55
- ;----------------------; actual file count starts here
- FileList =
- Counter := 0
- Loop, %sDir%*.%EXT%, , 1
- {
- Counter++ ; generates a count for the percentage
- Percent := Floor(Counter / tCount * 100)
- FileList = %FileList%%A_LoopFileName%%A_Tab%%A_LoopFileFullPath%`n
- gosub, ProgressBar ; updates progress bar
- }
- Progress, off
- ;----------------------sort files and append temp
- TrayTip,, Creating temp file, 15
- Sort, FileList
- Loop, parse, FileList, `n
- {
- if A_LoopField =
- break
- FileAppend, %A_LoopField%`n, % dTmp
- }
- TrayTip
- ;----------------------read contents of master list and temp list
- FileRead, mContent, % dMaster
- Sort, mContent, CL
- FileRead, tContent, % dTmp
- Sort, tContent, CL
- ;----------------------compare temp to master
- TrayTip,, Comparing Changes, 10
- Loop, Read, % dTmp
- {
- IfNotInString, mContent, %A_LoopReadLine%
- FileAppend, %A_LoopReadLine%`n, % dMaster
- }
- TrayTip
- ;----------------------clear memory
- FileContent1=
- FileContent2=
- ;----------------------delete temp file & notify user of completion
- TrayTip,, Doing some housekeeping..., 2
- Sleep, (2000)
- FileDelete, % dTmp
- TrayTip,, Done...
- Sleep, (1000)
- TrayTip
- return
- WatchTip: ;----------------------Tooltip during file count
- ToolTip, Gathering *.%EXT% file count...`nCount: %tCount%
- Sleep (25)
- return
- ;----------------------Progress bar updater
- ProgressBar:
- P2:="["(A_Space)(percent)(A_Space)"%"(A_Space)"]"
- WinSet,Transparent, 210, %A_ScriptName% ; Transparency
- WinSet,ExStyle,+0x20, %A_ScriptName% ; Click-through
- Progress, %Percent%, %P2%%A_Tab%%A_LoopFileName%,, %A_ScriptName%
- return
- MenuHandler:
- SplashTextOn, 200, 25, Created by:, najeebshahkhan@gmail.com
- WinSet,Transparent, 210, Created by:
- Sleep, (2000)
- SplashTextOff
- return
- ChangeButtonNames:
- IfWinNotExist, Nothing Selected
- return ; Keep waiting.
- SetTimer, ChangeButtonNames, off
- WinActivate
- ControlSetText, Button1, &No
- ControlSetText, Button2, &No
- return
- ExitHandler:
- ExitApp
- return
- } ;---------------------- FUNC ENDS HERE
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- GetOut:
- GuiClose:
- Gui, Hide
- SkinForm(0)
- ExitApp
- return
- SkinForm(Param1 = "Apply", DLL = "", SkinName = ""){
- if(Param1 = Apply){
- DllCall("LoadLibrary", str, DLL)
- DllCall(DLL . "\USkinInit", Int,0, Int,0, AStr, SkinName)
- }else if(Param1 = 0){
- DllCall(DLL . "\USkinExit")
- }
- }
- ;=-=-=-=-=-=-=- END Script -=-=-=-=-=-=-=-=-
- #S::Suspend
- #P::Pause
- #R::Reload
- ESC::ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement