Does anyone have any starter code?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
omar
Posts: 540
Joined: 22 Oct 2015, 17:56

Does anyone have any starter code?

09 Jan 2018, 19:36

I've got a nice autokey assigned.
I type #ahk
And I get:

Code: Select all

#SingleInstance force
;===============================
/*
Put code details here.
*/
;===============================
MsgBox, ,, AutoHotKey now loaded and ready to be used, 0.5

; Start coding in the line below.

#F10::Reload ;<- Windows Key + F10 causes the script to reload itself
This Gives me a good headstart.

Anyone else have anything similar - hoping some of you will tell me about some other essential settings I might be missing.

Thanks.
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
Location: France
Contact:

Re: Does anyone have any starter code?

09 Jan 2018, 19:51

Hi omar,

Alternatively, you can customize the template lines - the template file is located @ C:\Windows\ShellNew\Template.ahk.
If your looking for interesting and relevant settings to implement to your template you might be interested in this thread: New AutoHotkey Script Template.

Hope this helps.
my scripts
omar
Posts: 540
Joined: 22 Oct 2015, 17:56

Re: Does anyone have any starter code?

09 Jan 2018, 20:08

@A_AhkUser thats just awesome :)
i knew there would be much more clever people out there
awesome
thanks
User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: Does anyone have any starter code?

09 Jan 2018, 20:57

I generally use (For the template file) this header:

Code: Select all

/*
	=========================================================================
	Title:							SomeTitle
	=========================================================================
	Description:					SomeDescription
	-------------------------------------------------------------------------
	AutoHotkey Version:				YourVersion
	Language:						YourLanguage
	Used Platform(s):				YourWindowsVersion
	Author:							YourUsername
	Contact information:			YourEmail

	|=======================================================================|
	|	Hotkeys:															|
	|		None															|
	|=======================================================================|
	=========================================================================
*/

#NoEnv
#SingleInstance Force
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#ErrorStdOut ; I use this for debugging in an IDE
Process, Priority,, H
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetWinDelay, -1
SetControlDelay, -1
SetDefaultMouseSpeed, 0
SendMode, Input
CoordMode, Mouse, Screen
SetWorkingDir, %A_ScriptDir%

[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat

User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Does anyone have any starter code?

09 Jan 2018, 22:27

My header hotstring currently specifies this:

Code: Select all

#SingleInstance force
ListLines, Off
#KeyHistory 0
Menu, Tray, Click, 1
#NoEnv
AutoTrim, Off
#UseHook

SplitPath, A_ScriptName,,,, vScriptNameNoExt
Menu, Tray, Tip, % vScriptNameNoExt
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
KuroiLight
Posts: 327
Joined: 12 Apr 2015, 20:24
Contact:

Re: Does anyone have any starter code?

09 Jan 2018, 23:19

since it looks like we're posting headers, heres mine:
most scripts:

Code: Select all

;<scriptname>
;Version: 1.0
;Author: KuroiLight/klomb
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;global script_conditional_param := "ahk_exe explorer.exe"
#Include %A_ScriptDIr%\includes\CommonCode.ahk
;#NoTrayIcon

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;<init code>

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
return
CommonCode.ahk

Code: Select all

;Common Code Library
;Version: -|-
;Author: KuroiLight/klomb
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#NoEnv
#KeyHistory 0
#SingleInstance, force
#Persistent
DetectHiddenWindows, On
ListLines, Off
SetTitleMatchMode, 2
SetWorkingDir, %A_ScriptDir%
CoordMode, Pixel, Screen
CoordMode, ToolTip, Screen
CoordMode, Mouse, Screen
Gui, +OwnDialogs
SetScriptTimeSlice(1)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

global A_ScriptNameNoExt := RegExReplace(A_ScriptName, "iDU)^(.*)\.(ahk|exe)$", "$1")
global A_SystemDriveLetter := SubStr(A_WinDir, 1, 1)
global A_UserDownloads := A_SystemDriveLetter . ":\Users\" . A_UserName . "\Downloads"
global A_ScriptPID := DllCall("GetCurrentProcessId")
global EXT_SCRIPT := 0x9501, EXT_RESPOND := 0x9502, WM_COPYDATA := 0x004A
global WM_WTSSESSION_CHANGE := 0x2b1, WTS_SESSION_LOCK := 0x7, WTS_SESSION_UNLOCK := 0x8, WM_QUERYENDSESSION := 0x11, WM_CLOSE := 0x0010
global A_ScriptStartTick := A_TickCount, A_ScriptStartDate := A_Now

OnMessage(WM_QUERYENDSESSION, "WM_CLOSE_MSGS")
OnMessage(WM_CLOSE, "WM_CLOSE_MSGS")
WM_CLOSE_MSGS(wParam, lParam) {
    ExitApp, 0
}

argn = %0%
Loop %argn%
    arg%A_Index% := %A_Index%

conditional_exit() {
    if(script_conditional_param)
        if(!WinExist(script_conditional_param))
            ExitApp, 0
}
if(script_conditional_param)
    SetTimer, conditional_exit, 500

;884 more lines...
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]
01/24/18
[/color]

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, jameswrightesq and 286 guests