Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Quick Type HTML Tags


  • Please log in to reply
7 replies to this topic
orehta
  • Members
  • 6 posts
  • Last active: Aug 10 2011 03:29 PM
  • Joined: 10 Jul 2011
I want write ahk-script that helps type quickly html tags

i know the way
----
:*:a?::
SendInput <a href="" name=""></a>{Left, 14}
return
----
autoreplaces by <a href="" name=""></a>

but I need write tags with attributes
for example
"a ht?" => <a href="" target=""></a>
"i sa?" => <img src="" alt="">
"d ic?" => <div id="" class=""></div>

is it possible?
Thanks
p.s. Apologize for broken English

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts
  • Last active:
  • Joined: 27 May 2007
Not an answer to your question but have a look at k-html
<!-- m -->http://www.autohotke... ... ight=khtml<!-- m -->

orehta
  • Members
  • 6 posts
  • Last active: Aug 10 2011 03:29 PM
  • Joined: 10 Jul 2011

Not an answer to your question but have a look at k-html
<!-- m -->http://www.autohotke... ... ight=khtml<!-- m -->


thanks, the program is wide-functional

but i search autoreplaces(not shortcuts), it is hard to keep in mind so many shortcuts.

i find hotstrings
<!-- m -->https://ahknet.autoh... ... trings.ahk<!-- m -->
can i adapt it for myself?

Any variants?

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts
  • Last active:
  • Joined: 27 May 2007
No need you can use regular hotstrings
#Hotstring EndChars -()[]{}:;'"/\,.!`n`t ; see http://www.autohotkey.com/docs/Hotstrings.htm - I've removed space and ? as endchar
:*:a ht?::<a href="" target=""></a>{left 6}

Edit: you could use hotstrings if you want to for greater flexibility <!-- m -->http://www.autohotke... ... =zencoding<!-- m -->
basic example (to adopt the entire style would require a much more complex script, I started it once but never finished it as I found it to be somewhat unreliable/unstable)
#SingleInstance, Force
#Include hotstrings.ahk

/*
type p>b for example

*/

hotstrings("(\w+)>(\w+)\s", "ZenCode")
Return


ZenCode:
a:=% $1
b:=% $2
code=
(
<%A%>
	<%B%></%B%>
</%A%>
)
Clipboard:=Code
Send ^v
code=
Return


orehta
  • Members
  • 6 posts
  • Last active: Aug 10 2011 03:29 PM
  • Joined: 10 Jul 2011
thanks, i think hotstrings is suitable. i hope i can prepare result string :)

sumon
  • Moderators
  • 1317 posts
  • Last active: Dec 05 2016 10:14 PM
  • Joined: 18 May 2010
You can also use Appifyer (see my signature) with Pastej, atleast it's very nice to insert links and other self defined strings.

Remington
  • Members
  • 13 posts
  • Last active: Jul 23 2011 08:40 PM
  • Joined: 10 Jul 2011
Here's my solution:
:oc:href::<a href="^v"target="_blank"></a>{Left 4}
:oc:<href>::<a href="^v"target="_blank"></a>{Left 4}
:oc:<ul>::<ul>{Enter}{Enter}</ul>{Up}
:oc:<ol>::<ol>{Enter}{Enter}</ol>{Up}
:oc:<li>::<li></li>{Left 5}
:oc:<co>::<code></code>{Left 7}
:oc:<p>::<p></p>{Left 4}
:oc:<bk>::<blockquote>^v</blockquote>
:oc:img::<img src="^v">
:oc:<img>::<img src="^v">
:oc:<str>::<strong></strong>{Left 9}
:oc:<b>::<b></b>{Left 4}
^!b::Send , ^c<b>^v</b>
:oc:<i>::<i></i>{Left 4}
^!i::Send , ^c<i>^v</i>
:oc:<u>::<u></u>{Left 4}
^!u::Send , ^c<u>^v</u>
:oc:<em>::<em></em>{Left 5}
:oc:<h1>::<h1></h1>{Left 5}
:oc:<h2>::<h2></h2>{Left 5}
:oc:<h3>::<h3></h3>{Left 5}
:oc:<h4>::<h4></h4>{Left 5}
:oc:<html>::<html>{Enter}{Enter}</html>{Up}
:oc:<head>::<head>{Enter}{Enter}</head>{Up}
:oc:<body>::<body>{Enter}{Enter}</body>{Up}

:oc:br::<br>
:oc:mailto::<a href="mailto:^v"></a>{Left 4}
:oc:<div>::<div></div>{Left 6}
:oc:cmt::<{!}--  -->{Left 4}
:oc:hr::<hr>

; tables
:oc:tab::<table>{Enter}{Enter}</table>{Up}
:oc:tr::<tr>{Enter}{Enter}</tr>{Up}
:oc:td::<td></td>{Left 5}

:oc:skel::<html>{Enter}<head>{Enter}<title></title>{Enter}</head>{Enter}<body>{Enter}{Enter}</body>{Enter}</html>
Return
Remington

k6
  • Members
  • 6 posts
  • Last active: Sep 04 2011 09:20 AM
  • Joined: 09 Mar 2011

Here's my solution:

:oc:href::<a href="^v"target="_blank"></a>{Left 4}
:oc:<href>::<a href="^v"target="_blank"></a>{Left 4}
:oc:<ul>::<ul>{Enter}{Enter}</ul>{Up}
:oc:<ol>::<ol>{Enter}{Enter}</ol>{Up}
:oc:<li>::<li></li>{Left 5}
:oc:<co>::<code></code>{Left 7}
:oc:<p>::<p></p>{Left 4}
:oc:<bk>::<blockquote>^v</blockquote>
:oc:img::<img src="^v">
:oc:<img>::<img src="^v">
:oc:<str>::<strong></strong>{Left 9}
:oc:<b>::<b></b>{Left 4}
^!b::Send , ^c<b>^v</b>
:oc:<i>::<i></i>{Left 4}
^!i::Send , ^c<i>^v</i>
:oc:<u>::<u></u>{Left 4}
^!u::Send , ^c<u>^v</u>
:oc:<em>::<em></em>{Left 5}
:oc:<h1>::<h1></h1>{Left 5}
:oc:<h2>::<h2></h2>{Left 5}
:oc:<h3>::<h3></h3>{Left 5}
:oc:<h4>::<h4></h4>{Left 5}
:oc:<html>::<html>{Enter}{Enter}</html>{Up}
:oc:<head>::<head>{Enter}{Enter}</head>{Up}
:oc:<body>::<body>{Enter}{Enter}</body>{Up}

:oc:br::<br>
:oc:mailto::<a href="mailto:^v"></a>{Left 4}
:oc:<div>::<div></div>{Left 6}
:oc:cmt::<{!}--  -->{Left 4}
:oc:hr::<hr>

; tables
:oc:tab::<table>{Enter}{Enter}</table>{Up}
:oc:tr::<tr>{Enter}{Enter}</tr>{Up}
:oc:td::<td></td>{Left 5}

:oc:skel::<html>{Enter}<head>{Enter}<title></title>{Enter}</head>{Enter}<body>{Enter}{Enter}</body>{Enter}</html>
Return
Remington


I would omit > in shortcut. Like so ...
:oc:<ul::<ul>{Enter}{Enter}</ul>{Up}
:oc:<ol::<ol>{Enter}{Enter}</ol>{Up}
etc


Also check out my "Intuitive CSS shortcuts":
<!-- m -->http://www.autohotke... ... 631#471631<!-- m -->