Pages in topic:   [1 2] >
Share your translation-related AutoHotkey scripts
Thread poster: Hans Lenting
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
Jan 9, 2023

There are some older scripts here, that probably don’t work anymore.

So here is my call: Share your translation-related AutoHotkey scripts


 
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
TOPIC STARTER
Older Jan 9, 2023

Older scripts:

https://www.proz.com/forum/machine_translation_mt/319543-autohotkey_script_to_use_google_translate_for_free_for_cheapskates.html
... See more
Older scripts:

https://www.proz.com/forum/machine_translation_mt/319543-autohotkey_script_to_use_google_translate_for_free_for_cheapskates.html

https://www.proz.com/forum/internet_for_translators/270695-autohotkey_script_to_search_google_for_selection_or_open_url_from_any_program.html
Collapse


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 19:23
Member (2006)
English to Afrikaans
+ ...
Trados forum Jan 9, 2023

There was a subforum dedicated to AHK scripts on the official Trados forums...

You could ask on the ProZ.com Trados subforum if anyone still has their scripts from that era. I contributed one small script in those days, namely a right-click menu that you could load with your own scripts:

image

Download here.

[Edited at 2023-01-09 22:08 GMT]


Hans Lenting
 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 20:23
English to Russian
Still there Jan 9, 2023

Samuel Murray wrote:

There was a subforum dedicated to AHK scripts on the official Trados forums, but RWS killed it.
The subforum is still there: https://community.rws.com/product-groups/trados-portfolio/trados-studio/f/autohotkey
And Samuel's post is still there too: https://community.rws.com/product-groups/trados-portfolio/trados-studio/f/autohotkey/18224/right-click-menu-for-all-your-scripts-or-single-shortcut-for-all-your-scripts


[Edited at 2023-01-09 19:40 GMT]


Hans Lenting
 
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
TOPIC STARTER
memoQ? Jan 9, 2023

Stepan Konev wrote:

Samuel Murray wrote:

There was a subforum dedicated to AHK scripts on the official Trados forums, but RWS killed it.
The subforum is still there: https://community.rws.com/product-groups/trados-portfolio/trados-studio/f/autohotkey


Thank you Stepan. Does something like this exist for your favourite CAT tool too?


 
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
TOPIC STARTER
PhraseOMatic Jan 9, 2023

I found PhraseOMatic impressive and potentially useful for translators (e.g. assign complex chemical formulas to names). Download here

 
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
TOPIC STARTER
Other resources Jan 9, 2023

Paul Filkin's AutoHotkey scripts for translators: https://multifarious.filkin.com/2017/06/30/autohotkey-scripts-for-translators/

Anthony Teixeira: 7 Ways to Boost your Productivity with AutoHotkey:
... See more
Paul Filkin's AutoHotkey scripts for translators: https://multifarious.filkin.com/2017/06/30/autohotkey-scripts-for-translators/

Anthony Teixeira: 7 Ways to Boost your Productivity with AutoHotkey: https://www.at-it-translator.com/translators-7-ways-to-boost-your-productivity-with-autohotkey/

A very simple glossary script for translators: https://www.autohotkey.com/board/topic/62290-a-very-simple-glossary-script-for-translators-ahkglos/

Dominique Pivard's YT video: https://www.youtube.com/watch?v=_8KNQpekeHQ
Collapse


 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 20:23
English to Russian
Will share later Jan 9, 2023

Hans Lenting wrote:
Does something like this exist for your favourite CAT tool too?
I've never heard of a similar ahk forum for memoQ, however most of my scripts can run regardless of the software I use or can be modified accordingly. I will share them later when I come back home after two days. I'm traveling at the moment.


Hans Lenting
 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 19:23
Member (2006)
English to Afrikaans
+ ...
Aah Jan 9, 2023

Stepan Konev wrote:
Samuel Murray wrote:
There was a subforum dedicated to AHK scripts on the official Trados forums, but RWS killed it.
The subforum is still there...

Thanks... I could not find it myself by navigating from the main page, so I assumed it was gone.


 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 20:23
English to Russian
I mostly use these scripts (all in one ahk file) Jan 12, 2023

;DISABLE OVERWRITE MODE
#IfWinActive Trados Studio
Insert::return
#IfWinActive

