Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; <COMPILER: v1.1.34.3>
- #NoEnv
- #SingleInstance, Force
- SendMode Input
- SetWorkingDir %A_ScriptDir%\BOOKS
- Extensions := "txt,doc,bat,ahk,ls,vbs,reg,fm,ps1"
- Gui,Font,S14 Bold,Verdana ;Calibri
- Gui 1:Add, Button, Default gFindString, Search
- Gui 1:Add, Edit, w300 vfind
- Gui 1:Add, DropDownList, w600 vPFL gOP,
- Gui,Font,S12 Bold,Verdana ;Calibri
- Gui 1:Add, Edit, CGreen w1000 r24 vContent HSCROLL
- Gui 1:Add, Button, x15 y600 gNIR, NIR-RUN
- Gui 1:Add, Button,x120 y600 gAHK, AHK-RUN
- Gui 1:Add, Button,x225 y600 gBAT, BAT-RUN
- Gui 1:Add, Button,x330 y600 gBATS, BATS-RUN
- Gui 1:Add, Button,x445 y600 gDEL, DELETE
- Gui 1:Add, Button,x540 y600 gSAV, SAVE
- Gui 1:Add, Button,x610 y600 gSAVTO, SAVE-TO
- Gui,Font,S10 Bold,Verdana ;Calibri
- Gui 1:Add, StatusBar,, Najeeb Books , Ctrl+F to search in Text , F1 Open File , HELP Enter Edit Win All Hotkeys
- SB_SetParts(640)
- GoSub, DDL
- GuiControl, Hide, Button1
- GuiControl, Hide, Edit1
- Gui 1:Show,, Najeeb Books Search Files Data
- WinGet ControlID, ID, Najeeb Books Search Files Data
- Guicontrol,,Edit2, %PFL%
- return
- DDL:
- loop, *
- {
- if A_LoopFileExt in %extensions%
- GuiControl, , PFL, %A_LoopFileName% ; this will add an entry to the DDL control
- }
- Return
- OP:
- Gui, Submit, NoHide
- ;MsgBox,%PFL%
- FileRead,LoadFile,%PFL%
- GuiControl,, Edit2, %LoadFile%
- Return
- F1::Run, %PFL%
- Return
- F2::Run, notepad.exe %PFL%
- Return
- FindString:
- Gui, Submit, Nohide
- if (find != lastFind) {
- offset = 0
- hits = 0
- }
- GuiControl 1:Focus, Content ; focus on main help window to show selection
- SendMessage 0xB6, 0, -999, Edit2, ahk_id %ControlID% ; Scroll to top
- StringGetPos pos, Content, %find% ,,offset ; find the position of the search string
- if (pos = -1) {
- if (offset = 0) {
- SB_SetText("'" . find . "' not found", 1)
- SB_SetText("", 2)
- }
- else {
- SB_SetText("No more occurrences of '" . find . "'")
- SB_SetText("", 2)
- offset = 0
- hits = 0
- }
- return
- }
- StringLeft __s, Content, %pos% ; cut off end to count lines
- StringReplace __s,__s,`n,`n,UseErrorLevel ; Errorlevel <- line number
- addToPos=%Errorlevel%
- SendMessage 0xB6, 0, ErrorLevel, Edit2, ahk_id %ControlID% ; Scroll to visible
- SendMessage 0xB1, pos + addToPos, pos + addToPos + Strlen(find), Edit2, ahk_id %ControlID% ; Select search text
- ; http://msdn.microsoft.com/en-us/library/bb761637(VS.85).aspx
- ; Scroll the caret into view in an edit control:
- SendMessage, EM_SCROLLCARET := 0xB7, 0, 0, Edit2, ahk_id %ControlID%
- offset := pos + addToPos + Strlen(find)
- lastFind = %find%
- hits++
- SB_SetText("'" . find . "' found in line " . addToPos + 1, 1)
- SB_SetText(hits . (hits = 1 ? " hit" : " hits"), 2)
- Return
- cos_mousedrag_treshold := 20 ; pixels
- #IfWinNotActive ahk_class ConsoleWindowClass
- ~lButton::
- MouseGetPos, cos_mousedrag_x, cos_mousedrag_y
- keywait lbutton
- mousegetpos, cos_mousedrag_x2, cos_mousedrag_y2
- if (abs(cos_mousedrag_x2 - cos_mousedrag_x) > cos_mousedrag_treshold
- or abs(cos_mousedrag_y2 - cos_mousedrag_y) > cos_mousedrag_treshold)
- {
- wingetclass cos_class, A
- if (cos_class == "Emacs")
- sendinput !w
- else
- sendinput ^c
- }
- return
- ~Alt::
- WinGetClass cos_class, A
- if (cos_class == "Emacs")
- SendInput ^y
- else
- SendInput ^v
- return
- #IfWinNotActive
- ;; clipx
- ::Help::
- ( LTrim
- 0:- SAVTO = SAVE TEXT FILE IN BOOK FOLDER
- 1:- LBUTTON = SELECT
- 2:- CTRL+F = SEARCH IN SELECTED TEXT
- 3:- AHK-RUN = AHK SELECTED SCRIPT TEXT SAVE & RUN(TempScript.ahk)
- 4:- INSERT = COPY CLIPBOARD DATA
- 5:- NIR-RUN = RUN NIRCMD COMMAND SELECTED TEXT
- 6:- SAVE = COPY TEXT CLIPBOARD DATA
- 7:- F1 = SELECTED OPEN FILE
- 9:- F2 = SELECTED OPEN FILE IN NOTEPAD (image)
- 9:- BAT-RUN = BATCH SELECTED RUN COMMAND
- 10:- BATS-RUN = BATCH SELECTED SCRIPT TEXT SAVE & RUN(TempScript.bat)
- 11:- DELETE = DELETE (TempScript.ahk) & (TempScript.bat)
- 12:- WIN+R = Reload
- 13:- WIN+S = Suspend
- 14:- WIN+P = Pause
- 15:- ALT = PASTE
- 16:- ESC = ExitApp
- )
- SAVTO:
- Gui, Submit, NoHide
- FileAppend, %Clipboard%, %PFL%
- Return
- INSERT::
- Run, nircmd.exe shellcopy "%clipboard%" "DATA\" yestoall noerrorui
- Return
- SAV:
- Gui, Submit, NoHide
- FileAppend, %Clipboard%;~*.*###############~*.*END SCRIPT~*.*###############*.*~, DATA\NajeebScript.txt
- Return
- NIR:
- Gui, Submit, NoHide
- Run, nircmd.exe %Clipboard%
- Return
- AHK:
- Gui, Submit, NoHide
- FileAppend, %Clipboard%, DATA\TempScript.ahk
- Run, DATA\TempScript.ahk
- Return
- BAT:
- Gui, Submit, NoHide
- Run, %comspec% /c %Clipboard%,,hide
- Return
- BATS:
- Gui, Submit, NoHide
- FileAppend, %Clipboard%, DATA\TempScript.bat
- Run, DATA\TempScript.bat
- Return
- DEL:
- Gui, Submit, NoHide
- FileDelete, DATA\TempScript.*
- Return
- ^f::
- GuiControl, Show, Button1
- GuiControl, Show, Edit1
- Sleep 100
- ControlFocus, Edit1, A
- Return
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- #R::Reload ;<-- ~ Reload Script ~
- #S::Suspend ;<-- ~ Suspend Script ~
- #P::Pause ;<-- ~ Pause Script ~
- #M::WinMinimize, ;<-- ~ Minimize Script ~
- ESC::ExitApp ;<-- ~ Exit Script ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement