Is there a possibilty to combine Hotsrting settings with Hotkeys ?
([i]Without duplicating all hotstrings ofcourse And without adding extra lines to hotstrings[/i])
I can imagine ways, but only by duplicating everything.
Reason:
I would like to use normal space to fire hotsring in a way, that the space is added at the end,
but i want to use Alt+Space if i want to use it as ":o:"
(Actually it would be very nice to know how in general a Hotkey could be used to modify some #Options.)
[u]Something like this: [/u]<br>
#"if Alt is pressed"
{
#Hotkey o
}
::hlo::Hello!
::wtv::Whatever
Alternatively it could add a BS after the end, like:
~!space::send,{bs} ;(this does not work together with the hotsrting ofcourse)
Instead of something like this:
::hlo::
{
if alt is pressed...else ...
}
EDIT:
So we have discussed this together for quite some time on the Discord AHK forum.
Answers so far to different aspects of my question:
- You cannot Modify any #Options directly
- But it is possible to modify Hotkeys/Hotsrings etc. on the fly via specific functions.
- In case of Hotstrings a very new feature is also the use of :x:abc::, that allows the use of expressions -> and in that we can call a function, that uses GlobalVariables -> Via those variables the settings can be adjusted dynamically, before run.
- My final solution to the particular problem was very different though. Instead of using inbuilt options, I had better luck with a nasty workaround:
#inputlevel 1
!space::
{
SendInput,{space}
sleep 0
SendInput,{bs}
return
}
#inputlevel 0
::asd::by the way
- Also pasting one of the codes @CliveGalway (a.k.a EvilC?) helped me with via the forum. The reason I could not use it in this particular case is that if :x: is used, the hotstring loses its automatic CaseSensitivity - and i did not want that... otherwise excellent script:
#SingleInstance force
EndCharOn := 0
SetCapsLockState, Off
hotStrings := [{hs: "btw", rep: "By the Way"}
,{hs: "tat", rep: "This and That"}]
for i, h in hotStrings {
HotString(":X:" h.hs, Func("SendHotString").Bind(h.rep))
}
CapsLock::
EndCharOn := !EndCharOn
SetCapsState()
return
SetCapsState(){
global EndCharOn
SetCapsLockState, % (EndCharOn ? "On" : "Off")
}
SendHotString(Text){
global EndCharOn
SendRaw, % Text (EndCharOn ? A_EndChar : "")
EndCharOn := 0
SetCapsState()
}
^Esc::
ExitApp