請選擇 進入手機版 | 繼續訪問電腦版

微剋多資訊

 找回密碼
 註冊

Sign in with google

Google帳號登入

搜索
回覆 4則 瀏覽 22879篇
Line

[提問] AutoHotkey 原碼範例(幫忙找錯~)

該用戶從未簽到

升級   0%

發表於 2014-4-12 00:27 | 顯示全部樓層 |閱讀模式
本帖最後由 zmac2007 於 2017-1-14 09:42 編輯

軟體請至阿榮下載AutoHotkey 1.1.14.03 免安裝版 - 取代按鍵精靈的免費自由軟體

;先說明基本的
^〔Ctrl〕鍵
!〔Alt〕鍵
+〔Shift〕鍵
#〔Win〕鍵
& 用&符號把兩個按鍵或按鈕組合成為一個鍵,例如:LButton & a表示按左鈕不放,同時再按〔a〕鍵
~加~符號表示抑制該按鍵,使用在當我們想要把某個按鍵變更成另一個內容的場合。




內建變數
%A_WinDir%               ;Windows系統資料夾 C:Windows或C:WINNT
%A_ProgramFiles%    ;程式集資料夾名稱 C:Program Files
%A_AppData%           ;使用者個人資料夾  C:Documents and Settings使用者Application Data
%A_Desktop%           ;使用者桌面資料夾 C:Documents and Settings使用者桌面
%A_ScriptDir%         ;腳本當下目錄


腳本副檔案為AHK,用記事本編輯即可,記得AHK文件要和AutoHotkey.exe作檔案關連。
AHK文件生成EXE檔,請用Ahk2Exe.exe,反編譯請用Exe2Ahk.exe。


己知問題:滑鼠+按鍵的熱鍵沒整合好,不知為何有時會延遲,之後駐點消失傳遞訊息,錯誤的造成如F7,F8.F9...自動連發訊息。而 F7是老闆鍵 ...不可連按兩下,不然隱藏視窗無法回複,問題就這樣出現了


範例原本是作用在Win8pe x86裡的工具,之後又改了一些熱鍵執行軟體的路徑設定。

====

; AHK版本:AutoHotkey 1.1.14.02
;適用平台:WinXp/7/2000/2003/NT
#SingleInstance, force ;單一運行不能多開
#NoEnv ;取消環境變量
;#NoTrayIcon ;工作匣選單禁用
a := 20

SetBatchLines, -1
SetWinDelay, -1
OnExit, CleanUp

numDesktops := 9
curDesktop := 1

WinGet, windows1, List

Gui, -Caption +ToolWindow +LastFound +AlwaysOnTop
Gui, Add, Picture, x0 y0, C:Program FilesAutohotkeyScriptsbanner.png
Gui, Add, Text, x15 y5 w70 +BackgroundTrans vString
GroupAdd, WinGroup,ahk_class Progman ;桌面 f9用
GroupAdd, WinGroup,ahk_class WorkerW ;桌面 f9用

applicationname=工作熱鍵管理員(Ctrl+)
Menu,tray,NoStandard
Menu,Tray,Add,%applicationname%,SHOWCALENDAR
Menu, tray, add
Menu,desk,add,虛擬桌面1(Alt+1),menuD1
Menu,desk,add,虛擬桌面2(Alt+2),menuD2
Menu,desk,add,虛擬桌面3(Alt+3),menuD3
Menu,desk,add,虛擬桌面4(Alt+4),menuD4
Menu,desk,add,虛擬桌面5(Alt+5),menuD5
Menu,desk,add,虛擬桌面6(Alt+6),menuD6

