Snippets Collections
SWITCH(
  {Work Type},
  "WAE - Club Booked", (MAX({Revenue} - 125, 0)*.2) + 125,
  "WAE - Club Not Booked", ({Revenue}*.4),
  {Custom Rate}
)
local component = require("component")
component.eeprom.set("-- your BIOS code here")
/*
Control_AniGif.ahk

Add a AniGif control to your AHK Gui.
AniGif by akyprian: http://www.winasm.net/forum/index.php?showtopic=279
From his source file:
;|AniGIF is a copyright of Antonis Kyprianou.                             |
;|                                                                        |
;|You can use AniGIF for NON commercial purposes provided you             |
;|have the following information on your application's about box:         |
;|AniGIF control is copyright of Antonis Kyprianou (http://www.winasm.net)|
;|                                                                        |
;|You need my WRITTEN permission to use AniGIF in commercial applications |

// by Philippe Lhoste <PhiLho(a)GMX.net> http://Phi.Lho.free.fr
// File/Project history:
 1.03.000 -- 2007/05/17 (PL) -- Total encapsulation.
 1.02.000 -- 2007/05/16 (PL) -- Changed functions names (thanks majkinetor), added more wrappers, freed correctly DLL.
 1.01.000 -- 2007/05/16 (PL) -- Update to 1.0.4.0 with WAGM_SETBKCOLOR.
 1.00.000 -- 2007/05/16 (PL) -- Creation.
*/
/* Copyright notice: For details, see the following file:
http://Phi.Lho.free.fr/softwares/PhiLhoSoft/PhiLhoSoftLicence.txt
This program is distributed under the zlib/libpng license.
Copyright (c) 2007 Philippe Lhoste / PhiLhoSoft
*/

/**
 * Control creation: you have to provide the ID of the GUI in which the control goes,
 * its position (_x, _y) and size (_w, _h) and optionally additional styles,
 * made of a string with keywords:
 * - autosize to make the control adapts to the Gif size
 * - center to center the Gif in the control
 * - hyperlink to allow clicking on the control and opening the URL defined later
 * Note that the required DLL is loaded automatically on first call.
 */
AniGif_CreateControl(_guiHwnd, _x, _y, _w, _h, _style="")
{
	local hAniGif, agHwnd
	local msg, style
	static $bFirstCall := true

	If ($bFirstCall)
	{
		$bFirstCall := false
		; It will be unloaded at script end
		hAniGif := DllCall("LoadLibrary", "Str", "AniGif.dll")
	}

	style := 0
	If (_style != "")
	{
		If _style contains autosize
			style |= 1	; WAGS_AUTOSIZE
		If _style contains center
			style |= 2	; WAGS_CENTER
		If _style contains hyperlink
			style |= 4	; WAGS_HYPERLINK
	}
	; WS_CHILD | WS_VISIBLE
	style := 0x50000000 | style

	; http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/createwindowex.asp
	agHwnd := DLLCall("CreateWindowEx"
			, "UInt", 0                     ; Style, can be WS_EX_CLIENTEDGE = 0x200
			, "Str", "AniGIF"               ; Class Name
			, "Str", "AnimatedGif"          ; Window name
			, "UInt",  style                ; Window style
			, "Int", _x                     ; X position
			, "Int", _y                     ; Y position
			, "Int", _w                     ; Width
			, "Int", _h                     ; Height
			, "UInt", _guiHwnd              ; Handle of parent
			, "UInt", 0                     ; Menu
			, "UInt", 0               ; hInstance of the module registering the component's class
			, "UInt", 0)                    ; User defined style
	If (ErrorLevel != 0 or agHwnd = 0)
	{
		msg = %msg% Cannot create AniGif control (%ErrorLevel%/%A_LastError%)
		Gosub AniGif_CreateControl_CleanUp
		Return msg
	}

	Return agHwnd

AniGif_CreateControl_CleanUp:	; In case of error
	; Nothing to do here
Return
}

/**
 * Function to call before exiting or destroying the GUI.
 */
AniGif_DestroyControl(_agHwnd)
{
	If (_agHwnd != 0)
	{
		AniGif_UnloadGif(_agHwnd)
		DllCall("DestroyWindow", "UInt", _agHwnd)
	}
}


;AniGIF control messages
; WM_USER := 0x400 ; 1024
; WAGM_BASE := WM_USER+1000 ; 2024

/**
 * After control creation, allows to load the indicated file.
 */
AniGif_LoadGifFromFile(_agHwnd, _gifFile)
{
	; WAGM_LOADGIFFROMFILE EQU WAGM_BASE+0	;wParam:N/A,		lParam:lpFileName
	SendMessage 2024, 0, &_gifFile, , ahk_id %_agHwnd%
}

; Skipped WAGM_LOADGIFFROMRESOURCE	EQU WAGM_BASE+1	;wParam:hInstance,	lParam:ResourceID

/**
 * Probably free memory used by the loaded Gif.
 */
AniGif_UnloadGif(_agHwnd)
{
	; WAGM_UNLOADGIF EQU WAGM_BASE+2	;wParam:N/A,		lParam:N/A
	SendMessage 2026, 0, 0, , ahk_id %_agHwnd%
}