;=====================
;GOOGLE LOOKUP (Alt+G)
!g::
OldClipboard:= Clipboard
Clipboard:= ""
Send, ^c ;copies selected text
ClipWait
Run http://www.google.com/search?q=%Clipboard%
Sleep 200
Clipboard:= OldClipboard
... See more
;DISABLE OVERWRITE MODE
#IfWinActive Trados Studio
Insert::return
#IfWinActive

;=====================
;GOOGLE LOOKUP (Alt+G)
!g::
OldClipboard:= Clipboard
Clipboard:= ""
Send, ^c ;copies selected text
ClipWait
Run http://www.google.com/search?q=%Clipboard%
Sleep 200
Clipboard:= OldClipboard
Return

;=====================
;Scroll anywhere without clicking

WheelUp::
WheelDown::
Critical
If(A_ThisHotkey!=A_PriorHotkey || A_TimeSincePriorHotkey>40) ; Определить скорость
Scroll:= A_ThisHotkey="WheelUp" ? 120<<16 : -120<<16 ; вращения колеса и
Else ; задать скорость
Scroll:= A_ThisHotkey="WheelUp" ? 240<<16 : -240<<16 ; прокрутки.

CoordMode, Mouse, Screen
MouseGetPos, mX, mY
mX &= 0x00000000FFFFFFFF
Point := mX | mY<<32
WinID:=DllCall("WindowFromPoint", "int64", Point, "ptr") ; ID (handle) окна
Point := mX | (mY-20)<<32 ; под мышью.
NextID:=DllCall("WindowFromPoint", "int64", Point, "ptr")
mX &= 0x0000FFFF
SendMessage, 0x20A, %Scroll%, (mY<<16)|mX,, ahk_id %WinID% ; 0x20A = WM_MOUSEWHEEL
If (!ErrorLevel && (WinID != NextID))
SendMessage, 0x20A, %Scroll%, (mY<<16)|mX,, ahk_id %NextID%
Return

;=====================
;Go to next segment by pressing Page Down

#IfWinActive ahk_exe SDLTradosStudio.exe
PgDn::
Send ^{PgDn}
Send {Down}
Send ^{PgUp}
return
;------------------------------------------------------------------------------
;Go to previous segment by pressing Page Up

#IfWinActive ahk_exe SDLTradosStudio.exe
PgUp::
Send ^{PgUp}
Send {Up}
Send ^{PgDn}
return

;=====================
;Confirm segments but not store in TM (F12)

#IfWinActive, ahk_exe SDLTradosStudio.exe
F12::
SendInput, {Alt}hut
#IfWinActive
Return

;=====================
;Find Trados selection in PDF (Win+J)

#j::
ClipboardBackup:=ClipboardAll
Send, ^c
Sleep, 100
WinActivate, ahk_exe Acrobat.EXE
Sleep, 500
if WinActive("ahk_exe Acrobat.EXE") { ;is Acrobat open and active?
} else {
MsgBox, 16, , Oops: PDF expected to be active
Exit
}
Send, ^f
Sleep, 250
Send, ^a
Sleep, 100
Send, {Del}
Sleep, 100
SendRaw, %Clipboard%
Sleep, 100
Send, {Enter}
Sleep, 100
Clipboard:=ClipboardBackup
return
Collapse


Hans Lenting
 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 20:23
English to Russian
And this autocorrect script as a stand-alone ahk file Jan 12, 2023

The script below contains a list of replacements at the end. This list dynamically gets longer every time you add a pair of words by pressing Win+H, that is why it must be a stand-alone ahk file. To use it, select a long word or phrase and press Win+H. A window will pop up where you have to define a short form on the left side (double colon ending is a must), and keep the entire word or phrase on the right side (without double colon).

#NoEnv
#SingleInstance force

... See more
The script below contains a list of replacements at the end. This list dynamically gets longer every time you add a pair of words by pressing Win+H, that is why it must be a stand-alone ahk file. To use it, select a long word or phrase and press Win+H. A window will pop up where you have to define a short form on the left side (double colon ending is a must), and keep the entire word or phrase on the right side (without double colon).

#NoEnv
#SingleInstance force

; send the corrected word on reload (will replace the selected word)
if(%0% > 1)
Send, %2%

; a tiny GUI setup
Gui, Add, Edit, vfrom w300 ,%Hotstring%::
Gui, Add, Edit, vto w300 ym0,%Hotstring%
Gui, Add, Button, Default, OK