Menu,desk,add,虛擬桌面7(Alt+7),menuD7
Menu,desk,add,虛擬桌面8(Alt+8),menuD8
Menu,desk,add,虛擬桌面9(Alt+9),menuD9
Menu,Tray,add,虛擬桌面(Alt+1~9),:desk
Menu,dktool,add,超老闆鍵(F7不可連按),f7
Menu,dktool,add,鍵盤記錄(F8連按兩下),f8
Menu,Tray,add,視窗/鍵盤記錄(F7/F8),:dktool
Menu,logon,add,電腦管理(Ctrl+F1),^f1
Menu,logon,add,帳戶工具(Ctrl+F2),^f2
Menu,logon,add,系統訊息(Ctrl+F3),^f3
Menu,logon,add,移除軟體(Ctrl+F4),^f4
Menu,logon,add,時間設定(Ctrl+F5),^f5
Menu,logon,add,地區語言(Ctrl+F6),^f6
Menu,logon,add,音效裝置(Ctrl+F7),^f7
Menu,logon,add,桌面設置(Ctrl+F8),^f8
Menu,logon,add,滑鼠裝置(Ctrl+F9),^f9
Menu,logon,add,I E 設定(Ctrl+F10),^f10
Menu,Tray,add,管理台(Ctrl+F1~F10),:logon
Menu,usbdd,add,寫入/唯讀(Alt+F9),+f9
Menu,usbdd,add,啟用/禁用(Alt+F10),+f10
Menu,Tray,add,隨身碟 (Alt+F9/F10),:usbdd
Menu,Tray,add,&關於 熱鍵列表說明,About
Menu, tray, add, 退出軟體, Exit
Menu,Tray,Default,%applicationname%

^1::Run,notepad.exe
^2::Run,mspaint.exe
^3::Run,calc.exe
^4::GOTO QDIR
^5::Run,cmd.exe
^-::process, close, explorer.exe
^=::Run explorer.exe
^::Run,taskmgr.exe
^f1::Run,compmgmt.msc
^f3::Run,sysdm.cpl
^f2::Run,SETTINGS.exe
^f4::Run,geek.exe
^f5::Run,timedate.cpl
^f6::Run,intl.cpl
^f7::Run,mmsys.cpl
^f8::Run,desk.cpl
^f9::Run,main.cpl
^f10::Run,iemaster
#S:: Run,finder.exe
GroupAdd, WinGroup,ahk_class Shell_TrayWnd
return


~F1::
;連按兩下f1
Keywait, F1, , t0.3
if errorlevel = 1

return
else
Keywait, F1, d, t0.1
if errorlevel = 0
{
WinSet, Transparent, 255, A
Gui, Font,Bold
Gui, Color, 749200
Gui,Add,Text,,程式版本說明:
Gui,Add,Text,,程式名稱:zmackey
Gui,Add,Text,,開發工具:AHK   版本:1.0.48.5
Gui,Add,Text,,適用平台:Win8PE_SUN2 B+ 專用
Gui,Add,Text,,腳本類型:桌面強化 修改者:zmac2007
Gui,Add,Text,,測試系統:台灣繁體中文 8PE
Gui,Add,Text,,已知缺陷:只適用於32位元系統
Gui,Add,Text,,
Gui Show,,程式版本說明
Sleep,3000
Gui, Destroy
traytip,,大家好 我是zmac2007`n我會講客家話,我很宅  `n感謝你測試使用本程式
return
}
return


!f1::
If value1 = 0
value1 = 1
Else
value1 = 0
RegWrite, REG_DWORD, HKEY_CURRENT_USER, SoftwareMicrosoftWindowsCurrentVersionExplorerAdvanced, HideFileExt, %Value1%

WinGetClass, eh_Class,A
send, {F5}

PostMessage, 0x111, 28931,,, A
traytip,,顯示0/隱藏1 文件副檔名 `n %value1%
return

!f2::
If value = 1
value = 2
Else
value = 1
RegWrite, REG_DWORD, HKEY_CURRENT_USER, SoftwareMicrosoftWindowsCurrentVersionExplorerAdvanced, Hidden, %Value%

WinGetClass, eh_Class,A
send, {F5}
PostMessage, 0x111, 28931,,, A
traytip,,顯示1/隱藏2 文件,但系統文件還是隱藏 `n %value%
return

!f3::
If value3 = 0
value3 = 1
Else
value3 = 0
RegWrite, REG_DWORD, HKEY_CURRENT_USER, SoftwareMicrosoftWindowsCurrentVersionExplorerAdvanced, ShowSuperHidden, %Value3%

