Newbie Help with Hotstring
Posted: 20 Jun 2019, 10:01
I've a problem with a hotstring. What I'm trying to do is 'write' a pseudo-XML tag into a web form. This is what I'm looking for:
<comment author="abcd">
</comment>
with the carat left on the blank line between the beginning and ending comment tag. Here's my hotstring:
Here's what I USUALLY end up with (sometimes, the 'blank line' shifts to AFTER the closing comment tag):
<omment author="abcd">
<\comment>
c
and the carat is left at the beginning of the closing <\comment> line. I've experimented with changing the SendMode from Input to Event, adding k99 to the b0t0 and even adding {sleep, 500} before each of the different 'keystroke' commands. I can mess it up worse but I can't get to what I'm trying. Anyone know what I'm doing wrong? (Longer explanation below)
The whole story is I'm using a modified script I found on the internet to load two different scripts. Here's the MasterScript:
Here's the full Webform.ahk:
I didn't include the 'autocorrect.ahk' because it's the 'normal' autocorrect script I downloaded from autohotkey.com. If I run JUST the webform.ahk, I get closer - but it looks like the {enter 2} is completely ignored because both of the comment tags are on the same line and the carat is left just after the opening brace in the closing comment tag.
Notice I do similar things for <t* and <c* - but <t* actually works...and the only difference I can see is the '{enter 2}'...
Moderator Note: Added code tags. ~ sinkfaze
<comment author="abcd">
</comment>
with the carat left on the blank line between the beginning and ending comment tag. Here's my hotstring:
Code: Select all
:*b0t0:<c*::{bs}omment author="abcd">{enter 2}<\comment>{enter}{left 12}
<omment author="abcd">
<\comment>
c
and the carat is left at the beginning of the closing <\comment> line. I've experimented with changing the SendMode from Input to Event, adding k99 to the b0t0 and even adding {sleep, 500} before each of the different 'keystroke' commands. I can mess it up worse but I can't get to what I'm trying. Anyone know what I'm doing wrong? (Longer explanation below)
The whole story is I'm using a modified script I found on the internet to load two different scripts. Here's the MasterScript:
Code: Select all
======================
; Master AHK Script
; Modified from https://autohotkey.com/board/topic/5119-launching-multiple-ahk-scripts/
; ----- Common Settings -----
#SingleInstance force
StringCaseSense On
; ----- AutoExecute commands -----
;...
; ----- Included Scripts -----
GoSub WebformSetup
GoSub AutoCorrectSetup
GoTo Shared
AutoCorrectSetup:
#include c:\tools\ahk_scripts\AutoCorrect.ahk
Return
WebformSetup:
#include c:\tools\ahk_scripts\Webform.ahk
Return
Shared:
; ----- Shared subroutines, functions ---
====================
Code: Select all
====================
;#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
;SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
;SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
OldSendMode := A_SendMode
SendMode Event
; ----- Hotstrings -----
#IfWinActive PROG
:*b0t0:<t*::{sleep, 500}{bs}itle author="abcd"><\title>{sleep, 500}{left 8}
:*b0t0:<c*::{bs}omment author="abcd">{enter 2}<\comment>{enter}{left 12}
SetKeyDelay -1
SendMode %OldSendMode%
====================
Notice I do similar things for <t* and <c* - but <t* actually works...and the only difference I can see is the '{enter 2}'...
Moderator Note: Added code tags. ~ sinkfaze