Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

AutoHotkey Updater


  • Please log in to reply
2 replies to this topic
Newbie
  • Members
  • 10 posts
  • Last active: Oct 16 2005 04:16 AM
  • Joined: 20 Sep 2005
Finally I finished this! :lol: Code revised

Script updated date: 2005.10.13

Very simple function(but take me lot of time :oops: ):

#Auto check update for AHK when script launchs.
#Auto download update.
#Auto install downloaded AHK.
#Some Hotkeys related.

Download this script

; AutoHotkey Version: 1.0.38.03 
; Language:       English 
; Platform:       WinXP SP2 
; Author:         Newbie 
; 
; AutoHotkey Updater 
; 
; Script Function: 
;   Check Update of AutoHotkey. 
; Script Version: 
;   1.1

#SingleInstance ignore 

;############################### Customize Tray Icon ###############################
;###################################################################################
Menu, Tray, NoStandard 
Menu, tray, add,     &About,     BtnAbout 
Menu, tray, add,     &Info,      ShowBtnInfo 
Menu, tray, add,     &Check Now, BtnCheckN 
Menu, tray, add,     &Exit,      BtnExit 
Menu, Tray, Default, &Info 
Menu, tray, Tip,     AutoHotkey Updater 

;############################### Customize URL #####################################
;###################################################################################
UpdateUrl1      = http://home.tampabay.rr.com/kodi/ahk/AutoHotkeyInstall.exe
UpdateUrl2      = Future use
VersionUrl1     = http://www.autohotkey.com/download/CurrentVersion.txt
HomePageUrl     = http://www.autohotkey.com
DownloadPageUrl = http://www.autohotkey.com/download/

startnum = 10
Gosub, IniRead
Gosub, EnableHotkeys
Gosub, GetCurVer
Gosub, GetNewVer
Gosub, CheckINI

;############################### Get current version ###############################
;###################################################################################
GetCurVer:
RegRead, dir,    HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir 
RegRead, curver, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, Version 
FileGetVersion, filecurver,  %dir%\AutoHotkey.exe 
FileGetTime,    filecurdate, %dir%\AutoHotkey.exe 

If dir = 
    dir = Unknown 
If curver = 
    curver = Unknown 
If filecurver = 
    filecurver = Unknown 
If filecurdate = 
    filecurdate = Unknown 
    
FormatTime, filecurdate, %filecurdate%, yyyyMMMMdd HH:mm:ss 
Return

;############################### Get latest version ################################
;###################################################################################
GetNewVer:
startnum++
UrlDownloadToFile, %VersionUrl1%?num%startnum%, %TMP%\ver.txt
if ErrorLevel <> 0
  {
   ;Gosub, IniRead
   SplashImage, Off
   ;Gosub, EnableHotkeys
   newver  = Unknown
   newdate = Unknown
   newsize = Unknown
   SizeKB  = Unknown
   If BalloonOff = 0
       TrayTip, Error occured - AutoHotkey Updater, Error occured while attempt to connect Internet`nPlease assure that you have successfully connect Internet!, 10, 3
   IfWinExist, Error occured - AutoHotkey Updater
      {
       WinActivate
       WinWaitActive
       Exit
      }
   Else
      {
       MsgBox, 4116, Error occured - AutoHotkey Updater, Error occured while attempt to connect Internet`nPlease assure that you have successfully connect Internet!`n`nPress "Yes" and this script will exit.
           IfMsgBox, No
               Exit
           Else
               ExitApp
      }
  }
FileReadLine, newver,  %TMP%\ver.txt, 1 
FileReadLine, newdate, %TMP%\ver.txt, 2 
FileReadLine, newsize, %TMP%\ver.txt, 3 
/*  This maybe be useless
if ErrorLevel <> 0
  {
   Gosub, IniRead
   Gosub, EnableHotkeys
   If BalloonOff = 0
       TrayTip, Error occured - AutoHotkey Updater, File read error`nMaybe you should edit this script now!, 10, 3
       MsgBox, 4116, Error occured - AutoHotkey Updater, File read error`nMaybe you should edit this script now!`n`nPress "Yes" and this script will exit.
         IfMsgBox, Yes
           ExitApp
  }
*/
FormatTime, newdate,     %newdate%,     yyyyMMMMdd HH:mm:ss 
SizeKB = %newsize% 
SizeKB /=1024 
Return

