MsgBox, 4, , Would you like to continue?
IfMsgBox, No
return
; Otherwise, the user picked yes.
MsgBox You pressed YES.
For more advanced tasks, use the Gui command to create custom data entry forms and user interfaces.
2/10/2011
Dialogue with 2 buttons with MsgBox, InputBox, etc.
The following example displays a dialog with two buttons (YES and NO):
2/09/2011
Autohide Desktop Icons when Desktop is not Active
Hide icons when desktop is not active. If you want to show icons, just click on them.
Tested and works ot Win7 x64.
Tested and works ot Win7 x64.
Check:
if (WinActive("ahk_class Progman"))
WinWaitNotActive, ahk_class Progman
else WinWaitActive, ahk_class Progman
Control, % WinActive("ahk_class Progman") ? "Show" : "Hide",, SysListView321, ahk_class Progman
Goto Check
RecentRun - Shows the most recently run programs
RecentRun shows the most recently run programs on the Start menu and in the tray.
Features:
- Sort alphabetically or by date and time.
- Lock individual shortcuts.
Features:
- Sort alphabetically or by date and time.
- Lock individual shortcuts.
;RecentRun.ahk
; Shows a list of the most recently run programs on the Start menu and in the tray
;Skrommel @2005
#SingleInstance,Force
AutoTrim,Off
BatchLines=-1
Gosub,READINI
RegRead,recentmenu,HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Start Menu
recentmenu=%recentmenu%\%shortcutdir%
FileCreateDir,%shortcutdir%
Gosub,UPDATEMENUS
Gosub,GETPROGRAMS
LOOP:
Sleep,100
oldprograms=%programs%
Gosub,GETPROGRAMS
If programs<>%oldprograms%
{
Gosub,CREATESHORTCUTS
Gosub,UPDATEMENUS
}
Goto,LOOP
GETPROGRAMS:
programs=
WinGet,winids,List,,,Program Manager
Loop,%winids%
{
StringTrimRight,winid,winids%a_index%,0
WinGet,program,ProcessName,ahk_id %winid%
Loop,HKEY_CURRENT_USER,Software\Microsoft\Windows\ShellNoRoam\MUICache,0,0
{
IfInString,A_LoopRegName,%program%
{
RegRead,info
path=%A_LoopRegName%
programs=%programs%%program%%A_Tab%%path%%A_Tab%%info%`n
Break
}
}
}
Sort,programs,U
Return
CREATESHORTCUTS:
Loop,Parse,programs,`n
{
IfNotInString,oldprograms,%A_LoopField%
{
StringSplit,split,A_LoopField,%A_Tab%
StringSplit,name,split1,`.
program=%name1%
path=%split2%
info=%split3%
StringGetPos,pos,path,@
If pos>=0
StringTrimLeft,path,path,1
StringGetPos,pos,path,`,
If pos>=0
StringMid,path,path,0,%pos%
StringGetPos,pos,path,`"
If pos>=0
{
StringTrimLeft,path,path,1
StringTrimRight,path,path,1
}
StringLower,program,program,T
StringRight,ext,path,3
FileGetAttrib,attributes,%shortcutdir%\%program% - %info%.lnk
IfNotInString,attributes,R
IfInString,extensions,%ext%
FileCreateShortcut,"%path%",%shortcutdir%\%program% - %info%.lnk
}
}
Return
UPDATEMENUS:
RegDelete,HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\%shortcutdir%,Order
FileRemoveDir,%recentmenu%,1
FileCreateDir,%recentmenu%
FileDelete,%recentmenu%\*.lnk
Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,RecentRun,REPEATLASTRUN
Menu,Tray,Add,
files=
Loop,%shortcutdir%\*.lnk
{
If sortbydate=1
files=%files%%A_LoopFileTimeModified%`t%A_LoopFileName%`n
Else
files=%files%%A_LoopFileName%`t%A_LoopFileName%`n
}
If sortbydate=1
Sort,files,R
Else
Sort,files
counter=0
Loop,parse,files,`n
{
If A_LoopField=
Continue
StringSplit,filearray,A_LoopField,%A_Tab%
FileGetShortcut,%shortcutdir%\%filearray2%,Target,Dir,,Description,Icon,IconNumber,RunState
FileGetAttrib,attributes,%shortcutdir%\%filearray2%
StringTrimRight,filename,filearray2,4
IfInString,attributes,R
{
FileCreateShortcut,%Target%,%recentmenu%\%filearray2%,%Dir%,,%Description%,%Icon%,,%IconNumber%,%RunState%
Menu,Tray,Add,%filename%,RUN
}
Else
If counter<%numberofshortcuts%
{
Menu,Tray,Add,%filename%,RUN
counter+=1
If sortbydate=1
{
FileCreateShortcut,%Target%,%recentmenu%\%counter% - %filearray2%,%Dir%,%Args%,%Description%,%Icon%,,%IconNumber%,%RunState%
}
Else
{
FileCreateShortcut,%Target%,%recentmenu%\%filearray2%,%Dir%,%Args%,%Description%,%Icon%,,%IconNumber%,%RunState%
; Menu,Tray,Add,%filename%,RUN
}
}
}
Menu,Tray,Add,
Menu,Tray,Add,&Settings,SETTINGS
Menu,Tray,Add,&Edit shortcuts,EDITSHORTCUTS
Menu,Tray,Add,&Delete shortcuts,DELETESHORTCUTS
Menu,Tray,Add,&Help,HELP
Menu,Tray,Add,&Quit,QUIT
Menu,Tray,Default,RecentRun
Return
RUN:
Run,%recentmenu%\%A_ThisMenuItem%.lnk
Return
REPEATLASTRUN:
Return
EDITSHORTCUTS:
Run,Explorer.exe %A_ScriptDir%\%shortcutdir%
Return
DELETESHORTCUTS:
FileRemoveDir,%recentmenu%,1
FileCreateDir,%recentmenu%
FileDelete,%recentmenu%\*.lnk
FileDelete,%shortcutdir%\*.lnk
Gosub,UPDATEMENUS
Return
SETTINGS:
Gosub,READINI
Run,RecentRun.ini
Return
HELP:
help=Shows a list of the most recently run programs on the Start menu and in the tray.
help=%help%`n
help=%help%`nThe tray menu:
help=%help%`n- Settings
help=%help%`n Opens the RecentRun.ini-file.
help=%help%`n Edit it to change the sort order, the number of shortcuts,
help=%help%`n and the name of the Start-menu folder.
help=%help%`n- Edit shortcuts
help=%help%`n Opens the folder containing the shortcuts.
help=%help%`n To make a shortcut permanent, write protect it.
help=%help%`n Right click on the shortcut, click the last menu item,
help=%help%`n click the first tab, tick the first check box, click OK.
help=%help%`n- Delete shortcuts
help=%help%`n Deletes the shortcut history.
help=%help%`n
help=%help%`nSkrommel @2005
MsgBox,0,RecentRun,%help%
help=
Return
READINI:
IfNotExist,RecentRun.ini
{
inifile=[Settings]
inifile=%inifile%`nsortbydate=1
inifile=%inifile%`nnumberofshortcuts=30
inifile=%inifile%`nshortcutdir=Recent
inifile=%inifile%`nextensions=.exe.com.cmd.bat.pif
FileAppend,%inifile%,RecentRun.ini
inifile=
}
IniRead,sortbydate,RecentRun.ini,Settings,sortbydate
IniRead,numberofshortcuts,RecentRun.ini,Settings,numberofshortcuts
IniRead,shortcutdir,RecentRun.ini,Settings,shortcutdir
IniRead,extensions,RecentRun.ini,Settings,extensions
Return
QUIT:
ExitApp
KBLP's bot (BGMAFIA BOT)
Hi, there I'm gonna show you one bgmafia bot, written on AutoHotkey.
Source Code - http://pastebin.com/aT1pzr3X
Download - http://www.mediafire.com/?dc5slm0wb4dii5l
Credits: KaratistBG, PWNMERCURY, Lynix, BoXeR
If the bot don't work, make your resolution on 1024x768.
Works only with Windows XP/Vista
Source Code - http://pastebin.com/aT1pzr3X
Download - http://www.mediafire.com/?dc5slm0wb4dii5l
Credits: KaratistBG, PWNMERCURY, Lynix, BoXeR
If the bot don't work, make your resolution on 1024x768.
Works only with Windows XP/Vista
Launching a program, document, URL, or shortcut
The Run command is used to launch a program, document, url ot shortcut. Now i'll show you some common examples:
Run Skype Run C:\My Documents\review4.doc Run C:\My Documents\My Shortcut.lnk Run www.google.bg Run mailto:example@exampledomain.com
A hotkey can be assigned to any of the above examples by including a hotkey label (I'll make a special post about hotkey label). In the first example below, the assigned hotkey is Win+N, while in the second it is Control+Alt+C:
#n::Run Notepad
^!c::Run calc.exe
If the program/document/url or shortcut is not integrated
with the system,
specify its full path to get it to launch:
Run %A_ProgramFiles%\Skype\Skype.exe
Basic
Working with AutoHotkey is not hard. In this tutorial i will show you how to create an example script. First you need to Download and install AutoHotkey. Then open your text browser and type example:
In the line above, the first character "#" stands for the Windows key; so #space means holding down the Windows key then pressing the spacebar to activate the hotkey. The :: means that the subsequent command should be executed whenever this hotkey is pressed, in this case to go to the Google web site. To try out this script, continue as follows:
#space::Run www.autohotkey-tutorials.blogspot.comand save ensuring that it ends in .ahk. For example: Page.ahk
In the line above, the first character "#" stands for the Windows key; so #space means holding down the Windows key then pressing the spacebar to activate the hotkey. The :: means that the subsequent command should be executed whenever this hotkey is pressed, in this case to go to the Google web site. To try out this script, continue as follows:
- Save and close the file.
- Double-click the file to launch it. A new icon appears in the taskbar notification area.
- Hold down the Windows key and press the spacebar. A web page opens in the default browser.
- To exit or edit the script, right-click the green "H" icon in the taskbar notification area. Or just type at the end of script:
Enter::Pausethis will just pause the script; if you press enter again, it will unpause.
2/08/2011
Contact
If you have problems or questions, tell me about at Email : rootbgis@gmail.com
Subscribe to:
Posts (Atom)