side-white / AHK

0 stars 0 forks source link

0330 #2

Open side-white opened 6 years ago

side-white commented 6 years ago

InstallKeybdHook

SingleInstance force

;#AllowSameLineComments tooltip,reloaded,0,0 sleep,1000 tooltip, Global PW PW:="" DetectHiddenWindows, on ;WinSet, Transparent, OFF, ahk_class ahk_class DV2ControlHost WinSet, Transparent, off, ahk_class Shell_TrayWnd

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Win+z=Test ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

~^w::Closepdf() ~ESC::reload_ahk()

g::google()

f::run,C:\Users\baid\Documents\7_Programs\Everything\Everything.exe

c::run,control.exe

t::run_taskmgr()

^#c::copy_url() ~printscreen::screen_shot() ~!PrintScreen::screen_shot()

w::window_spy()

~!q::Rotate(1) ~!e::Rotate(2) ~!a::Rotate(3) ~!d::Rotate(4)

s::run_sublime()

b::bracket()

;;;要調整

u::get_url()

p::run_python()

;F1::AHK_Help()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KeyChange;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;sc029::send,0 ;^sc029::SEND,0 ;+sc029::SEND,0 ~F24 & 0::Send, 0 ~F24 & 1::send, 1 ~F24 & 2::send, 2 ~F24 & 3::send, 3 ~F24 & q::send, 4 ~F24 & 4::send, 4 ~F24 & w::send, 5 ~F24 & e::send, 6 ~F24 & a::send, 7 ~F24 & s::send, 8 ~F24 & d::send, 9 ~F24 & sc07B::send,. ~F24 & z::send,( ~F24 & x::send,) ~F24 & c::send,{{} ~F24 & v::send,{}} ~F24 & WheelUp::send,{LEFT} ~F24 & WheelDown::send,{Right} ;sc03a::send,{capslock} ;^sc03A::vkF3sc029 ;!sc03A::vkF3sc029 vkF0sc03a::Capslock

; #If MouseIsOver("ahk_class Shell_TrayWnd") ; WHEELUP::Send,{RControl}{RShift}

; WheelDown::Send,{AltUP}

