Skip to content

Instantly share code, notes, and snippets.

tmplinshi

Block or report user

Report or block tmplinshi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tmplinshi
tmplinshi / b64.ahk
Last active Apr 10, 2019
Base64 Encode/Decode support UTF-16-LE encoding. Ported from VBS code https://stackoverflow.com/a/40118072/1631371.
View b64.ahk
b64_encode(p*) {
return b64.encode(p*)
}
b64_decode(p*) {
return b64.decode(p*)
}
class b64
{
View StdoutToVar.ahk
; ----------------------------------------------------------------------------------------------------------------------
; Function .....: StdoutToVar_CreateProcess
; Description ..: Runs a command line program and returns its output.
; Parameters ...: sCmd - Commandline to execute.
; ..............: sEncoding - Encoding used by the target process. Look at StrGet() for possible values.
; ..............: sDir - Working directory.
; ..............: nExitCode - Process exit code, receive it as a byref parameter.
; Return .......: Command output as a string on success, empty string on error.
; AHK Version ..: AHK_L x32/64 Unicode/ANSI
; Author .......: Sean (http://goo.gl/o3VCO8), modified by nfl and by Cyruz
View Class_ListBox.ahk
; Works for DropDownList/ComboBox/ListBox
Class ListBox
{
__New(hwnd) {
; GuiControl, +AltSubmit, %hwnd%
this.hwnd := hwnd
}
Add(str) {
GuiControl,, % this.hwnd, %str%
View Class_Excel.ahk
/*
Functions:
CreateByArray(outputFile, arr)
CreateByHLV(outputFile, HLV, Obj_LV_Colors := "", IncludeLvHeader := false)
HLV - Listview hwnd
Obj_LV_Colors - Created by using 'New LV_Colors(HLV)'
ChangeLog:
v1.05 (2017-8-17) - Added "Column AutoFit"; Added .xls file support
v1.04 (2016-12-9) - 'IncludeLvHeader' option now doesn't need to change default listview
v1.03 (2016-12-9) - Added support for LV_Colors's AlternateRows/AlternateCols
View ExcelToArray.ahk
ExcelToArray(FileName, nSheet := 1)
{
return ExcelToArray.DoIt(FileName, nSheet)
}
class ExcelToArray
{
DoIt(FileName, nSheet := 1)
{
if !FileExist(FileName)
View AutoCADExample.ahk
#NoEnv
cad := ComObjActive("AutoCAD.Application")
; AddText
point := Point3d("789.72", "1500.45", "0.0")
textObj := cad.ActiveDocument.ModelSpace.AddText("AutoHotkey", point, 80.77)
textObj.Update
; AddLine
View TrayIcon.ahk
; ----------------------------------------------------------------------------------------------------------------------
; Name ..........: TrayIcon library
; Description ...: Provide some useful functions to deal with Tray icons.
; AHK Version ...: AHK_L 1.1.13.01 x32/64 Unicode
; Original Author: Sean (http://goo.gl/dh0xIX) (http://www.autohotkey.com/forum/viewtopic.php?t=17314)
; Update Author .: Cyruz (http://ciroprincipe.info) (http://ahkscript.org/boards/viewtopic.php?f=6&t=1229)
; Mod Author ....: Fanatic Guru
; License .......: WTFPL - http://www.wtfpl.net/txt/copying/
; Version Date...: 2014 - 01 - 16
; Note ..........: Many people have updated Sean's original work including me but Cyruz's version seemed the most straight
View HTTPRequest.ahk
/*
Modified version by tmplinshi
Changes:
* Default set with "Accept-Encoding: gzip, deflate" header and INTERNET_OPTION_HTTP_DECODING,
which will request a compressed response and decode automatically. (Requires Vista+ or XP SP3?)
* Fixed encoding problems of the non-ANSI characters in response headers.
*/
/*
View IsDocOpened.ahk
; 判断 word 文件是否已经打开
IsDocOpened(FileName) {
; 确保 FileName 是完整路径
if !InStr(FileName, ":")
FileName := A_ScriptDir "\" FileName
try {
oWord := ComObjActive("Word.Application")
oWord.Documents(FileName)
return true
View DisableFadeEffect.ahk
DisableFadeEffect() {
; SPI_GETCLIENTAREAANIMATION = 0x1042
DllCall("SystemParametersInfo", "UInt", 0x1042, "UInt", 0, "UInt*", isEnabled, "UInt", 0)
if isEnabled {
; SPI_SETCLIENTAREAANIMATION = 0x1043
DllCall("SystemParametersInfo", "UInt", 0x1043, "UInt", 0, "UInt", 0, "UInt", 0)
Progress, 10:P100 Hide
Progress, 10:Off
DllCall("SystemParametersInfo", "UInt", 0x1043, "UInt", 0, "UInt", 1, "UInt", 0)
You can’t perform that action at this time.