;############################### Read INI file #####################################
;###################################################################################
CheckINI:
IfExist, Setting.ini
{
 ;Gosub, IniRead     
 ;Gosub, EnableHotKeys
 Gosub, CheckVer			  
 Gosub, GuiCtrl               
}
Else                          
  {
   kExit     = +X
   kHome     = +W
   kHelpFile = +H
   Gosub, IniCheckBoxReset
   Gosub, IniHotkeyReset
   ;Gosub, IniRead
   ;Gosub, EnableHotKeys
   Gosub, CheckVer               
   Gosub, GuiCtrl
  }
Return

IniRead:
FileSetAttrib, -R, Setting.ini
  IniRead, AutoRun,     Setting.ini, AutoDone, IfAutoRun,     0
  IniRead, AutoDown,    Setting.ini, AutoDone, IfAutoDown,    0
  IniRead, AutoInstall, Setting.ini, AutoDone, IfAutoInstall, 0
  IniRead, GUIOff,      Setting.ini, AutoDone, IfGUIOff,      0
  IniRead, BalloonOff,  Setting.ini, AutoDone, IfBalloonOff,  0
  IniRead, WPOS,        Setting.ini, AutoDone, IfWPOS,        1
  IniRead, kExit, 	    Setting.ini, Hotkey,   Exit,          +X
  IniRead, kHome,       Setting.ini, Hotkey,   Home,          +W
  IniRead, kHelpFile,   Setting.ini, Hotkey,   HelpFile,      +H
  IniRead, kSpy, 	    Setting.ini, Hotkey,   Spy,           +P
  IniRead, kWriter,     Setting.ini, Hotkey,   Writer,        +R
  IniRead, kAhk2Exe,    Setting.ini, Hotkey,   Ahk2Exe,       +E
  IniRead, Download2,   Setting.ini, Dir,      DownloadDir,   %dir%\update\
  IniRead, TabName,     Setting.ini, Tabs,     TabSelected,   1
  IniRead, TransDegree, Setting.ini, Trans,    TransDegree,   100
  IniRead, Xpos,        Setting.ini, Window,   X,             0
  IniRead, Ypos,        Setting.ini, Window,   Y,             0
  
    if AutoRun     not in -1,0,1
     {
      AutoRun     = 0 
      IniWrite, 0,     Setting.ini, AutoDone, IfAutoRun
     }
    if AutoDown    not in -1,0,1
     {
      AutoDown    = 0 
      IniWrite, 0,     Setting.ini, AutoDone, IfAutoDown
     }
    if AutoInstall not in -1,0,1
     {
      AutoInstall = 0 
      IniWrite, 0,     Setting.ini, AutoDone, IfAutoInstall
     }
    if AutoDown = 0
	 {
	  AutoInstall = 0
	  IniWrite, 0,     Setting.ini, AutoDone, IfAutoInstall
     }
    if GUIOff not in -1,0,1
     {
      GUIOff = 0 
      IniWrite, 0,     Setting.ini, AutoDone, IfGUIOff
     }
    if BalloonOff not in -1,0,1
     {
      BalloonOff = 0 
      IniWrite, 0,     Setting.ini, AutoDone, IfBalloonOff
     }
    if TransDegree not between 0 and 100
     {
      TransDegree = 100
      IniWrite, 100,   Setting.ini, Trans,    TransDegree
     }
    if WPOS = 0
     {
      Xpos = 300
      Ypos = 200
      IniWrite, %Xpos%, Setting.ini, Window, X
      IniWrite, %Ypos%, Setting.ini, Window, Y
     }
     
    if kExit = 
	   {
	    kExit     = +X
	    IniWrite, +X, Setting.ini, Hotkey, Exit
	   }
	if kHome = 
	   {
	    kHome     = +W
	    IniWrite, +W, Setting.ini, Hotkey, Home
	   }
	if kHelpFile = 
	   {
	    kHelpFile = +H
	    IniWrite, +H, Setting.ini, Hotkey, HelpFile
       }
    if kSpy = 
       {
        kSpy     = +P
        IniWrite, +P, Setting.ini, Hotkey, Spy
       }
    if kWriter = 
       {
        kWriter     = +R
        IniWrite, +R, Setting.ini, Hotkey, Writer
       }
    if kAhk2Exe = 
       {
        kAhk2Exe = +E
        IniWrite, +E, Setting.ini, Hotkey, Ahk2Exe
       }