WinGetClass, eh_Class,A
send, {F5}
PostMessage, 0x111, 28931,,, A
traytip,,顯示1/隱藏0 文件,包含系統文件 `n %value3%
return

!f4::
WinGetActiveTitle, Title
WinClose, %Title%
return


F5 & F6::  ;這敘述看來有些奇怪和有問題的地方,是因為最原本功能有殺某個劫持
explorer.exe並偽裝成taskmgr.exe的隨身碟蠕蟲...
BlockInput,off
process, close, explorer.exe
process, close, taskmgr.exe
Run,taskmgr.exe
Run,explorer.exe
;不過原本的敘述其他部分不見了
MsgBox, , 結束無限迴圈的問題,同時按下F5和F6,若有問題,請再按1次
return


F7::  ;一鍵開關
traytip,,不要快速連按F7鍵兩次
k+=1
if (mod(k,2)=0){
WinGet, id, list,,, Program Manager
Loop, %id%
{
    this_id := id%A_Index%
    WinGetTitle, this_title, ahk_id %this_id%
    WinHide, %this_title%
    FileAppend, %this_title%`n, temp.txt
}
}else{
Loop, 20
{
FileReadLine, title, temp.txt, %A_Index%
WinShow, %title%
}
FileDelete, temp.txt
Return
}
send, {F5}
PostMessage, 0x111, 28931,,, A ;更新桌面

return

F8::   ;一次性
traytip,,快速連按F8鍵兩次才會執行記錄
Keywait, F8, , t0.5
if errorlevel = 1
return
else
Keywait, F8, d, t0.1
if errorlevel = 0
{
traytip,,記錄按鍵在 %A_Desktop%鍵盤記錄.log
Loop
{
  Input, UserInput, V C T1
  FileAppend, %UserInput%, %A_Desktop%鍵盤記錄.log
}
return
}
return


#IfWinNotActive  ahk_group WinGroup
F9::
WinGet, V, ExStyle, A
If V & 0x8
{
         WinSet, AlwaysOnTop, Off, A
         WinSet, Transparent, off, A
}
Else
{
         WinSet, AlwaysOnTop, On, A
         WinSet, Transparent, 50, A
}
Return
#IfWinNotActive



MouseIsOverTitlebar(HeightOfTitlebar = 30)
{
        CoordMode,Mouse,Screen

        WinGetActiveStats,ActiveTitle,width,height,xPos,yPos
        MouseGetPos,x,y
        If ((x >= xPos) && (x <= xPos + width) && (y >= yPos) && (y <= yPos + HeightOfTitlebar))
                Return,%ActiveTitle%



        Else
                Return,false
}

ChangeTransparency(ActiveWinTitle,flag = "increase",amount = 10)
{
        static t = 255
        If (flag == "increase")
        {
                tmp := t + amount
        }
        Else If (flag == "decrease")


                tmp := t - amount
        If (tmp > 255)

                tmp = 255
        Else If (tmp < 0)
                tmp = 0
        WinSet,Transparent,%tmp%,%ActiveWinTitle%
        ToolTip,當前透明度:%tmp%
        Sleep,1000
        Tooltip

        t := tmp
        Return
}


WheelDown::
ActiveWinTitle := MouseIsOverTitlebar()
If (ActiveWinTitle)
{
        ChangeTransparency(ActiveWinTitle,"decrease",20)
}
Else
        MouseClick,WD
Return

WheelUp::
ActiveWinTitle := MouseIsOverTitlebar()
If (ActiveWinTitle)
{
        ChangeTransparency(ActiveWinTitle,"increase",20)
}
Else
        MouseClick,WU

Return






*RButton::
  MouseGetPos, x, y
  If (x<a && y<a)
  {
        SwitchToDesktop(9)
        Send,{VOLUME_MUTE}
        Send {f7}
  }
  Else if (x>A_ScreenWidth-(a+1) && y<a)
  {
        Run,compmgmt.msc
  }
  Else if (x<a && y>A_ScreenHeight-(a+1))
  {
        send, {RButton}
  }
  Else if (x>A_ScreenWidth-(a+1) && y>A_ScreenHeight-(a+1))
  {
       send,#d
  }
  Else if (x>=a && y<a)
  {
        send, {RButton}
  }
  Else if (x<a && y>=a)
  {
        send, {RButton}

  }
  Else if (x>=a && y>A_ScreenHeight-(a+1))
  {
        send,{RButton}
  }
  Else if (x>A_ScreenWidth-(a+1) && y>=a)
  {
        send, {RButton}
  }
  Else
    send, {RButton}
  return


