Auto Hot Key
213 subscribers
7 files
17 links
Created using ahk with love ❤️

@Lencore
Download Telegram
📆 Конвертация UNIX-времени в DATE / Convert from UNIX to DATE

Облазил кучу сайтов, но почему-то для всех это оказалось слишком трудной задачей, хотя решается в одну строку. Вместо UNIXTIME подставить свое значение.

Replace the UNIXTIME with your value.

v1:
Date := 19700101000000
Date += UNIXTIME, seconds

v2:
Date := FormatTime(DateAdd(19700101000000, UNIXTIME, "seconds"), "d MMMM yyyy, H:mm")


Источник / Source: документация / docs
#Script
🔥4
💱 Кодирование текста в URI / Encoding text to URI

Скрипт форматирует заданный текст в URI по одному символу без использования сторонних скриптов.

The script converts given text to URI char by char without using external scripts/libs.

v1:
URIEncodeChar(c) {
char := Chr(c)
If (c >= 65 and c <= 90) or (c >= 97 and c <= 122) or (c >= 48 and c <= 57) or (c = 45) or (c = 95) or (c = 46) or (c = 33) or (c = 126) or (c = 42) or (c = 39) or (c = 40) or (c = 41) {
Return char
}
enc := ""
hex := Format("{:x}", c)
if (Len(hex) = 1)
hex := "0" . hex
enc .= "%" . hex
Return enc
}

URIEncode(str) {
encStr := ""
Loop, Parse, str
{
c := Ord(A_LoopField)
encStr .= URIEncodeChar(c)
}
Return encStr
}


v2:
URIEncodeChar(c) 
{
char := Chr(c)
If (c >= 65 and c <= 90) or (c >= 97 and c <= 122) or (c >= 48 and c <= 57) or (c = 45) or (c = 95) or (c = 46) or (c = 33) or (c = 126) or (c = 42) or (c = 39) or (c = 40) or (c = 41)
Return char
enc := ""
hex := Format("{:x}", c)
if (strLen(hex) = 1)
hex := "0" . hex
enc .= "%" . hex
Return enc
}

URIEncode(str)
{
encStr := ""
Loop Parse str
{
c := Ord(A_LoopField)
encStr .= URIEncodeChar(c)
}
Return encStr
}

Источник / Source: ChatGPT
#Script
👍2
📩 Отправка и получение данных по MQTT / Sending and receiving data using MQTT

Скрипт отправляет и получает данные от брокера. Можно добавить логин и пароль. На v1 не переводил, если кому-то не лень, можете заняться, добавлю. В папку со скриптом нужно закинуть папку mosquitto.

The script sends and gets data from broker. It is possible to use login and password. Have no time to transfer to v1, pm me if you are ready to do this. The script needs a mosquitto folder in the script's folder.

v2:

Send data

publish(topic, message)
{
shell := ComObject("WScript.Shell")
pubCmd := a_scriptdir "\mosquitto\mosquitto_pub.exe -h test.mosquitto.org -p 1883 -t " topic " -m '" message "'"
shell.Run(pubCmd, 0, true)
shell.ObjRelease()
}


Get data

shell := ComObject("WScript.Shell")
subCmd := a_scriptdir "\mosquitto\mosquitto_sub.exe -h " mqttHost " -p " mqttPort " -t " topic
subProcess := shell.Exec(subCmd)
OnMessage(subProcess)

OnMessage(subProcess) {
While (!subProcess.StdOut.AtEndOfStream) {
msg := subProcess.StdOut.ReadLine()
MsgBox "Сообщение получено:" "`n" msg
}
}

Источник / Source:
GPT-4, @Lencore
#Script
Please open Telegram to view this post
VIEW IN TELEGRAM
👍2
WORDSAPI

Простой сервис-словарь по английскому. Дает определения словам, синонимы, антонимы, рифмы, примеры и так далее. Переводов на другие языки нет. Бесплатно 2,500 запросов в день.

Simple English dictionary service. Gives an definitions, synonyms, antonyms, rhymes, examplec etc. There are no translations onto other languages. 2,500 requests per day are free.