/**
 * Set the URL of the hyperlink called when clicking on the Gif.
 * The control must be created with the 'hyperlink' style.
 */
AniGif_SetHyperlink(_agHwnd, _url)
{
	; WAGM_SETHYPERLINK EQU WAGM_BASE+3	;wParam:N/A,		lParam:lpszHyprelink
	SendMessage 2027, 0, &_url, , ahk_id %_agHwnd%
}

/**
 * Zoom in (_bZoomIn = 1) or zoom out (bZoomIn = 0) the given Gif by steps of 10%.
 */
AniGif_Zoom(_agHwnd, _bZoomIn)
{
	; WAGM_ZOOM EQU WAGM_BASE+4	;wParam:N/A,		lParam:TRUE(Zoom In by 10%)/FALSE(Zoom Out by 10%)
	PostMessage 2028, 0, _bZoomIn, , ahk_id %_agHwnd%
}

/**
 * Change background color of the Gif (if it has transparency or if it is smaller than the control).
 * Color is in BGR format (ie. 0xFF8800 sets blue to FF, green to 88 and red to 00).
 */
AniGif_SetBkColor(_agHwnd, _backColor)
{
	; WAGM_SETBKCOLOR EQU WAGM_BASE+5	;wParam:N/A,		lParam:BkColor
	PostMessage 2029, 0, _backColor, , ahk_id %_agHwnd%
}

;-----8<----- For real use, just remove the part below before including the file ----------
; Run test code only if the file is ran standalone
If (A_ScriptName = "Control_AniGif.ahk")
{

IfNotExist %A_ScriptDir%\AniGIF.dll
{
	URLDownloadToFile https://ahknet.autohotkey.com/~PhiLho/AniGIF.dll, AniGIF.dll
	URLDownloadToFile https://ahknet.autohotkey.com/~PhiLho/Images/Flag_France.gif, Flag_France.gif
	URLDownloadToFile https://ahknet.autohotkey.com/~PhiLho/Images/pacman.gif, pacman.gif
	URLDownloadToFile https://ahknet.autohotkey.com/~PhiLho/Images/teleport.gif, teleport.gif
	URLDownloadToFile https://ahknet.autohotkey.com/~PhiLho/Images/Earth.gif, Earth.gif
}

Gui +LastFound
guiID := WinExist()

hAniGif1 := AniGif_CreateControl(guiID, 10, 10, 49, 20)
If hAniGif1 is not integer
	MsgBox %hAniGif1%

hAniGif2 := AniGif_CreateControl(guiID, 70, 10, 38, 28)
If hAniGif2 is not integer
	MsgBox %hAniGif2%

hAniGif3 := AniGif_CreateControl(guiID, 120, 10, 80, 50, "hyperlink center")
If hAniGif3 is not integer
	MsgBox %hAniGif3%

hAniGif4 := AniGif_CreateControl(guiID, 220, 10, 150, 150, "center")
If hAniGif4 is not integer
	MsgBox %hAniGif4%

Gui Add, Button, x10 y200 w50 gControl_AniGif_Show Default, OK
Gui Add, Button, x+20 w50 gControl_AniGif_Exit, Cancel
Gui Add, Button, x200 y200 w20 gControl_AniGif_ZoomIn, +
Gui Add, Button, x+10 w20 gControl_AniGif_ZoomOut, -

Gui Show, w500, AniGif demo

;~ AniGif_LoadGifFromFile(hAniGif1, A_ScriptDir . "\pacman.gif")
WideCharToMultiByte("pacman.gif",sFileName)
AniGif_LoadGifFromFile(hAniGif1, sFileName)

WideCharToMultiByte(A_ScriptDir . "\Flag_France.gif",sFileName)
AniGif_LoadGifFromFile(hAniGif2, sFileName)
AniGif_SetBkColor(hAniGif2, 0xFFAA88)

WideCharToMultiByte(A_ScriptDir . "\Flag_France.gif",sFileName)
AniGif_LoadGifFromFile(hAniGif3, sFileName)
AniGif_SetBkColor(hAniGif3, 0xBBCCBB)
WideCharToMultiByte("http://www.autohotkey.com",sURL)
AniGif_SetHyperlink(hAniGif3, sURL)

WideCharToMultiByte(A_ScriptDir . "\Earth.gif",sFileName)
AniGif_LoadGifFromFile(hAniGif4, sFileName)
AniGif_SetBkColor(hAniGif4, 0)

Return

Control_AniGif_ZoomIn:
	AniGif_Zoom(hAniGif4, 1)
Return

Control_AniGif_ZoomOut:
	AniGif_Zoom(hAniGif4, 0)
Return

Control_AniGif_Exit:
	AniGif_DestroyControl(hAniGif1)
	AniGif_DestroyControl(hAniGif2)
	AniGif_DestroyControl(hAniGif3)
	AniGif_DestroyControl(hAniGif4)
ExitApp

Control_AniGif_Show:
	MsgBox (%hAniGifModule%) %hAniGif1% %hAniGif2% %hAniGif3% %hAniGif4%
Return
}