*MButton::
  MouseGetPos, x, y
  If (x<a && y<a)
  {
        SwitchToDesktop(8)
        BlockInput,on
        SendMessage, 0x112, 0xF170, 2,, Program Manager
  }
  Else if (x>A_ScreenWidth-(a+1) && y<a)
  {
       IfExist,%A_WinDir%system32SETTINGS.exe
       Run,%A_WinDir%system32SETTINGS.exe
       IfExist,X:WINDOWSsystem32netplwiz.dll
       Run,control userpasswords2
  }

  Else if (x<a && y>A_ScreenHeight-(a+1))
  {
       GOTO QDIR
  }
  Else if (x>A_ScreenWidth-(a+1) && y>A_ScreenHeight-(a+1))
  {
       Run,cmd.exe
  }
  Else if (x>=a && y<a)
  {
        Run,calc.exe
  }
  Else if (x<a && y>=a)
  {
         Run,notepad.exe
  }
  Else if (x>=a && y>A_ScreenHeight-(a+1))
  {
       IfExist,%A_WinDir%System32taskmgr.exe
       Run,%A_WinDir%System32taskmgr.exe
  }
  Else if (x>A_ScreenWidth-(a+1) && y>=a)
  {
        Run,mspaint.exe
  }
  Else
    send, {MButton}
  return







#MaxThreadsPerHotkey 9

!1::SwitchToDesktop(1)
!2::SwitchToDesktop(2)
!3::SwitchToDesktop(3)
!4::SwitchToDesktop(4)
!5::SwitchToDesktop(5)
!6::SwitchToDesktop(6)
!7::SwitchToDesktop(7)
!8::SwitchToDesktop(8)
!9::SwitchToDesktop(9)

#MaxThreadsPerHotkey 1


^!1::SendActiveToDesktop(1)
^!2::SendActiveToDesktop(2)
^!3::SendActiveToDesktop(3)
^!4::SendActiveToDesktop(4)
^!5::SendActiveToDesktop(5)
^!6::SendActiveToDesktop(6)
^!7::SendActiveToDesktop(7)
^!8::SendActiveToDesktop(8)
^!9::SendActiveToDesktop(9)

!0:: ;
;這敘述看來有些奇怪和有問題的地方,是因為最原本功能有殺某個劫持explorer.exe並偽裝成taskmgr.exe的隨身碟蠕蟲...;不過原本的敘述其他部分不見了
process, close, explorer.exe
process, close, explorer.exe
process, close, explorer.exe

process, close, explorer.exe
process, close, explorer.exe
Run,explorer.exe
ExitApp



SwitchToDesktop(newDesktop)
{
   global

   if (curDesktop <> newDesktop)
   {
      GetCurrentWindows(curDesktop)



      ShowHideWindows(curDesktop, false)
      ShowHideWindows(newDesktop, true)

      curDesktop := newDesktop

      Send, {ALT DOWN}{TAB}{ALT UP}
   }

   WinClose, ahk_class SysShadow
   ShowBanner("Desktop: " newDesktop)

   return
}


SendToDesktop(windowID, newDesktop)
{
   global
   RemoveWindowID(curDesktop, windowID)


   windows%newDesktop% += 1
   i := windows%newDesktop%

   windows%newDesktop%%i% := windowID

   WinHide, ahk_id %windowID%


   Send, {ALT DOWN}{TAB}{ALT UP}
}


SendActiveToDesktop(newDesktop)
{
   WinGet, id, ID, A
   SendToDesktop(id, newDesktop)
}


RemoveWindowID(desktopIdx, ID)
{
   global
   Loop, % windows%desktopIdx%
   {
      if (windows%desktopIdx%%A_Index% = ID)
      {
         RemoveWindowID_byIndex(desktopIdx, A_Index)
         Break
      }
   }
}


RemoveWindowID_byIndex(desktopIdx, ID_idx)
{
   global
   Loop, % windows%desktopIdx% - ID_idx
   {
      idx1 := % A_Index + ID_idx - 1
      idx2 := % A_Index + ID_idx
      windows%desktopIdx%%idx1% := windows%desktopIdx%%idx2%
   }
   windows%desktopIdx% -= 1

}


GetCurrentWindows(index)
{
   global
   WinGet, windows%index%, List,,, Program Manager


   Loop, % windows%index%
   {
      id := % windows%index%%A_Index%

      WinGetClass, windowClass, ahk_id %id%
      if windowClass = Shell_TrayWnd
      {
         RemoveWindowID_byIndex(index, A_Index)
         Break
      }
   }
}


ShowHideWindows(index, show)
{
   global

   Loop, % windows%index%
   {
      id := % windows%index%%A_Index%

      if show
         WinShow, ahk_id %id%
      else
         WinHide, ahk_id %id%
   }
}