https://www.wordsapi.com/

@AutoHotKey
#API
Poker API

Сервис для определения комбинаций и победителей для игры в покер. Принимает карты на столе и карты игроков и возвращает комбинацию каждого игрока, а также победителей. Бесплатно.

A service for determining combinations and winners for playing poker. Takes the cards on the table and the players' cards and returns the combination of each player, as well as the winners. Free.

https://www.pokerapi.dev/

@AutoHotKey
#API
Quick Chart API

Простой сервис для быстрого создания графиков для визуализации данных. Бесплатно.

A simple service to generate charts to visualize data. Free to use.

https://quickchart.io/

@AutoHotKey
#API
IMGIX API

Мощный сервис для редактирования изображений. Подключается напрямую к облачному хранилищу или сайту, чтобы вытаскивать картинки. Имеет кучу настроек для наложения текста и редактирования. Бесплатный тариф дает 1000 изображений в месяц бесплатно. Ссылка на песочницу, для использования API нужно зарегаться.

A powerful service to edit images. Connects directly to your cloud storage or website to get images. Has a lot of settings for overlay. Free plan allows to create 1000 images per months. The given link leads to sandbox, to use an API you need to register.

https://sandbox.imgix.com/

@AutoHotKey
#API
Google Translate API

Быстрый перевод через неофициальный апи гугла. Точных лимитов нет, но можно поймать ограничение при многократных запросах, так как гугл начнет помечать их как автоматические.

Quick translations via unofficial Google API. No determined limits, but you may get restrictions if google detects automatic requests.

SL = source lang (en, ru, auto etc)
TL = target lang (ru, en etc)
DT = data type (t = translation, at = alt. translation, rm = transliteration. bd = reverse translation)
IE = input encoding (utf-8 etc)
OE = output encoding (same as prev)
Q = query

https://translate.googleapis.com/translate_a/single?client=gtx&dt=t&sl=en&tl=ru&q=hello

@AutoHotKey
#API
File transfer API

Простой сервис для загрузки файлов в облако, чтобы кто-то мог скачать его по ссылке. Бесплатный тариф включает 2 ГБ облака, лимит загрузки 4 ГБ в час и удаление файла после 1 скачивания.

Simple cloud storage to share links of files. Free plan includes 2 GB storage, 4 GB hourly upload limit and auto deletion of files after 1 download.

https://www.file.io/developers

@AutoHotKey
#API
Web Database

Онлайн-база данных, которую можно использовать в проектах вместо поднятия своей. Цены максимально доступные: $1 за каждый 1 млн обычных запросов и $1 за каждые 10,000 запросов CREATE.

Online database which can be used in own projects instead of deploying another ones. Prices are cool: $1 for each $1M requests and $1 for each 10K CREATE requests.

https://m3o.com/db

@AutoHotKey
#API
👍1
Read QR-code

Простой сервис для декодирования QR и баркодов. Принимает картинку в виде ссылки, возвращает содержимое.

A simple service for decoding QR and barcodes. Receives image as URL and returns the content.

http://api.qrserver.com/v1/read-qr-code/?fileurl=URL

@AutoHotKey
#API
Playing Cards API

Сервис для работы с колодой карт. Можно создать колоду, перемешивать, вытягивать карты, раскладывать по стопкам и даже получать изображение карт. Бесплатно.

A service to work with card deck. Creating, shuffling, drawing and adding cards to piles. It even gives an image of cards. Full free.

https://www.deckofcardsapi.com/

@AutoHotKey
#API
👍2🔥1
filter_profanity_russian_cached.txt
45.9 KB
1987 русских матерных слов для фильтра против мата в любом проекте.

1987 russian swear words for filter for any project.

Источник / Source: Steam
@AutoHotKey
👍3
📬 Отправка данных в другой скрипт / Send data to another script

В первой функции меняем ANOTHER SCRIPT на название своего второго скрипта, аргумент функции — что нужно передать. Во втором скрипте после получения данных можно обработать их прямо в функции, либо вернуть в тело и работать там.