FileSetAttrib, +R, Setting.ini
Return

IniWrite: 
FileSetAttrib, -R, Setting.ini
  IniWrite, %AutoRun%,     Setting.ini, AutoDone, IfAutoRun 
  IniWrite, %AutoDown%,    Setting.ini, AutoDone, IfAutoDown 
  IniWrite, %AutoInstall%, Setting.ini, AutoDone, IfAutoInstall 
  IniWrite, %GUIOff%,      Setting.ini, AutoDone, IfGUIOff
  IniWrite, %BalloonOff%,  Setting.ini, AutoDone, IfBalloonOff
  IniWrite, %WPOS%,        Setting.ini, AutoDone, IfWPOS
  IniWrite, %kExit%, 	   Setting.ini, Hotkey,   Exit 
  IniWrite, %kHome%,       Setting.ini, Hotkey,   Home 
  IniWrite, %kHelpFile%,   Setting.ini, Hotkey,   HelpFile 
  IniWrite, %kSpy%,        Setting.ini, Hotkey,   Spy
  IniWrite, %kWriter%,     Setting.ini, Hotkey,   Writer
  IniWrite, %kAhk2Exe%,    Setting.ini, Hotkey,   Ahk2Exe
  IniWrite, %Download2%,   Setting.ini, Dir,      DownloadDir 
  IniWrite, %TabSelected%, Setting.ini, Tabs,     TabSelected
  IniWrite, %TransDegree%, Setting.ini, Trans,    TransDegree
FileSetAttrib, +R, Setting.ini
Return 

IniHotkeyReset:
FileSetAttrib, -R, Setting.ini
  IniWrite, +X, Setting.ini, Hotkey, Exit
  IniWrite, +W, Setting.ini, Hotkey, Home
  IniWrite, +H, Setting.ini, Hotkey, HelpFile
  IniWrite, +P, Setting.ini, Hotkey, Spy
  IniWrite, +R, Setting.ini, Hotkey, Writer
  IniWrite, +E, Setting.ini, Hotkey, Ahk2Exe
FileSetAttrib, +R, Setting.ini
Return

IniCheckBoxReset:
FileSetAttrib, -R, Setting.ini
  IniWrite, 0, Setting.ini, AutoDone, IfAutoRun
  IniWrite, 0, Setting.ini, AutoDone, IfAutoDown
  IniWrite, 0, Setting.ini, AutoDone, IfAutoInstall
  IniWrite, 0, Setting.ini, AutoDone, IfGUIOff
  IniWrite, 0, Setting.ini, AutoDone, IfBalloonOff
IniWrite, 1, Setting.ini, AutoDone, IfWPOS
FileSetAttrib, +R, Setting.ini
Return

;############################### Show main GUI(If no error) ########################
;###################################################################################
CheckVer:
SplashImage, Off
   If curver = Unknown
     {
       If filecurver = Unknown
         {   
         Gosub, NotFound
         }
       Else
        {
         curver = %filecurver%
         ;Gosub, DisableHotKeys
           If GUIOff <> 0
             Gosub, update
           Else
             {
              Gosub, update
              Gosub, BtnInfo
             }
        }
     }
   Else if filecurver = Unknown
     {
      Gosub, NotFound
     }
   Else
     {
      ;Gosub, DisableHotKeys
      If GUIOff <> 0
	    Gosub, update
	  Else
	    {
         Gosub, update
         Gosub, BtnInfo
        }
     }
Return