ShowBanner(Text)
{
    global
    Trans := 255

    GuiControl, Text, String, % Text
    Gui, Show, x895 y677 h24 w92 NoActivate, explorer.exe
    WinSet, Transparent, %Trans%, explorer.exe
    Sleep 500

    Loop
    {
        if(Trans <= 0)
        {
            Trans := 0
            WinSet, Transparent, %Trans%, explorer.exe
            break
        }

        WinSet, Transparent, %Trans%, explorer.exe
        Trans := Trans - 5
        Sleep, 10
    }

    return
}


CleanUp:
Loop, %numDesktops%
   ShowHideWindows(A_Index, true)
ExitApp

Shift & MButton::
Menu,SigleMenu,Add,桌面 1,!1
Menu,SigleMenu,Add,桌面 2,!2
Menu,SigleMenu,Add,桌面 3,!3
Menu,SigleMenu,Add,桌面 4,!4
Menu,SigleMenu,Add,桌面 5,!5
Menu,SigleMenu,Add,桌面 6,!6
Menu,SigleMenu,Add,桌面 7,!7
Menu,SigleMenu,Add,桌面 8,!8
Menu,SigleMenu,Add,桌面 9,!9
Menu,DeskTo,Add,桌面 [1],^!1
Menu,DeskTo,Add,桌面 [2],^!2
Menu,DeskTo,Add,桌面 [3],^!3
Menu,DeskTo,Add,桌面 [4],^!4
Menu,DeskTo,Add,桌面 [5],^!5
Menu,DeskTo,Add,桌面 [6],^!6
Menu,DeskTo,Add,桌面 [7],^!7
Menu,DeskTo,Add,桌面 [8],^!8
Menu,DeskTo,Add,桌面 [9],^!9
Menu,SigleMenu,Add,加入到,:DeskTo
Menu,DeskTools,Add,notepad.exe,^1
Menu,DeskTools,Add,mspaint.exe,^2
Menu,DeskTools,Add,calc.exe,^3
Menu,DeskTools,Add,q-dir.exe,^4
Menu,DeskTools,Add,cmd.exe,^5
Menu,DeskTools,Add,taskmgr.exe,^
Menu,DeskTools,Add,compmgmt.msc,^f1
Menu,DeskTools,Add,userpasswords,^f2
Menu,SigleMenu,Add,工具,:DeskTools
Menu,SigleMenu,Show
return

Shift & RButton::


ControlGet,OutputVar,Visible,,Button2,ahk_class Shell_TrayWnd
if OutputVar
ControlClick, Button2, ahk_class Shell_TrayWnd
return

QDIR:
traytip,,Q-DIR 不存在 `n 就無法執行
ToolTip,Q-DIR 不存在 `n 就無法執行
IfExist,%A_WinDir%system32Q-DIR.exe
Run,%A_WinDir%system32Q-DIR.exe
ToolTip, Off
Return


Ctrl & RButton::
traytip,, 你好 我是作者zmac2007`n按Ctrl+滑鼠右鍵,選擇目錄
FileCount:=0
FileSelectFolder, OutputVar, , 3
GOTO Initial
Return

Initial:
traytip,,文件 `n %OutputVar%
Loop, %OutputVar%*.*


{
FileCount++
File_%FileCount%:=A_LoopFileLongPath
}

Loop %FileCount%
{
ButtonName:=File_%A_index%
Gui,Add,Button,gRunFile,%ButtonName%
}


Gui,Show,, %OutputVar%



Sleep,5000
Gui, Destroy

Return

RunFile:
MouseGetPos,,,,Bcontrol
StringTrimLeft,ButtonNum,Bcontrol,6
RunFileName:=File_%ButtonNum%
Run,%RunFileName%
Return


!MButton::
BlockInput,off
SetWinDelay,0
IfWinExist,ahk_class Progman
{
  WinHide,ahk_class Progman
  WinHide,Start ahk_class Button
}
Else
{
  WinShow,ahk_class Progman
  WinShow,Start ahk_class Button
}
Return

ALT & RButton::
SetWinDelay,0
IfWinExist,ahk_class Shell_TrayWnd
{
  WinHide,ahk_class Shell_TrayWnd
  WinHide,Start ahk_class Button
}
Else
{
  WinShow,ahk_class Shell_TrayWnd
  WinShow,Start ahk_class Button
}
Return
================



~Esc::