; ;AltTabAndMenu ; ;MButton::AltTabMenuDismiss ; ;#z:: ; RControl & RShift::AltTab ; Hold down right-control then press right-shift repeatedly to move forward. ; RShift & RControl::ShiftAltTab ; ; ; ;#If MouseIsOver("ahk_class Shell_TrayWnd") ~MButton & WHEELUP::AltTabAndMenu ~MButton & WHEELDOWN::AltTabAndMenu ~!esc:: { IfWinExist ahk_class TaskSwitcherWnd Send {Escape}{Alt up} } ~!MButton:: { IfWinExist ahk_class TaskSwitcherWnd Send {SPACE}{Alt up} } ;#If MouseIsOver(WinTitle) { MouseGetPos,,, Win return WinExist(WinTitle . " ahk_id " . Win) }

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ReloadInfo;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Return PROKILL(PRONAME){ ;MsgBox, %PRONAME% Process, Exist, %PRONAME% PID:=ErrorLevel ;MsgBox, %PID% IF PID { PROCESS,Close, %PID% } Else MouseGetPos, xpos, ypos TOOLTIP,%PRONAME% not found,%xpos%, %ypos% SLEEP,1000 TOOLTIP, RETURN } press_F1(){ if (A_PriorHotkey <> "~F1" or A_TimeSincePriorHotkey > 150) { ;Too much time between presses, so this isn't a double-press. KeyWait, F1 return } send, {F1} return

}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Functions;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

reload_ahk(){ if (A_PriorHotkey <> "~ESC" or A_TimeSincePriorHotkey > 150) { ;Too much time between presses, so this isn't a double-press. KeyWait, ESC return } Ifwinactive,ahk_exe sublime_text.exe { send, ^s } reload

return

}

Closepdf(){ ControlGettext, cnn, AVL_AVView14, A if (cnn="AVPageView"){ WinGettitle, title, A msgbOX,%TITLE% for window in ComObjCreate("Shell.Application").Windows{ url:=window.LocationName msgbOX,%URL%,%TITLE% if InStr(title,url){ msgbOX, ASD window.quit() ;; close the identified selection break } } } return }

google(){ bk = %ClipboardAll% Clipboard = ifwinactive,ファイル名を指定して実行 { ;send,^a ;sleep,1 ;send,^c ControlGettext,Clipboard,Edit1,A } else{ Send,^c }

ClipWait,0.2
Run,http://www.google.com/search?q=%Clipboard%
Clipboard = %bk%
Return

}

run_taskmgr(){ Ifwinactive,ahk_exe taskmgr.exe { WinClose } else { run,taskmgr.exe winactivate,ahk_exe taskmgr.exe } return }

run_sublime(){ Ifwinactive,ahk_exe sublime_text.exe { WinMinimize } else if WinExist("ahk_exe sublime_text.exe") { winactivate } else { run,C:\Users\baid\Documents\7_Programs\Sublime Text\sublime_text.exe } return }

run_python(){ Ifwinactive,ahk_exe pythonw.exe { WinMinimize } else if WinExist("ahk_exe pythonw.exe") { winactivate } else { run,C:\Users\baid\Documents\7_Programs\Python\Python36-32\pythonw.exe "C:\Users\baid\Documents\7_Programs\Python\Python36-32\Lib\idlelib\idle.pyw" } return }

copy_url(){ send,^c ClipWait,0.2 clipboard=%clipboard% ;%null% tooltip,%clipboard% sleep,1000 tooltip, return }

screen_shot(){ ;send,{printscreen} ;sleep,100 run,mspaint.exe winwaitactive,ahk_exe mspaint.exe,,5 if (ErrorLevel=0){ WinMaximize, send,^v } return }

window_spy(){ if WinExist("ahk_exe AU3_Spy.exe") { WinClose } else { run,C:\Users\baid\Documents\7_Programs\AutoHotkey\AU3_Spy.exe WinWaitActive, ahk_exe AU3_Spy.exe WinMove, 1562, 548 } return }

Rotate(mode){ Ifwinactive,ahk_exe TIFFizm.exe { if (mode=1){ SetControlDelay -1 ControlClick, TBitBtn4,A } else if (mode=2){ SetControlDelay -1 ControlClick, TBitBtn3,A } else if (mode=3){ send,{PgUp} ;ControlClick, TBitBtn2,A } else { send,{PgDn} ;ControlClick, TBitBtn1,A } } Ifwinactive,ahk_exe AcroRd32.exe { if (mode=1){ send,^+- } else if (mode=2){ send,^+; } else if (mode=3){ send,{PgUp} ;ControlClick, TBitBtn2,A } else { send,{PgDn} ;ControlClick, TBitBtn1,A } } return }

bracket(){ bk = %ClipboardAll% Clipboard = Send,^x ;sleep,100 ClipWait,0.1 send,(^v) Clipboard = %bk% return }

get_url(){ For window in ComObjCreate("Shell.Application").Windows wds .= window.LocationName " :: " window.LocationURL "`n" MsgBox % wds WinGetActiveTitle, Title MsgBox, The active window is "%Title%". }

FileSearch(path,pattern){ ;Dim FSO As Object, Folder As Variant, file As Variant FSO := ComObjCreate("Scripting.FileSystemObject")

;For Each Folder In FSO.GetFolder(path).subfolders
;    FileSearch(Folder.path, Target)
;Next Folder
For  file In FSO.GetFolder(path).Files{
    FLNM:= FILE.NAME
    ;msgbox, %flnm%
    if regexmatch(flnm,pattern)
        return flnm
}
;    If file.Name Like Target Then
;        'Debug.Print File.Name
;        FileSearch = file.Name
;    End If
;Next
return

}

AHK_Help(){ WinGettitle,title,A ;0MsgBox, title if instr(title,".ahk") && instr(title,"Sublime Text (UNREGISTERED)"){ run,hh.exe "C:\Users\baid\Documents\7_Programs\AutoHotkey\AutoHotkey.chm" } else{ ;send,{F1} }

}