#h::
AutoTrim Off
ClipboardOld = %ClipboardAll%
Clipboard =
Send ^c
ClipWait 1
if ErrorLevel
return
StringReplace, Hotstring, Clipboard, ``, ````, All
StringReplace, Hotstring, Hotstring, `r`n, ``r, All
StringReplace, Hotstring, Hotstring, `n, ``r, All
StringReplace, Hotstring, Hotstring, %A_Tab%, ``t, All
StringReplace, Hotstring, Hotstring, `;, ```;, All

; trim the word (better imo)
Hotstring := Trim(Hotstring)

Clipboard = %ClipboardOld%

; setting the hotstrings in the GUI
GuiControl,, to, %Hotstring%
GuiControl,, from, %Hotstring%::

; focus to the "to" gui
GuiControl, Focus, to
Gui, Show

; send control + a in order toselecctthe text in the "to" gui (better imo)
Send, ^a
return

; happens when pressing the OK button
ButtonOK:
; assembling the hotstring and save it to this file
GuiControlGet, to
GuiControlGet, from
Hotstring := "::" from to
FileAppend, `n%Hotstring%, %A_ScriptFullPath%

; special reload statement with the word in the "to" gui
Run, %A_ScriptFullPath% /restart %to%

Sleep 200
MsgBox, 4,, The hotstring just added appears to be improperly formatted. Would you like to open the script for editing? Note that the bad hotstring is at the bottom of the script.
IfMsgBox, Yes, Edit
return