Keywait, Escape, , t0.5
if errorlevel = 1
return
else
Keywait, Escape, d, t0.1
if errorlevel = 0
{
send ^c
sleep,200
clipboard = %clipboard%
traytip,,取得完整路徑和檔名,`n %clipboard%。
}
return


~Capslock::
Keywait, Capslock, , t0.3
if errorlevel = 1
return
else
Keywait, Capslock, d, t0.3
if errorlevel = 0
{
send,#d
}
return



show := 0
Return
Ctrl::  ;連按兩下
If ( A_ThisHotkey=A_PriorHotkey && A_TimeSincePriorHotkey<270 )
   If !show
      Run,cleanmgr.exe
   Else
      Run,LeiesPen.exe
Return


~ALT::
Keywait, ALT, , t0.3
if errorlevel = 1

return
else
Keywait, ALT, d, t0.1
if errorlevel = 0
{
IfExist,%A_WinDir%system32winmaster.exe
Run,%A_WinDir%system32winmaster.exe
return
}
return

#P::
BlockInput,on
SplashTextOn,250,170,`n解鎖~輸入 zmac2007 按[Enter]`
return

+f9::
If value8 = 0
value8 = 1
Else
value8 = 0
RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE, SYSTEMCurrentControlSetControlStorageDevicePolicies, WriteProtect, %Value8%

WinGetClass, eh_Class,A
send, {F5}
PostMessage, 0x111, 28931,,, A
traytip,,可寫0/只讀1 USB裝置,請重新拔出插入 `n %value8%
return

+f10::
If value9 = 3
value9 = 4
Else
value9 = 3
RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE, SYSTEMCurrentControlSetServicesUsbStor, Start, %Value9%

WinGetClass, eh_Class,A
send, {F5}
PostMessage, 0x111, 28931,,, A

traytip,,開啟3/關閉4 USB裝置,請重新拔出插入 `n %value9%
return

+f11::
BlockInput,on
traytip,,滑鼠上鎖
return

+f12::
BlockInput,off
traytip,,滑鼠解鎖
return

::fuck::
BlockInput,off
Run, %ComSpec% /c  shutdown.exe -a,, hide
traytip,,你好 我是zmac2007,這個fuck功能還沒有寫好,請看說明
Gui, destroy
GoSub,GuiWin0
return

::ggyy::
BlockInput,on
Run, %ComSpec% /c  shutdown.exe -a,, hide
traytip,,你好 我是zmac2007
return

::zmac2007::
SplashTextOff
BlockInput,off
Run, %ComSpec% /c  shutdown.exe -a,, hide
traytip,,你好 我是zmac2007,已解除[黑暗模式]及 [滑鼠上鎖]
return

GuiWin0:
Menu,Tray,Nostandard
Gui,+owner +AlwaysOnTop
Gui, Add, Button, x6 y7 w65 h30 gButton1, 建立用戶
Gui, Add, Button, x80 y7 w65 h30 gButton2, 啟用帳戶

Gui, Add, Button, x150 y7 w65 h30 gButton3, 禁用帳戶
Gui, Add, Button, x220 y7 w65 h30 gButton4,  刪除用戶
Gui, Add, Button, x300 y7 w70 h30 gButton5, 用戶桌面
Gui, Add, Button, x380 y7 w80 h30 gButton6, 用戶文件夾
Gui, Add, Button, x470 y7 w60 h30 gButton7, 說明
Gui, Add, CheckBox, x546 y7 w70 h30 , 視窗致頂

Gui, Show, x273 y619 h47 w629, 目標 C碟,建立 WIN7訪客 帳戶zmac2007 密碼123456
Return

Button1:
MsgBox, , winlogon.exe,建立zmac2007帳戶,但暫時先禁用zmac2007帳戶
RunWait, %comspec% /c net user zmac2007 123456 /add && net localgroup administrators asd /add && net user asd /active:no && -logoff, , min
traytip,,有權限就建立zmac2007帳戶,`n 並立即取得最高權限,`n 但暫時先禁用zmac2007帳戶
return

Button2:
MsgBox, , winlogon.exe,如果zmac2007帳戶存在,啟用zmac2007帳戶
RunWait, %comspec% /c net user zmac2007 /active:yes && -logoff, , min
traytip,,如果zmac2007帳戶存在,啟用zmac2007帳戶
return

Button3:
MsgBox, , winlogon.exe,如果zmac2007帳戶存在,禁用zmac2007帳戶
RunWait, %comspec% /c net user asd /active:no && -logoff, , min
traytip,,如果zmac2007帳戶存在,禁用zmac2007帳戶

return

Button4:
MsgBox, , winlogon.exe,如果zmac2007帳戶存在,刪除zmac2007帳戶和zmac2007目錄資料
RunWait, %comspec% /c net user zmac2007 /delete && -logoff, , min
RunWait, %comspec% /c rd/s/q "c:userzmac2007" && -logoff, , min
RunWait, %comspec% /c rd/s/q "C:Documents and Settingszmac2007" && -logoff, , min
traytip,,如果zmac2007帳戶存在,刪除zmac2007帳戶和zmac2007目錄資料
return

Button5:
RunWait, %comspec% /c runas /profile /user:ourcomputerzmac2007 "explorer.exe" && -logoff
traytip,,如果zmac2007帳戶存在,以zmac2007帳號執行explorer.exe
return

Button6:
Run ::{450D8FBA-AD25-11D0-98A8-0800361B1103}
return

Button7:
Gui, destroy
traytip,,你好 我是zmac2007`n這個fuck功能還沒有寫好 `n目前僅可刪除c:userzmac2007目錄 `n 應該沒人帳戶剛好叫 zmac2007
return



SHOWCALENDAR:
IfExist,%A_WinDir%system32Taskmgr.exe
Run,%A_WinDir%system32Taskmgr.exe
goto About
Return

menuD1:
SwitchToDesktop(1)

Return

menuD2:
SwitchToDesktop(2)
Return

menuD3:
SwitchToDesktop(3)
Return

menuD4:
SwitchToDesktop(4)
Return

menuD5:
SwitchToDesktop(5)
Return

menuD6:
SwitchToDesktop(6)
Return

menuD7:
SwitchToDesktop(7)
Return

menuD8:
SwitchToDesktop(8)
Return

menuD9:
SwitchToDesktop(9)
Return

desk:
Menu,desk,Show
Return

About:
traytip,,快速連按 2下 F1鍵,可看作者個人訊息
Gui,99:Destroy
Gui,99:Margin,5,2
Gui,99:Add,Picture,xm Icon1,%applicationname%.exe
Gui,99:Font,Bold
Gui,99:Add,Text,x+1 yp+3,%applicationname% 1.0 測試版 作者:zmac2007
Gui,99:Font
Gui,99:Add,Text,y+3, 1. Alt + 1~9 切換共九個桌面,Alt + 0 結束程式並還原桌面

Gui,99:Add,Text,y+3, [桌面左上角按滑鼠中鍵,黑暗模式,請輸入zmac2007後按Enter]
Gui,99:Add,Text,y+3, [桌面左上角按滑鼠右鍵,桌面九+靜音,請按 Alt+1 回到桌面一。
Gui,99:Add,Text,y+3,
Gui,99:Add,Text,y+3, 2. ALT+滑鼠中鍵=桌面黑螢幕(復原),ALT+右滑鼠鍵=工作列鬼隱(復原)
Gui,99:Add,Text,y+3, 3. Shift+滑鼠中鍵 切換桌面,Ctrl +滑鼠右鍵  快速顯示目錄檔案
Gui,99:Add,Text,y+7, 4.在桌面的左邊/右邊/上面/左下角/右下角,按滑鼠中鍵,執行程序。
Gui,99:Add,Text,y+3,Ctrl+1  notepad.exe  或在桌面左邊按滑鼠中鍵
Gui,99:Add,Text,y+3,Ctrl+2  mspaint.exe  或在桌面右邊按滑鼠中鍵
Gui,99:Add,Text,y+3,Ctrl+3  calc.exe     或在桌面上面按滑鼠中鍵
Gui,99:Add,Text,y+3,Ctrl+4  q-dir.exe    或在桌面左下角按滑鼠中鍵
Gui,99:Add,Text,y+3,Ctrl+5  cmd.exe      或在桌面右下角按滑鼠中鍵
Gui,99:Add,Text,y+3,Ctrl+  taskmgr.exe  或在桌面下邊按滑鼠中鍵
Gui,99:Add,Text,y+3,Ctrl+=  執行 explorer.exe ,Ctrl+-  結束 explorer.exe
Gui,99:Add,Text,y+7,Ctrl+F1  電腦管理     在桌面右上角邊按滑鼠右鍵
Gui,99:Add,Text,y+3,Ctrl+F2  帳戶工具     在桌面右上角邊按滑鼠中鍵

Gui,99:Add,Text,y+3,顯示隱藏 副檔名/一般檔/系統檔 (按 Alt+F1/F2/F3)
Gui,99:Add,Text,y+3,快速連按ESC鍵兩次,取得文件完整路徑,但不一定成功。
Gui,99:Add,Text,y+3,快速連按F8鍵兩次,執行簡易按鍵記錄 ,記錄在 桌面鍵盤記錄.log。
Gui,99:Add,Text,y+7,
Gui,99:Add,Text,y+3,快速連按Ctrl鍵兩次,快速連按Alt鍵兩次,也有作用。
Gui,99:Add,Text,y+3,
Gui,99:Show,,%applicationname% About
hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt")
OnMessage(0x200,"WM_MOUSEMOVE")
sleep,1000
traytip,,快速連按 2下 F1鍵,可看作者個人訊息
goto StartMenu
Return

StartMenu:
SMenuPrs=C:ProgramDataMicrosoftWindowsStart MenuPrograms  ;沒用到
SMenuPrs2=C:Userszmac2007AppDataRoamingMicrosoftWindowsStart MenuPrograms ;沒用到
Loop, C:ProgramDataMicrosoftWindowsStart MenuPrograms*, 2  ;一層文件夾
{
Filename_%FileCount%:=A_LoopFileName
fname:=Filename_%FileCount%
        Loop, C:ProgramDataMicrosoftWindowsStart MenuPrograms%fname%*.lnk   ;二層文件夾
        {

        ButtonName:=A_LoopFileName
        StringSplit, pos, ButtonName, `.
        Menu, %fname%, add, %pos1%, MenuHandler   ; 創建子菜單項。
        Menu, tray, add, %fname%, :%fname%  ; 創建父菜單項。
        }
}
Menu, tray, Add
Menu, Tray, Add, &回原設定, k_Menureload
Menu, Tray, Add, &退出軟體, k_MenuExit
Menu, Tray, NoStandard
return

MenuHandler:   ;運行程序
RunFileName = C:ProgramDataMicrosoftWindowsStart MenuPrograms%A_ThisMenu%%A_ThisMenuItem%.lnk
run, %RunFileName%
Return    ;重載
k_Menureload:
Reload
Sleep 1000 ; 如果成功,reload 將會在 Sleep 期間關閉這個實例,因此下一行命令將從不執行。
MsgBox, 4,, 腳本不能被重載。你想打開它來編輯嗎?
IfMsgBox, Yes, Edit
Return
k_MenuExit:   ;退出
RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE, SYSTEMCurrentControlSetServicesUsbStor, Start, 3
ExitApp
return


Exit:
RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE, SYSTEMCurrentControlSetServicesUsbStor, Start, 3
ExitApp
return






樓主熱門主題

該用戶從未簽到

升級   0%

發表於 2014-4-12 01:05 | 顯示全部樓層
語法跟au很像,但是看不懂捏qq
他寫的好亂喔

使用道具

該用戶從未簽到

升級   0%

發表於 2014-4-13 11:49 | 顯示全部樓層
這麼多程式碼,可能要先去翻一下AutoHotKey的文件說明了吧!

AutoHotKey看來與AutoIt有拼的樣子,一篇簡單的中文介紹:輕鬆學會彈指神功-揭露AutoHotkey絕技

使用道具

該用戶從未簽到

升級   50.5%

發表於 2014-4-14 08:28 | 顯示全部樓層
divale 發表於 2014-4-13 11:49
這麼多程式碼,可能要先去翻一下AutoHotKey的文件說明了吧!

AutoHotKey看來與AutoIt有拼的樣子 ...

AHK 算是老前輩了,算是最早期很多人用的腳本之一吧
只是他轉 EXE 都有 upx,對當時的防毒來說常常誤判(另外還有本身的鍵盤&滑鼠控制)

另,我看不懂這篇作者的問題在哪...
不知為何有時會延遲,之後駐點消失傳遞訊息,錯誤的造成如F7,F8.F9...自動連發訊息。

使用道具

奇摩女孩 該會員已被刪除
發表於 2015-2-6 10:19 | 顯示全部樓層
提示: 作者被禁止或刪除 內容自動屏蔽

使用道具

您需要登入後才可以回帖 登入 | 註冊

本版積分規則

小黑屋|Archiver|微剋多資訊(MicroDuo)

GMT+8, 2024-3-28 21:38

Discuz! X

© 2009-2023 Microduo

快速回覆 返回頂部 返回列表