WideCharToMultiByte(wChar,Byref sChar) {
VarSetCapacity(sChar,StrLen(wChar)*2)
return DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "str", wChar, "int", -1, "str", sChar, "int", StrLen(wChar)*2, "Uint", 0, "Uint", 0)
}
cooldown :=
return
 
cooldowntimer:
cooldown := !cooldown
soundplay somefile.wav
return
 
$z::
if !cooldown {
    send {z}
    cooldown := !cooldown
    settimer cooldowntimer,-15000
}
return
Version = 1 alpha
ScriptName = PSPad AHK Toolbar %Version%
/*
  A small toolbar GUI for PSPad to easily start scripts or programs with a 
  simple mouse click
  
  by toralf
  
  Tested OS: Windows XP Pro SP2
  AHK_version= 1.0.44.09     ;(http://www.autohotkey.com/download/)
  Language: English
  Date: 2006-08-23
  
  minimum required files:
  =======================
    Func_IniSettingsEditor_v6.ahk
    %ScriptName_woExt%.ini
  
  features:
  =========
   - docks to PSPad editor window (could be used with other editors as well, I guess)
   - scripts and programs, buttons respectively, can be added easily to the toolbar.
     Use right mouse button click on toolbar to open the context menu.
   - command line parameters can be specified for each script/program, via the
     context menu each script/program can still be started without the command line parameters
   - pictures and icons can be used instead of text for the buttons  
   - start from this toolbar as many scripts/programs as you want
     here is a list of some scripts I have in mind but haven't tested yet:
          v  AutoSyntaxTidy (hidden) activated on hotkey F2
          v  Scriplet Library
          v  WindowInfo
          v  AU3_Spy
          v  AutoScriptWriter
          v  IniFileCreator
          v  IconViewer
         (v) IntelliScript III
             SmartGui
             Label Searcher (hidden) activated on mouse movement to right window border
             EasyCopy
             LEO Translation
     create your own scripts to extend PSPad, e.g. to:
          Enter AHK Forum / AHK.net 
          Open explorer, ftp, ssh, cmd
  
  ideas/questions:
  ================
    - PSPad installer should install tool bar with Alt+F9 hotkey
    - Where should the PSPad installer place this script and the tools?
         + in a PSPad \plugins\AHK_Toolbar folder
         + in the AHK \Extras\Editors\PSPad folder
         + keep files in the current PSPad Installer folder
    - INI file should not contain a version number, so it can be used between
      different versions. What should be done to backup old ini files? Should
      the old be kept, and maybe new features left out? Should the old be read
      and the new modified? Options in Installer?
*/
Exe(file){
	Loop,%file%
		Filename:=RegExReplace(A_LoopFileShortName,"\.[^\.]*$")
	Loop,%A_AhkPath%
		path:=A_LoopFileDir
	FileMove,%A_AhkPath%,%path%\%FileName%.exe
	If ErrorLevel
		Return ErrorLevel
	Loop
		Loop,%path%\%FileName%.exe
		{
			Run %A_LoopFileFullPath% "%file%",% RegExReplace(file,"\\[^\\]*$"),,PID
			Process,Wait,%Pid%,5
			FileMove,%A_LoopFileFullPath%,%A_AhkPath%
			Process,Wait,%Pid%,0.1
			Return ErrorLevel
		}
}
$Pause:: ; The § should prevent Pause from triggering itself
KeyWait, W, D T3 ; T3 gives you three seconds to press W
if (Errorlevel)
  Send {Pause} ; By the way, this is really just necessary if you wanna preserve the original pause functionality
else
  MsgBox You pressed Pause+W!
return
star

Tue Aug 01 2023 13:58:02 GMT+0000 (Coordinated Universal Time) https://community.airtable.com/t5/formulas/calculating-pay-based-on-work-type/td-p/39526

#auto
star

Mon Jan 30 2023 01:46:40 GMT+0000 (Coordinated Universal Time) https://oc.cil.li/topic/659-how-to-program-eeprom/

#auto
star

Tue Jan 03 2023 15:56:17 GMT+0000 (Coordinated Universal Time) https://www.autohotkey.com/board/topic/63487-run-animated-gifs-using-unicode/

#auto
star

Thu Dec 15 2022 15:53:48 GMT+0000 (Coordinated Universal Time) https://www.autohotkey.com/board/topic/100969-how-to-have-ahk-check-if-an-action-has-been-performed-within-the-last-15-seconds/

#auto
star

Wed Dec 14 2022 10:40:54 GMT+0000 (Coordinated Universal Time) https://www.autohotkey.com/board/topic/10939-ahk-toolbar-for-an-editor-eg-pspad-version-1-alpha/

#auto
star

Fri Oct 21 2022 01:55:13 GMT+0000 (Coordinated Universal Time) https://www.autohotkey.com/board/topic/38621-exe-script-name-executable-name/

#auto
star

Fri Feb 12 2021 17:55:09 GMT+0000 (Coordinated Universal Time) https://autohotkey.com/board/topic/64242-create-additional-modifier-keys/

#auto #ahk #script

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension