Skip to content

Commit

Permalink
added ctrl+alt+m for transliterate full sentences
Browse files Browse the repository at this point in the history
  • Loading branch information
kuasarx authored Apr 11, 2023
1 parent d69f79a commit be87e6d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions andaluh.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,27 @@ Menu, Tray, Icon, andalûh-p.ico, , 1 ; set the icon to use when AutoHotkey is s
Menu, Tray, Icon, andalûh.ico ; set the icon to use when AutoHotkey is running
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

; copy the selected text
^!m::
SendInput, ^c
ClipWait, 2
if ErrorLevel
return
selected_text := Clipboard

; make the API request and get the response
url := "https://api.abula.ga/autohotkey.php?q=" . selected_text
response := ""
oHTTP := ComObjCreate("WinHttp.WinHttpRequest.5.1")
oHTTP.Open("GET", url, false)
oHTTP.Send()
if (oHTTP.Status = 200)
response := oHTTP.ResponseText

; replace the selected text with the response
if (response != "")
SendInput, {BS}%response%
return

~^!p:: ; Ctrl+Alt+a
Suspend
Expand Down

0 comments on commit be87e6d

Please sign in to comment.