::--::—
::давл::давление
::соо::соответствует
::возд::воздействие
::затр::затруднительно
::неус::неустойчивость
::расп::распространения
::поср::посредством
::веро::вероятность
::посл::последующей
::возн::возникновении
::преду::предусматривать
::окру::окружающей среды
::приме::применения
::соот::соответствующих
::неко::некондиционное
::посл::последующим
::непо::непосредственно
::отно::относительно
::прио::приостановить
::согл::согласование
::обес::обеспечения
::возм::возможности
::обес::обеспечивается
::взаи::взаимодействия
::обор::оборудования
::прое::проектированию
::возн::возникновение
::надл::надлежащим
::искл::исключительно
::кате::категорически
::неко::неконтролируемого
::неза::незамедлительно
::хара::характеристики
::треб::требованиями
::пред::предусматривается
::изго::изготовленные
::допу::допускается
::трубо::трубопроводной
::арма::арматуры
::эксп::эксплуатации
::инфо::информацию
::конс::конструкция
::обес::обеспечить
::отве::отверстие
::соед::соединения
::мате::материалов
::выпо::выполнения
::обна::обнаружении
::отсу::отсутствие
::наст::настоящего
::прок::проконтролировать
::подт::подтвердить
::хран::хранилища
::аппа::аппаратного обеспечения
::испо::использование
::знач::значительной
::деят::деятельность
::осущ::осуществляется
::прои::производительность
::поль::пользователя
::разр::разрешения
::экзе::экземпляр
::дина::динамическая
::допо::дополнительного
::разв::развертывания
::доку::документации
::желе::железнодорожных
::уста::установленным
::натя::натяжение
::изги::изгибающий
::водо::водонепроницаемой
::сост::составляет
::рассм::рассматривается
::устр::устройства
::перс::персональные данные
::элек::электротехнической
::номи::номинальной
::конт::контейнеров
::рабо::работоспособности
::репо::репозиторий
::inst::installation
::реал::реализации
::несо::несоответствий
::неск::несколько
::испы::испытаний
::подр::подразделений
::собл::соблюдение
::нево::невозможно
::техо::техобслуживание
::осви::освидетельствование
::осущ::осуществляет
::прис::приспособления
::акку::аккумулятора
::тран::транспортировки
::инди::индивидуально
::возн::возникновению
::вспо::вспомогательного
::осна::оснащенный
::долж::должны быть
::откл::отключения
::назн::назначения
::подх::подходящий
::явля::является
::скон::сконфигурированных
::дейс::действия
::комм::комментариев
::воло::волоконно-оптические
::меро::мероприятиям
::клас::классификация
::корр::корректирующих
::зави::зависимости
::зако::законодательством
::стз::с точки зрения
::неис::неисправностей
::кип::контрольно-измерительные приборы
::шино::шинопроводов
::усто::устойчивость
::обсл::обслуживании
::прео::преобразования
::опре::определяются
::обесп::обеспечивает
::незн::незначительных
::обесп::обеспечивают
::запр::запрещается
::неод::неоднократно
::поск::поскольку
::тбт::производственных инструктажей
::квал::квалифицированным специалистом
::чрез::чрезвычайно
::вобя::в обязательном порядке
::замк::замкнутое пространство
::обяз::обязательное
::зафи::зафиксированы
::регу::регулярно
::легк::легковоспламеняющихся
::орга::организацию
::заве::завершении
::упра::упражнение
::соде::содержимого
::прил::приложение
::наж::нажмите
::обра::обратите внимание, что
::выбе::выберите
::прод::продвижения
::реко::рекомендаций
::отоб::отображаемой
::иден::идентификатор
::кром::Кроме того,
::синх::синхронизации
::доба::добавьте
::озна::ознакомиться
::безо::безопасности
::архи::архитектуры
::эффе::эффективно
::обно::обновление
::лабо::лабораторной
::ауте::аутентификации
::руко::руководство
::конф::конфигурацию
::обоз::обозначается
::возо::возобновлением
::неук::неукоснительно
::инст::инструктажей
::усов::усовершенствование
::тщат::тщательно
::нару::наружная
::изло::изложенные
::суще::существует
::реги::регистрация
::неуд::неудовлетворительно
::жела::желательно
::диап::диапазоне
::прев::превышения
::нахо::находятся
::легк::легковоспламеняющимися
::соор::сооружения
::расп::расположенных
::обст::обстоятельство
::втч::в том числе
::нера::неразрушающего контроля
::целе::целесообразности
::усло::условием
::некв::неквалифицированного
::стро::строительства
::сопу::сопутствующее
::забл::заблаговременно
::сове::совещаний
::факу::факультативно
::сент::сентября
::нижеу::нижеуказанные
::пожа::пожалуйста
::адми::администрирование
::стои::стоимости
::поко::поколения
::заис::за исключением
::ситу::ситуации
::здра::здравоохранения
::подд::поддержки
::удов::удовлетворение
::пове::поверхностей
::дека::декабря
::опци::опциональных
::несв::несвоевременной
::какм::как минимум
::дета::детализированный
::пози::позициями
::разм::размещения
::сооб::сообщает
::монт::монтажно-технологической схемы
::следоб::следующим образом
::грузо::грузоподъемностью
::закл::заключается
::каса::касающимся
::проекр::проектировочным работам
::необ::необслуживаемый
::првз::предусматривает возможность
::переда::передаваемая документация
::возни::возникающих
::медиц::медицинской
::пери::периодически
::преи::преимущества
::выст::выступающих
::нижеу::нижеуказанные
::нижеп::нижеперечисленным
::неде::недействительный
::восс::восстановление
::регл::регламентируются
::предо::предоставлением
::поло::положения
::стру::структурного
::сопр::сопровождения
::резу::результат
::функ::функционалом
::ежед::ежедневно
::множ::множество
::восп::воспользуйтесь
::собе::собеседования
::неоп::неопределённости
::проз::прозрачность
::заар::заархивировать
::повр::повреждения
::суче::с учётом
::недо::недостаточной
::спо::с помощью
::опер::оперативно
::позв::позволяет
::пом::по мере необходимости
::увед::уведомление
::@@::«»
::нео::необходимо
::ос:: °С
::аббр::аббревиатура
::инте::интеграции
::изме::изменения
::сотр::сотрудников
::заде::задействование
::удос::удостоверение
::наим::наименование
::соис::соискателей
::кли::каких-либо
::трудо::трудоустройства
::всоо::в соответствии с
::сце::с целью
::всл::в случае
::оуд::ó
::еуд::é
::чз::через
::ата::а также
::такн::так называемую
::прик::при котором
Collapse


 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 20:23
English to Russian
Some other scripts not related to translation Jan 12, 2023

;Char count selection 1 (Alt+C)

!c::
Send, ^c
ClipWait
Chars := StrLen(Clipboard)
RegExReplace(Clipboard,A_Space,"",Spaces)
MsgBox % "The highlighted text is " Chars " characters in length and contains " Spaces " spaces."
clipboard = ; Empty the clipboard
return

;============