;############################### Prompt error(If error occur) ######################
;###################################################################################
NotFound:
MsgBox, 20, Error, Can't detect the location of AutoHotkey`nPlease assure that you have install AutoHotkey correctly.`n`nDownload AutoHotkey now? 
   IfMsgBox, Yes
     Gosub, Download
   IfMsgBox, No
     ExitApp
Return

;############################### Checking update ###################################
;###################################################################################
update:
If newver = Unknown
	Gosub, GetNewVer
If newver > %curver%
{
   If AutoDown <> 0   
    {
     IfNotExist, %Download2%
        FileCreateDir, %Download2%
     If BalloonOff = 0
        TrayTip, Downloading, AutoHotkey's update available`nDownloading file to:%Download2%, 10, 1
     Else
        MsgBox, 64, Downloading, AutoHotkey's update available`nDownloading file to:`n%Download2%
     IfExist, %Download2%\AutoHotkeyInstall.exe
        FileDelete, %Download2%\AutoHotkeyInstall.exe
     UrlDownloadToFile, %UpdateUrl1%, %Download2%\AutoHotkeyInstall.exe
     If BalloonOff = 0
          TrayTip, Download Complete, Successfully download the latest version of AutoHotkey!, 10, 1
     Else
          MsgBox, 64, Download Complete, Successfully download the latest version of AutoHotkey to:`n%Download2%
     If AutoInstall <> 0
          Gosub, InstallAHK
    }
   Else
    {
     If BalloonOff = 0
       TrayTip, Update available, Updated version of AutoHotkey has been released, 10, 1
     MsgBox, 36, Update available!,`nThe latest version: %newver% has been released`, download it now?
        IfMsgBox, Yes
          Gosub, Download
     }
}
Else
  {
   If BalloonOff = 0
     TrayTip, Update unavailable, Current version: %newver% is already the latest version, 10, 1
   Else
     MsgBox, 64, Update unavailable, Current version: %newver% is already the latest version
  }
Return

;############################### Automate Installing ###############################
;###################################################################################
InstallAHK:
Process, Close, AU3_Spy.exe
Process, Close, AutoHotkey.exe
Process, Close, Ahk2Exe.exe
Process, Close, AutoScriptWriter.exe
IfWinExist, AutoHotkey Help
WinKill
Run, %Download2%\AutoHotkeyInstall.exe
WinWait, AutoHotkey %newver% Setup, 
IfWinNotActive, AutoHotkey %newver% Setup, , WinActivate, AutoHotkey %newver% Setup, 
WinWaitActive, AutoHotkey %newver% Setup, 
Send, {ALTDOWN}n{ALTUP}
WinWait, AutoHotkey %newver% Setup, License Agreement
IfWinNotActive, AutoHotkey %newver% Setup, License Agreement, WinActivate, AutoHotkey %newver% Setup, License Agreement
WinWaitActive, AutoHotkey %newver% Setup, License Agreement
Send, {ALTDOWN}a{ALTUP}
WinWait, AutoHotkey %newver% Setup, Choose Components
IfWinNotActive, AutoHotkey %newver% Setup, Choose Components, WinActivate, AutoHotkey %newver% Setup, Choose Components
WinWaitActive, AutoHotkey %newver% Setup, Choose Components
Send, {ALTDOWN}n{ALTUP}
WinWait, AutoHotkey %newver% Setup, Choose Install Location
IfWinNotActive, AutoHotkey %newver% Setup, Choose Install Location, WinActivate, AutoHotkey %newver% Setup, Choose Install Location
WinWaitActive, AutoHotkey %newver% Setup, Choose Install Location
Send, {ALTDOWN}i{ALTUP}
WinWait, AutoHotkey, Completing
IfWinNotActive, AutoHotkey, Completing, WinActivate, AutoHotkey, Completing
WinWaitActive, AutoHotkey, Completing
Send, {SPACE}{ALTDOWN}f{ALTUP}
If BalloonOff = 0
  {
   TrayTip, Install Complete, Successfully install the latest version of AutoHotkey!, 10, 1
   Sleep, 10000
  }
Else
  {
   MsgBox, 64, Install Complete, Successfully install the latest version of AutoHotkey!
   Sleep, 1000
  }
Reload
Return

;############################### Label of "About" GUI ##############################
;###################################################################################
BtnAbout:
Gui, -0x20000 
Gui, Add, Button, Default x79 y87 w59 h28 gConfirm, OK 
Gui, Add, Text, cBlue x16 y20 w190 h60 +Center, AutoHotkey Updater 1.1`n`nScripted by Newbie 
Gui, Show, h121 w229, About AutoHotkey Updater 
Return 

;############################### Other labels' function ############################
;###################################################################################
ShowBtnInfo:
Gosub, IniRead
Gosub, DisableHotKeys
IfWinNotExist, AutoHotkey Info
  {
   Gosub, BtnInfo
   Gosub, GuiCtrl
  }
Else
 {
  WinWait, AutoHotkey Info, 
  IfWinNotActive, AutoHotkey Info, , WinActivate, AutoHotkey Info, 
  WinWaitActive,  AutoHotkey Info, 
  }
Return

BtnCheckN:
Gosub, GetNewVer
Gosub, update
Return

BtnExit: 
#x::
HotkeyExit:
ExitApp 

;############################### Main GUI customize ################################
BtnInfo: 
Gui, 2:Add, Tab, x7 y10 w420 h332 Section AltSubmit Choose%TabName% vTabSelected, Info|Setting1|Setting2
  Gui, 2:Tab, Info 
    Gui, 2:Add, GroupBox, x16 y50 w400 h110,                Current Version 
    Gui, 2:Add, GroupBox, x16 y170 w400 h110,               Latest Version 
    Gui, 2:Add, Text,     x26 y70 w130 h20 +Left,           AHK's Location: 
    Gui, 2:Add, Text,     x26 y100 w130 h20 +Left,          Current Version: 
    Gui, 2:Add, Text,     x26 y130 w130 h20 +Left,          File Date: 
    Gui, 2:Add, Text,     x26 y190 w130 h20 +Left,          Latest Version: 
    Gui, 2:Add, Text,     x26 y220 w130 h20 +Left,          Release Date: 
    Gui, 2:Add, Button,   Default x346 y300 w70 h30 gClose, &Close 
    Gui, 2:Add, Button,   x26 y300 w70 h30 gDownload,       &Download 
    Gui, 2:Add, Button,   x116 y300 w110 h30 gDownWeb,      Download &Page 
    Gui, 2:Add, Button,   x246 y300 w80 h30 gHomepage,      &Home Page 
    Gui, 2:Add, Text,     x26 y250 w130 h20 +Left,          File's Size: 
    Gui, 2:Add, Edit,     ReadOnly x166 y70 w240 h20,       %dir% 
    Gui, 2:Add, Text,     x166 y100 w240 h20,               %curver% 
    Gui, 2:Add, Text,     x166 y130 w240 h20, 		        %filecurdate% 
    Gui, 2:Add, Text,     x166 y190 w240 h20, 				%newver% 
    Gui, 2:Add, Text,     x166 y220 w240 h20, 				%newdate% 
    Gui, 2:Add, Text,     x166 y250 w240 h20, 				%SizeKB% KB 
  Gui, 2:Tab, Setting1
    Gui, 2:Add, GroupBox, x16 y50 w400 h110,                                     Auto Done 
    Gui, 2:Add, GroupBox, x16 y170 w400 h110,				                     Hotkeys 
    Gui, 2:Add, Text, x26 y190 w130 h20 +Left,				                     Exit: 
    Gui, 2:Add, Text, x26 y220 w130 h20 +Left,				                     Visit AHK's Home: 
    Gui, 2:Add, Text, x26 y250 w130 h20 +Left,				                     Open HelpFile: 
    Gui, 2:Add, Button, Default x346 y300 w70 h30 gClose,                        &Close 
    Gui, 2:Add, Button, x26 y300 w70 h30 gApply1, 			                     &Apply 
    Gui, 2:Add, Button, x376 y100 w30 h20 gBrowse, 			                     ... 
    Gui, 2:Add, Button, x116 y300 w70 h30 gReset1, 			                     &Reset 
    Gui, 2:Add, Checkbox, x26 y70 w210 h20 vAutoRun gAutoRunL,                   AutoRuns at system startup        
    Gui, 2:Add, Checkbox, x26 y100 w112 h20 vAutoDown gAutoDownL,                Auto Download: 
    Gui, 2:Add, Checkbox, Disabled x26 y130 w240 h20 vAutoInstall gAutoInstallL, Auto install after download finished 
    Gui, 2:Add, Edit, x146 y100 w220 h20 vDownload2 gDownload2L,                 %dir%\update\ 
    Gui, 2:Add, Hotkey, x146 y187 w240 h20 vkExit gKExit Limit1,                 +X 
    Gui, 2:Add, Hotkey, x146 y217 w240 h20 vkHome gKHome Limit1,                 +W
    Gui, 2:Add, Hotkey, x147 y248 w240 h20 vkHelpFile gKHelpFile Limit1,         +H
  Gui, 2:Tab, Setting2
    Gui, 2:Add, Slider,   x16 y60 w400 h25 AltSubmit ToolTipLeft vTransDegree gTrans, %TransDegree%
    Gui, 2:Add, Text,     x16 y40 w90 h20,                     	                      Transparent: 
    Gui, 2:Add, Checkbox, x16 y90 w190 h25 vGUIOff gGUIOffL,                          Never display this window again
    Gui, 2:Add, Checkbox, x16 y120 w190 h25 vBalloonOff gBalloonOffL,                 Disable BalloonTip, use common dialog box instead
    Gui, 2:Add, Checkbox, x226 y90 w190 h25 Checked vWPOS gWPOSL,                     Remember the position of this window
    Gui, 2:Add, GroupBox, x16 y150 w400 h130,               	                      AHK-tools' Hotkeys
    Gui, 2:Add, Text,     x26 y183 w150 h20,                  	                      Run AutoIt3 Window Spy:
    Gui, 2:Add, Text,     x26 y214 w150 h20,                	                      Run AutoScriptWriter:
    Gui, 2:Add, Text,     x26 y245 w150 h20,                                          Run Ahk2Exe:
    Gui, 2:Add, Hotkey,   x176 y180 w230 h20 vkSpy gKSpy Limit1,                      +P
    Gui, 2:Add, Hotkey,   x176 y210 w230 h20 vkWriter gKWriter Limit1,   	          +R
    Gui, 2:Add, Hotkey,   x176 y240 w230 h20 vkAhk2Exe gKAhk2Exe Limit1, 	          +E
    Gui, 2:Add, Button,   x26 y300 w70 h30 gApply2, 			 	                  &Apply
	Gui, 2:Add, Button,   x116 y300 w70 h30 gReset2, 			  	                  &Reset
	Gui, 2:Add, Button,   Default x346 y300 w70 h30 gClose,       	                  &Close
Gui, 2:Show, x%Xpos% y%Ypos% h352 w435, AutoHotkey Info 
Return 

GuiCtrl:
Gosub, IniRead
Gosub, Trans
GuiControl, 2:, msctls_trackbar321, %TransDegree%
GuiControl, 2:, Button13,           %AutoRun% 
GuiControl, 2:, Button14,           %AutoDown%
GuiControl, 2:, Button15,           %AutoInstall%
GuiControl, 2:, Button16,           %GUIOff%
GuiControl, 2:, Button17,           %BalloonOff%
GuiControl, 2:, Button18,           %WPOS%
GuiControl, 2:, msctls_hotkey321,   %kExit% 
GuiControl, 2:, msctls_hotkey322,   %kHome%
GuiControl, 2:, msctls_hotkey323,   %kHelpFile%
GuiControl, 2:, msctls_hotkey324,   %kSpy% 
GuiControl, 2:, msctls_hotkey325,   %kWriter%
GuiControl, 2:, msctls_hotkey326,   %kAhk2Exe%
GuiControl, 2:, Download2,          %Download2%
If AutoDown in -1,1
  GuiControl, 2:Enable, Button15,
Return

Trans:
TransD := TransDegree*2.55
WinSet, Transparent, %TransD%, AutoHotkey Info
GuiControl, 2:Enable, Button19
GuiControl, 2:Enable, Button20
Return

EnableHotKeys: 
  Hotkey, %kExit%,     HotkeyExit,     On 
  Hotkey, %kHome%,     HotkeyHome,     On 
  Hotkey, %kHelpFile%, HotkeyHelpFile, On 
  Hotkey, %kSpy%,      HotkeySpy,      On 
  Hotkey, %kWriter%,   HotkeyWriter,   On 
  Hotkey, %kAhk2Exe%,  HotkeyAhk2Exe,  On
  If ErrorLevel
    {
     Gosub, IniHotkeyReset
     Gosub, EnableHotkeys
    }
Return 

DisableHotKeys: 
  Hotkey, %kExit%,     Off
  Hotkey, %kHome%,     Off
  Hotkey, %kHelpFile%, Off
  Hotkey, %kSpy%,      Off 
  Hotkey, %kWriter%,   Off
  Hotkey, %kAhk2Exe%,  Off
Return 

Confirm: 
GuiClose: 
GuiEscape: 
  Gui, Destroy 
Return 

Close: 
2GuiClose: 
2GuiEscape: 
  Gui, 2:Submit, NoHide
  WinGetPos, Xpos, Ypos, , , AutoHotkey Info
  Gui, Destroy
  FileSetAttrib, -R, Setting.ini
  IniWrite, %TabSelected%, Setting.ini, Tabs, TabSelected 
  IniWrite, %Xpos%,        Setting.ini, Window, X
  IniWrite, %Ypos%,        Setting.ini, Window, Y
  FileSetAttrib, +R, Setting.ini
  Gosub, IniRead
  Gosub, EnableHotKeys
Return 

Apply1:
Gui, 2:Submit, NoHide 
GuiControl, 2:Disable, Button10
  If AutoRun <> 0
      RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Run, AHKUpdater, %A_ScriptFullPath%
  Else
      RegDelete, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Run, AHKUpdater
Gosub, IniWrite 
Return 

Apply2:
FileSetAttrib, -R, Setting.ini
IniRead, TransDformer, Setting.ini, Trans, TransDegree, 100
FileSetAttrib, +R, Setting.ini
Gui, 2:Submit, NoHide
If TransDegree < 20
 {
  Gui 2:+OwnDialogs
  MsgBox, 4148, Warning, The TransDegree you are going to apply is too low.`nand there will be NO easy way to reach this window next time.`n`nContinue anyway?
    IfMsgBox, No
      {
       TransDegree = %TransDformer%
       Gosub, Trans
       GuiControl, 2:, msctls_trackbar321, %TransDegree%
       Return
      }
 }
GuiControl, 2:Disable, Button20
Gosub, IniWrite
Return

Reset1:
GuiControl, 2:, Button13, 0 
GuiControl, 2:, Button14, 0 
GuiControl, 2:, Button15, 0 
GuiControl, 2:, msctls_hotkey321, +X 
GuiControl, 2:, msctls_hotkey322, +W 
GuiControl, 2:, msctls_hotkey323, +H
GuiControl, 2:, Download2,        %dir%\update\ 
Gui, 2:Submit, NoHide 
Sleep, 100 
GuiControl, 2:Disable, Button12
Gosub, IniWrite 
Return 

Reset2:
GuiControl, 2:, Button16,           0
GuiControl, 2:, Button17, 		    0
GuiControl, 2:, msctls_hotkey324,   +P
GuiControl, 2:, msctls_hotkey325,   +R
GuiControl, 2:, msctls_hotkey326,   +E
GuiControl, 2:, msctls_trackbar321, 255
Gui, 2:Submit, NoHide
Gosub, Trans
Sleep, 100 
GuiControl, 2:Disable, Button21
Gosub, IniWrite
Return
AutoRunL: 
AutoDownL: 
AutoInstallL: 
Download2L: 
KExit: 
KHome: 
KHelpFile: 
Gui, 2:Submit, NoHide
If AutoDown in -1,1
  GuiControl, 2:Enable, Button15,   
Else
  GuiControl, 2:Disable, Button15,
GuiControl, 2:Enable, Button10
GuiControl, 2:Enable, Button12
Return 

GUIOffL:
WPOSL:
KSpy:
KWriter:
KAhk2Exe:
Gui, 2:Submit, NoHide
GuiControl, 2:Enable, Button20
GuiControl, 2:Enable, Button21
Return

BalloonOffL:
Gui, 2:Submit, NoHide
If BalloonOff <> 0
 {
  Gui 2:+OwnDialogs
  MsgBox, 52, Warning, Once you disable balloontip the script will inform you by dialog box,`nand this may bother you from working.`n`nStill need to disable balloontip?
    IfMsgBox, No
      GuiControl, 2:, Button17, 0
 }
GuiControl, 2:Enable, Button20
GuiControl, 2:Enable, Button21
Return

Browse: 
GuiControlGet, Download2, , Edit2
IfNotExist, %Download2%\update\
   opendir = %Download2%
Else
   opendir = %Download2%\update\
FileSelectFolder, UpdateDir, *%opendir%, 3, Download update to: 
if UpdateDir = 
    ControlSetText, Edit2, %Download2%, AutoHotkey Info 
Else 
   {
    ControlSetText, Edit2, %UpdateDir%, AutoHotkey Info 
    GuiControl, 2:Enable, Button10
   }    
GuiControl, 2:Enable, Button12
Return 

HelpFile: 
HotkeyHelpFile:
  IfWinExist, AutoHotkey Help
     {
      WinActivate
      WinWaitActive
     }
  Else IfExist, %dir%\AutoHotkey.chm
    Run, %dir%\AutoHotkey.chm
  Else
    MsgBox, 20, Error, Help file missed.`nPlease assure that you have installed AutoHotkey correctly.`n`nDownload AutoHotkey now? 
	   IfMsgBox, Yes
          Gosub, Download
Return 

Spy:
HotkeySpy:
  IfWinExist, Active Window Info
     {
      WinActivate
      WinWaitActive
     }
  Else IfExist, %dir%\AU3_Spy.exe
    Run, %dir%\AU3_Spy.exe
  Else
    MsgBox, 20, Error, AutoIt3 Window Spy missed.`nPlease assure that you have installed AutoHotkey correctly.`n`nDownload AutoHotkey now?
	   IfMsgBox, Yes
          Gosub, Download
Return

Writer:
HotkeyWriter:
  IfWinExist, AutoScriptWriter
     {
      WinActivate
      WinWaitActive
     }
  Else IfExist, %dir%\AutoScriptWriter\AutoScriptWriter.exe
    Run, %dir%\AutoScriptWriter\AutoScriptWriter.exe
  Else
    MsgBox, 20, Error, AutoScriptWriter missed.`nPlease assure that you have installed AutoHotkey correctly.`n`nDownload AutoHotkey now? 
	   IfMsgBox, Yes
          Gosub, Download
Return

Ahk2Exe:
HotkeyAhk2Exe:
  IfWinExist, Ahk2Exe
     {
      WinActivate
      WinWaitActive
     }
  Else IfExist, %dir%\Compiler\Ahk2Exe.exe
    Run, %dir%\Compiler\Ahk2Exe.exe
  Else
    MsgBox, 20, Error, Ahk2Exe missed.`nPlease assure that you have installed AutoHotkey correctly.`n`nDownload AutoHotkey now? 
	   IfMsgBox, Yes
          Gosub, Download
Return

Download: 
Run, %UpdateUrl1%
Return 

DownWeb: 
Run, %DownloadPageUrl% 
Return 

HotkeyHome:
Homepage: 
Run, %HomePageUrl% 
Return  


35000vr
  • Guests
  • Last active:
  • Joined: --
Very nice job even though it took you a while. :wink:

codybear - notloggedin
  • Guests
  • Last active:
  • Joined: --
that's pretty cool.
might use this in my constant script.