In the first function, change ANOTHER SCRIPT onto your another script name, an argument of functions is data to send. In the second function, you can catch data into variable and proceed directly in function or return it to script body.

v2:

Send data:

SendWM(StringToSend)
{
TargetScriptTitle := "ANOTHER SCRIPT.ahk ahk_class AutoHotkey"
CopyDataStruct := Buffer(3*A_PtrSize)
SizeInBytes := (StrLen(StringToSend) + 1) * 2
NumPut( "Ptr", SizeInBytes, "Ptr", StrPtr(StringToSend), CopyDataStruct, A_PtrSize)
DetectHiddenWindows True
SetTitleMatchMode 2
TimeOutTime := 4000
SendMessage(0x004A, 0, CopyDataStruct,, TargetScriptTitle)
}


Get data:

Persistent 1
OnMessage 0x004A, Receive_WM_COPYDATA

Receive_WM_COPYDATA(wParam, lParam, msg, hwnd)
{
data := StrGet(NumGet(lParam, 2*A_PtrSize, "Ptr"))
}


Источник / Source: неизвестно / unknown

@AutoHotKey
#Script
Please open Telegram to view this post
VIEW IN TELEGRAM
👍5
🌐 Rufaydium — упрощенная замена Selenium для ahk v1/2, которая осталась незамеченной. Про него рассказал только Automator, и он же опубликовал версию для V2 под своим "лейблом". Может, кому-то будет полезно. Но так как по инструменту мало гайдов, у него все еще высокий порог входа. Пользуйтесь на здоровье.

🌐 Rufaydium — simplified Selenium analogue for ahk v1/2 that was not mentioned. Only the Automator told about it and published its version for v2 under his "label". Maybe it will be useful for you. There are still few guides about Rufaydium, and it requires some skills to use. Enjoy.

Источник / Source: Xeo786

@AutoHotKey
#Script #Library #Class
💬 Хочешь рассказать о своем проекте или поделиться полезным скриптом, библиотекой или сервисом? Напиши @Lencore

💬 Want to tell about own project or share useful script, library or service? Write me @Lencore
😌 sheet.best — облегчаем работу с Гугл таблицами, превращая работу с ними в REST API. У гугла ужасно замудренные протоколы авторизации, а через сервис все просто — открыл доступ к таблице и добавляешь данные через POST запросы. Попробуйте, если ненавидите OAuth так же, как я. Первый месяц — бесплатно 15к запросов, далее 15к за $10, либо 50к за $20.

😌 sheet.best — make work with Google Sheets much easier by transforming it into REST API. Google has awful auth protocols, and it's solved now: just generate link to your sheet and add new data by sending POST requests. Try it if you hate OAuth as much as me xd. Free 15k requests for the first month, then $10 for 15k or $20 for 50k.

Сайт / Site:
https://sheet.best

Документация / Documentation:
https://docs.sheet.best/#welcome

@AutoHotKey
#Service #API
Please open Telegram to view this post
VIEW IN TELEGRAM
👍1
📊 Вычисление среднего отклонения по массиву (стандартная девиация). В основном используется в финансах. Если вы не знаете, для чего он, скорее всего он вам не нужен, но скрипт в любом случае полезный.

📊 Standard deviation calculation for array, Mainly used in finance. If you don't know what it's for, you probably don't need it, but the script is useful anyway.

v1 / v2:

nums := [20.4, 18.0, 1.4, -8.6, -14.4, 3.0, -38.8, 20.9, -4.2, 131.0, -43.2, 4.6]
msgbox Round((StandardDeviation(nums)/100), 2)

StandardDeviation(arr) {
mean := sd2 := 0
for val in arr
mean += val
mean /= arr.Length
for val in arr
sd2 += (val - mean) ** 2
return sqrt(sd2 / arr.Length)
}


Источник / Source:
https://www.autohotkey.com/boards/viewtopic.php?p=560434#p560434

@AutoHotKey
#Script
Please open Telegram to view this post
VIEW IN TELEGRAM
👍1