;Char count selection 2 (Win+Q)
#q::
{
Send, ^c
StringReplace, OutputVar, ClipBoard, %A_Space
... See more
;Char count selection 1 (Alt+C)

!c::
Send, ^c
ClipWait
Chars := StrLen(Clipboard)
RegExReplace(Clipboard,A_Space,"",Spaces)
MsgBox % "The highlighted text is " Chars " characters in length and contains " Spaces " spaces."
clipboard = ; Empty the clipboard
return

;============

;Char count selection 2 (Win+Q)
#q::
{
Send, ^c
StringReplace, OutputVar, ClipBoard, %A_Space%,, All UseErrorLevel
Length := StrLen(Clipboard)
MsgBox % "Spaces: " ErrorLevel "`nChars: " (Length-ErrorLevel) "`nTotal: "(length) "`nLine: " Clipboard
}
return

;============
;Color picker
;Thanks to majkinetor - Common dialog for changing Gui & font colors from http://www.autohotkey.com/forum/viewtopic.php?t=17230
;Thanks to majkinetor, skan & polyethene - Validate Hex Color Code from http://www.autohotkey.com/community/viewtopic.php?f=1&t=13545&start=60
;Thanks to derRaphael & JustMe for the Color Controls code from http://www.autohotkey.com/forum/topic33777.html and here http://www.autohotkey.com/board/topic/90401-control-colors-by-derraphael/
;All Hex color codes are in the blue-green-red (BGR) format.
#SingleInstance force
ProgramName = Alex's Color Picker
Version = 2.2
OnMessage(0x0133, "Control_Colors") ;WM_CTLCOLOREDIT = 0x0133, WM_CTLCOLORLISTBOX = 0x0134, ;WM_CTLCOLORSTATIC = 0x0138
OnMessage(0x0138, "Control_Colors")
Gui 1: font, s10 , Verdana
Gui 1: default
Gui 1: Add, Text, x12 y12 w280 h50 , Select a preset color from the drop down list. The Hex-Code will appear in the Edit Box.
Gui 1: Add, DropDownList, x22 y82 w120 vdropdownlist gDropDownList hwndhcbx H400 Sort Choose13,Red|Yellow|Blue|Green|Orange|Black|Silver|Lime|Gray|Olive|White|Maroon|Navy|Purple|Teal|Fuchsia|
Gui 1: Add, Text, x12 y132 w280 h50 , Press the button "Color Picker" to get the exact color you want. The Hex-Code will appear in the Edit Box.
Gui 1: Add, Button, x22 y202 w120 h30 , Color Picker
Gui 1: Add, Text, x12 y252 w280 h50 , Type a Hex-Code in the Edit Box, and click Apply Color to see that color.
Gui 1: Add, Button, x22 y322 w120 h30 , Apply Color
Gui 1: Add, Text, x12 y372 w280 h50 , Real Time will put the Hex-Code of the color under your mouse cursor in the Edit Box.
Gui 1: Add, Button, x22 y432 w120 h30 , Real Time
Gui 1: Add, Button, x85 y+25 gCopyToClipboard ,Copy to Clipboard

Gui 1: font, s11 , Verdana
Gui 1: Add, Edit, x152 y82 w130 h30 center veditbox1, 008080
Gui 1: Add, Edit, x152 y202 w130 h30 center veditbox2,
Gui 1: Add, Edit, x152 y322 w130 h30 center veditbox3 gHexEditBox,
Gui 1: Add, Edit, x152 y432 w130 h30 center veditbox4,
loop 4
Control_Colors("Editbox" a_index, "Set", "0xc0c0c0", "0x000000")

Gui 1: Show, h530 w306, %ProgramName%
winset, AlwaysOnTop, on, %ProgramName%
WinGet,WinTitle2,ID,%ProgramName%
Gui 1: color, c0c0c0
PostMessage, 0x153, -1, 25,, ahk_id %hcbx% ; Set height of selection field for dropdownlist.
PostMessage, 0x153, 0, 20,, ahk_id %hcbx% ; Set height of list items for dropdownlist.
SetTimer,PreventFocusOnNoInputEditBoxes,50
Return
PreventFocusOnNoInputEditBoxes: ;prevents user input to editboxes. Disabling 3 out of 4 cause all 4 not to match
ControlGetFocus, OutputVar , ahk_id %WinTitle2%
if OutPutVar = Edit1
ControlFocus, button4,ahk_id %WinTitle2%
if OutPutVar = Edit2
ControlFocus, button4,ahk_id %WinTitle2%
if OutPutVar = Edit4
ControlFocus, button4,ahk_id %WinTitle2%
return
DropDownList: ;Editbox1
stopbreak = 1 ;just incase Real Time is still looping
Guicontrolget, dropdownlist
Gui 1: font, c000000 s10, Verdana
loop 4
{
GuiControl,font,static%A_Index%
ControlSetText , Edit%a_index%, , %ProgramName%
}

if dropdownlist = Red
ColorCode = ff0000
if dropdownlist = Yellow
ColorCode = FFFF00
if dropdownlist = Blue
ColorCode = 0000FF
if dropdownlist = Green
ColorCode = 008000
if dropdownlist = Purple
ColorCode = 800080
if dropdownlist = Orange
ColorCode = ff8000
if dropdownlist = Silver
ColorCode = C0C0C0
if dropdownlist = Lime
ColorCode = 00FF00
if dropdownlist = Gray
ColorCode = 808080
if dropdownlist = Olive
ColorCode = 808000
if dropdownlist = Maroon
ColorCode = 800000
if dropdownlist = Purple
ColorCode = 800080
if dropdownlist = Teal
ColorCode = 008080
if dropdownlist = Fuchsia
ColorCode = FF00FF
if dropdownlist = White
ColorCode = FFFFFF
if dropdownlist = Navy
ColorCode = 000080
if dropdownlist = Black
{
ColorCode = 000000
Gui 1: font, cFFFFFF , Verdana
loop 4
GuiControl,font,static%A_Index%
}

Gui 1: color, %colorcode%,
ControlSetText , Edit1, %ColorCode%, %ProgramName%
StringSplit,Digit,ColorCode
ColorCode := ( Digit5 Digit6 Digit3 Digit4 Digit1 Digit2)
loop 4
{
Control_Colors("Editbox" a_index, "Set", "0x" ColorCode, "0x000000")
WinSet,Redraw,,%ProgramName%
}
return

ButtonColorPicker: ;Editbox2
stopbreak = 1 ;just incase Real Time is still looping
Gui 1: font, c000000 s10, Verdana
loop 4
{
GuiControl,font,static%A_Index%
ControlSetText , Edit%a_index%, , %ProgramName%
}
CmnDlg_Color( color:=0000FF)
if color =
Return
Gui 1: Color, %Color%
StringTrimleft, color, color, 2
ControlSetText , Edit2, %color%, %ProgramName%
StringSplit,Digit,Color
Color := ( Digit5 Digit6 Digit3 Digit4 Digit1 Digit2)
loop 4
{
Control_Colors("Editbox" a_index, "Set", "0x" Color, "0x000000")
WinSet,Redraw,,%ProgramName%
}
Return

ButtonApplyColor: ;Editbox3
stopbreak = 1 ;just incase Real Time is still looping
NotAValidColor1 = 0
NotAValidColor2 = 0
ControlGettext,Value,Edit3,%ProgramName%
gosub ValidateHexColorCode
if ( NotAValidColor1 = 0 and NotAValidColor2 = 0 )
{
Gui 1: font, c000000 s10, Verdana
StringSplit,Digit,Value
Color := ( Digit5 Digit6 Digit3 Digit4 Digit1 Digit2)
loop 4
{
GuiControl,font,static%A_Index%
Control_Colors("Editbox" a_index, "Set", "0x" color, "0x000000")
WinSet,Redraw,,%ProgramName%
if A_index <> 3
ControlSetText , Edit%a_index%, , %ProgramName%
}
Gui 1: Color, %Value%
}
Return
HexEditBox: ;clears Edit1,2, and 4 if anything is typed in Editbox3
If RealTimeIsRunning = 1
return
ControlSettext, Edit1,,%ProgramName%
ControlSettext, Edit2,,%ProgramName%
ControlSettext, Edit4,,%ProgramName%
return

ButtonRealTime: ;Editbox 4
Control, disable, , ComboBox1, %ProgramName%
Control, disable, , Button1, %ProgramName%
Control, disable, , Button2, %ProgramName%
Control, disable, , Button3, %ProgramName%
Control, disable, , Button4, %ProgramName%
RealTimeIsRunning = 1 ;stop HexEditBox label glabel from running when ControlSetText is executed
stopbreak = 0

gui 1: font, c000000 s10 , Verdana
loop 4
GuiControl,font,static%A_Index%
ControlSetText , Edit1, , %ProgramName%
ControlSetText , Edit2, , %ProgramName%
ControlSetText , Edit3, , %ProgramName%

ToolTip,Press Ctrl e to stop Real Time
Loop
{
MouseGetPos , xpos, ypos, WinTitle1, ControlID,
PixelGetColor , color, %xpos%, %ypos%, rgb
StringSplit,Digit,Color
ControlColor := (Digit1 Digit2 Digit7 Digit8 Digit5 Digit6 Digit3 Digit4)
if ( Color1 <> Color and WinTitle1 <> WinTitle2 )
{
StringTrimLeft,Color,Color,2
controlsettext, edit4, %Color%, %ProgramName%
Gui 1: Color, %Color%
loop 4
Control_Colors("Editbox" a_index, "Set", ControlColor, "0x000000")
Color1 = %Color%
}
if stopbreak = 1
{
RealTimeIsRunning = 0
Control, enable, , ComboBox1, %ProgramName%
Control, enable, , Button1, %ProgramName%
Control, enable, , Button2, %ProgramName%
Control, enable, , Button3, %ProgramName%
Control, enable, , Button4, %ProgramName%
ToolTip
break
}
}
stopbreak = 0
Return

CopyToClipboard:
NotAValidColor1 = 0
NotAValidColor2 = 0
FoundEditBox3Value = 0
Loop 4
{
ControlGettext,Value,Edit%a_index%,%ProgramName%
FoundEditBoxValue = %a_index% ;need to know if EditBox3 is the one with contents so it can be checked with gosub ValidateHexColorCode below
if Value <>
break
}

if FoundEditBoxValue = 3
gosub ValidateHexColorCode ;sets NotAValidColor1 and/or NotAValidColor2 to 1 if EditBox3 color hex code is not a valid color code

If ( NotAValidColor1 = 0 and NotAValidColor2 = 0 )
Clipboard = %Value%
return

ValidateHexColorCode:
if Value <>
{
Value2 = %Value%
StringLen,Len,Value
if (Len > 6)
{
TempCount := ( Len - 2 )
StringTrimRight,1st2CharsOnLeft,Value2, %TempCount%
if ( 1st2CharsOnLeft <> "0x" )
NotAValidColor1 = 1
else
StringTrimLeft,Value,Value,2
}
var := RegExMatch(Value, "i)^[0-9a-fA-F]+$") ;thanks to majkinetor, skan and polyethene, code found here ;http://www.autohotkey.com/community/viewtopic.php?f=1&t=13545&start=60
if ( Var = 0 or NotAValidColor1 = 1 or NotAValidColor2 = 1 or ( Len <> 6 and Len <> 8) or Len > 8 )
{
Gui 1: +Disabled
Gui 2: -MinimizeBox
Gui 2: font, s12, Verdana
Gui 2: add, text,, "%Value2%" is not a valid color code
Gui 2: show,autosize, Invalid Entry
Gui 2: color, DAC69F
winset, AlwaysOnTop, On, Invalid Entry
WinWaitClose,Invalid Entry
NotAValidColor2 = 1
}
}
else
NotAValidColor1 = 1
return

^e::
stopbreak=1
return

GuiClose:
ExitApp

2GuiClose:
Gui 1: -Disabled
Gui 2: destroy
return

;color function returns user choise in var color
;usage CmnDlg_Color( color:=0000FF)
CmnDlg_Color(ByRef pColor, hGui=0){
;covert from rgb
clr := ((pColor & 0xFF) << 16) + (pColor & 0xFF00) + ((pColor >> 16) & 0xFF)

VarSetCapacity(sCHOOSECOLOR, 0x24, 0)
VarSetCapacity(aChooseColor, 64, 0)

NumPut(0x24, sCHOOSECOLOR, 0) ; DWORD lStructSize
NumPut(hGui, sCHOOSECOLOR, 4) ; HWND hwndOwner (makes dialog "modal").
NumPut(clr, sCHOOSECOLOR, 12) ; clr.rgbResult
NumPut(&aChooseColor,sCHOOSECOLOR, 16) ; COLORREF *lpCustColors
NumPut(0x00000103, sCHOOSECOLOR, 20) ; Flag: CC_ANYCOLOR || CC_RGBINIT

nRC := DllCall("comdlg32\ChooseColorA", str, sCHOOSECOLOR) ; Display the dialog.
if (errorlevel <> 0) || (nRC = 0)
return false


clr := NumGet(sCHOOSECOLOR, 12)

oldFormat := A_FormatInteger
SetFormat, integer, hex ; Show RGB color extracted below in hex format.

;convert to rgb
pColor := (clr & 0xff00) + ((clr & 0xff0000) >> 16) + ((clr & 0xff) << 16)
StringTrimLeft, pColor, pColor, 2
loop, % 6-strlen(pColor)
pColor=0%pColor%
pColor=0x%pColor%
SetFormat, integer, %oldFormat%

return true
}
;Control_Colors--------------------------------------------------------
Control_Colors(wParam, lParam, Msg, Hwnd) {
Static Controls := {}
If (lParam = "Set") {
If !(CtlHwnd := wParam + 0)
GuiControlGet, CtlHwnd, Hwnd, %wParam%
If !(CtlHwnd + 0)
Return False
Controls[CtlHwnd, "CBG"] := Msg + 0
Controls[CtlHwnd, "CTX"] := Hwnd + 0
Return True
}
; Critical
If (Msg = 0x0133 Or Msg = 0x0134 Or Msg = 0x0138) {
If Controls.HasKey(lParam) {
If (Controls[lParam].CTX >= 0)
DllCall("Gdi32.dll\SetTextColor", "Ptr", wParam, "UInt", Controls[lParam].CTX)
DllCall("Gdi32.dll\SetBkColor", "Ptr", wParam, "UInt", Controls[lParam].CBG)
Return DllCall("Gdi32.dll\CreateSolidBrush", "UInt", Controls[lParam].CBG)
}
}
}
;----------------------------------------------------------------------

;============
;Swap words
F1::Swap("Left")
F2::Swap("Right")

Swap(dir:="Left")
{
clipSave := ClipboardAll
Clipboard := ""
Send, % "{Shift down}{Ctrl down}{" dir " 2}{Shift up}c{Ctrl up}"
Clipboard := RegExReplace(Clipboard, "(\S+) +(\S+)", "$2 $1")
Send, {Ctrl down}v{Ctrl up}
Clipboard := clipSave
}
Return
Collapse


 
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
TOPIC STARTER
Thanks Jan 14, 2023

Thank you Stepan, for your very generous contribution. I'll carefully examine and test your macros.

 
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
TOPIC STARTER
Thank you too Jan 14, 2023

Samuel Murray wrote:

I contributed one small script in those days, namely a right-click menu that you could load with your own scripts:

image



Very nice, Samuel. Thank you for your contribution.


 
Hans Lenting
Hans Lenting
Netherlands
Member (2006)
German to Dutch
TOPIC STARTER
UltimateKEYS Jan 26, 2023

UltimateKEYS keeps all keys exactly like US QWERTY. Holding down Right Alt or Right Alt + Shift makes other diacritics and symbols accessible.
With the ‘Compose Key’ (CP), even wider amounts of diacritics and symbols are accessible.

It also shares some similarities with “US-International”. However, this project attempts to solve the most common difficulties from this counterpart.
One of those : the quotes issue, with ' and " now accessible as usual (or expected)
... See more
UltimateKEYS keeps all keys exactly like US QWERTY. Holding down Right Alt or Right Alt + Shift makes other diacritics and symbols accessible.
With the ‘Compose Key’ (CP), even wider amounts of diacritics and symbols are accessible.

It also shares some similarities with “US-International”. However, this project attempts to solve the most common difficulties from this counterpart.
One of those : the quotes issue, with ' and " now accessible as usual (or expected).

https://pieter-degroote.github.io/UltimateKEYS/autohotkey-win.html
Collapse


 
Pages in topic:   [1 2] >


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Share your translation-related AutoHotkey scripts






TM-Town
Manage your TMs and Terms ... and boost your translation business

Are you ready for something fresh in the industry? TM-Town is a unique new site for you -- the freelance translator -- to store, manage and share translation memories (TMs) and glossaries...and potentially meet new clients on the basis of your prior work.

More info »
Trados Studio 2022 Freelance
The leading translation software used by over 270,000 translators.

Designed with your feedback in mind, Trados Studio 2022 delivers an unrivalled, powerful desktop and cloud solution, empowering you to work in the most efficient and cost-effective way.

More info »