- Instructions on how to Concatenate a list
- Replaced the and/comma routine with the old one, should work better now
- If you ALWAYS include [*] after a number it shouldn't get out of sync.
- Edit: I cleaned up some grammar typos in the code, added a short intro at the top of the script, others may find it useful ...
Update 2 - 15 April 2009:
Added
Join`n % to list, saves you the trouble of escaping each %
Reference:
http://www.autohotkey.com/docs/Scripts.htm#continuation
Update 1 - 14 April 2009:
50acdef
=
The external walls are concrete
, brick
, mud
and stone with rendered verticals.
50acdf
The external walls are concrete, brick and stone with rendered verticals.
50acf
The external walls are concrete and stone with rendered verticals.
50af
The external walls are stone with rendered verticals.
Code:
/*
Multi choice text and grammar correction (Expand shorthand code)
Autohotkey 1.47+ @ http://www.autohotkey.com/
Forum : http://www.autohotkey.com/forum/topic43116.html
Usage : Type shorthand and press numpad0 (zero on the numeric keyboard)
Date : 14 April 2009
For : Stephen Mika @ University of Reading (UK)
Mandatory LIST FORMAT:
Number_[*]_Sentence
where _ denotes a space, if the [*] is not present it will fail
[*] Always include this start section
[A] Optional section as in 5ace
[-] Must always be included regardles of section of which it seems to be part of: [B] This is optional [-] but this section must always be included [C] Another optional peice
\, and /, one or more are translated to the correct number of commas and "and" see script below for explanation
If ... is part of a section user Input is requested
*/
list=
(Join`n %
1 [*] None
2 [*] Not applicable.
3 [*] Inspected on the ....
4 [*]
5 [*] We are pleased to advise you that in our opinion this property is, on the whole, a reasonable purchase at the agreed price of £.... We found no evidence of any significant defects or shortcomings and providing the property is kept in good repair, we cannot foresee any special difficulties arising on resale in normal market conditions.
6 [*] The property is considered to be a reasonable purchase at the agreed price of £... provided that you are prepared to accept the cost and inconvenience of dealing with the various repair/improvement works reported. These deficiencies are quite common in properties of this age and type and as long as the necessary works are carried out to a satisfactory standard and the property is kept in good repair, we can see no reason why there should be any special difficulties on resale in normal market conditions.
7 [*] The property suffers from the exceptional disadvantage that ... and the agreed price of £... reflects this. However, we must advise you that in our opinion it is likely to have an adverse effect on resale. We therefore, urge you to consider with the utmost care whether you wish to proceed with the purchase.
8 [*] The property is considered to be a reasonable purchase provided that you are prepared to accept the cost and inconvenience of dealing with the various repair/improvement works reported. However, the agreed price of £... is in our opinion too high and you may wish to renegotiate it on the basis of the cost of the necessary repairs. [A] There is the further consideration that even if the works are carried out to a satisfactory standard, the particular disadvantage of ... will remain. You may, therefore, find resale difficult even if market conditions are favourable at the time.
9 [*] In our opinion the property is not a reasonable purchase at the agreed price of £.... This is because .... We very much regret, therefore, that we must advise you that it would be most unwise to proceed.
10 [*] This property is in need of extensive remedial/modernisation works and we recommend that, if you wish to proceed, you should obtain further advice and quotations as discussed in the report and listed in Section F. Although our overall opinion on the Market Value of the property would normally be given, in this particular case it is not possible to do so because of the very substantial nature and extent of the proposed works. However, we will be pleased to give our opinion as soon as this additional information becomes available.
11 [*] We are pleased to advise you that in our opinion this property is, on the whole, a reasonable purchase at or near the valuation. We found no evidence of any significant defects or shortcomings and providing the property is kept in good repair, we cannot foresee any special difficulties arising on resale in normal market conditions.
12 [*] The property is considered to be a reasonable proposition for purchase at the valuation provided that you are prepared to accept the cost and inconvenience of dealing with the various repair/improvement works reported. These deficiencies are quite common in properties of this age and type and as long as the necessary works are carried out to a satisfactory standard and the property is kept in good repair, we can see no reason why there should be any special difficulties on resale in normal market conditions.
13 [*] The property suffers from the exceptional disadvantage that ... and the valuation reflects this. However, we must advise you that in our opinion it is likely to have an adverse effect on resale. We, therefore, urge you to consider with the utmost care whether you wish to proceed with the purchase.
14 [*] The property is considered to be a reasonable purchase at the valuation provided that you are prepared to accept the cost and inconvenience of dealing with the various repair/improvement works reported. [A] There is the further consideration that even if the works are carried out to a satisfactory standard, the particular disadvantage of ... will remain. You may, therefore, find resale difficult even if market conditions are favourable at the time.
15 [*] In our opinion the property is not a reasonable purchase. This is because of .... We very much regret, therefore, that we must advise you that it would be most unwise to proceed.
16 [*] This property is in need of extensive remedial/modernisation works and we recommend that, if you wish to proceed, you should obtain further advice and quotations as discussed in the report and listed in Section F. Although our overall opinion on the Market Value of the property would normally be given, in this particular case it is not possible to do so because of the very substantial nature and extent of the proposed works. However, we will be pleased to give our opinion as soon as this additional information becomes available.
17 [*]
18 [*]
19 [*]
20 [*] The property is a [A] single storey [B] two storey [C] ... storey [D] split level [E] non-[F] traditional [G] back-to-back [H] mid-terraced [I] end-terraced [J] semi-detached [K] link detached [L] detached [M] chalet style [N] house [O] bungalow [P] cottage [-] built around ....
21 [*] The property is a [A] converted [B] purpose-built [C] self-contained [D] single storey [E] two storey [F] basement [G] ground floor [H] first floor [I] second floor [J] ... floor [K] flat [L] maisonette [-] with ... others in a ... storey building, built around ....
22 [*] We believe it was originally constructed for the [A] ... [B] local authority. [C] New Town Development Corporation. [D] housing association.
23 [*] [A] It has been extended to the [B] front\, [C] side\, [D] rear\, [E] The accommodation has been extended into the roof [F] recently. [G] and this was carried out in .... [H] and your legal advisers should find out when this was carried out. [I] You should check whether local authority permission for the work has been obtained and in this respect, we refer you to our comments in Section E2.
24 [*] It was originally a ... and [A] was converted to its present form in .... [B] was converted to its present form some time ago. [C] your legal advisers should find out when this was carried out. [D] A check should be made whether local authority permission has been obtained for the work and we refer you to our comments in Section E2.
25 [*] The front of the building faces approximately [A] north [B] north east [C] east [D] south east [E] south [F] south west [G] west [H] north west [-] and all directions in this report are given as if viewing the property from the front. [I] The main entrance is on the ... of the property.
26 [*]
27 [*]
28 [*]
29 [*]
30 [*] The external walls are of [A] traditional [B] non-traditional [C] timber framed [D] cavity [E] and [F] solid [-] construction [G] (approximately ... mm thick) [H] (varying in thickness from ... mm to ... mm) [-] with [I] mainly [J] brick\, [K] reconstituted [L] stone\, [M] rendered\, [N] ...\, [O] clad [-] elevations.
31 [*] The main roof is [A] pitched and [B] flat and [-] covered with [C] tiles. [D] slates. [E] felt. [F] .... [-] Internally, the [G] floor is [H] floors are [I] mainly [-] of [J] timber [K] and [L] with some [M] solid [N] concrete [O] ... [-] construction.
32 [*] The [A] ... [B] addition [C] portion [D] also [-] has a [E] tile [F] slate [G] felt [H] ... [-] covered roof.
33 [*] The ... extension is [A] also [-] constructed in [B] ... mm thick [C] ... [D] brickwork\, [E] reconstituted [F] stone\, [G] rendered masonry\, [-] with a [H] timber [I] and [J] concrete [-] floor and a [K] tile [L] slate [M] felt [N] ... [-] covered roof.
34 [*] The [A] ... mm thick [-] external walls of the block are built of [B] concrete [C] brick\, [D] reconstituted [E] stone\, [F] rendered [G] masonry\, [H] ... [I] with ... cladding [-] and are of [J] timber framed [K] cavity [L] and [M] solid [-] construction. The main roof is covered with [N] tiles. [O] slates. [P] felt. [Q] ....
35 [*]
36 [*]
37 [*]
38 [*]
39 [*]
40 [*] [A] Basement: [B] Cellar:
41 [*] Ground floor:
42 [*] First floor:
43 [*] Second floor:
44 [*] ... floor:
45 [*]
46 [*]
47 [*]
48 [*]
49 [*]
50 [*] There is no garage with this property.
51 [*] There is [A] a terraced [B] a semi-detached [C] an attached [D] a detached [E] an integral [F] single [G] double [H] triple [-] garage with the property. [I] This is located in a separate block.
52 [*] [A] There is [B] There are [C] also [D] a shed\, [E] ... sheds\, [F] a greenhouse\, [G] an external w.c.\, [H] a conservatory\, [I] a covered way\, [J] a carport\, [K] ... [L] in the ... garden. [M] attached [N] to the ... of the property.
53 [*] [A] No [B] Only on-street [C] Off-street [D] Both on and off-street [-] parking is available. [E] Parking times are, however, restricted. [F] A residents' parking scheme operates in the immediate area. [G] Space is limited and parking may be a problem from time to time. [H] However, there is no dropped kerb adjoining the road for cars to gain access onto the property and we refer you to our comments in Section E2.
54 [*] There is a [A] covered [B] open air [C] swimming pool\, [D] tennis court\, [E] leisure complex\, [F] ... [G] in the ... garden. [H] at the ... of the property. [-] No comments can be made as this is outside the scope of the homebuyer service.
55 [*] There is no private garden with this property.
56 [*] The property has a [A] communal [B] surrounding [C] front\, [D] side\, [E] rear\, [-] garden. [F] The front garden is open plan with a drive.
57 [*] The property [A] fronts onto the pavement and [-] has a [B] small front [C] forecourt and a [D] garden and a [E] shared [F] private enclosed [-] rear [G] yard. [H] garden.
58 [*]
59 [*]
60 [*] The property is [A] on a small [B] on a large [C] ... [D] estate [-] in a [E] mixed [F] predominantly [G] residential\, [H] commercial\, [I] semi-rural [J] rural [-] area [K] within reasonable distance of the usual amenities. [L] with limited [M] with no [N] shopping facilities in the locality. [O] There is a wide range of shops and other services in ... which is approximately ... miles away.
61 [*] Public transport is [A] also [B] limited. [C] available in the immediate locality.
62 [*] On the estate there [A] is one other similar block of [B] are ... other similar blocks of [C] flats. [D] maisonettes.
63 [*] The immediate neighbourhood [A] is rather run down with a number of properties vacant and in various states of repair. [B] contains a number of rented properties. [C] has been substantially improved in recent years.
64 [*] The property is on a [A] relatively [B] flat [C] sloping [D] steep [E] low lying [F] terraced [-] site. [G] It is close to the [H] river [I] .... [J] Your legal advisers should make enquiries about the risk of flooding and we would refer you to our recommendations in Section E4.
65 [*] Access will be difficult [A] owing to the proximity of the main road\, [B] because of the restricted visibility\, [C] during severe weather as the drive is very steep\, [-] and great care must be taken with vehicles when entering or leaving the property. [D] As this could affect future saleability, we would refer you to our comments in Section F3.
66 [*] We believe the property is [A] also [B] on [C] close to [-] a former landfill site. Further enquiries should be made by your legal advisers and we refer you to our comments in Section E4. [D] This could also affect future saleability and you should consider our advice in Section F3.
67 [*] There is high voltage electrical supply equipment close to the property. The possible effects of electromagnetic fields have been the subject of media coverage. The Health Protection Agency (HPA), an independent body with responsibility for advising on electromagnetic fields, has advised that, following studies, there may be a risk, in specified circumstances, to the health of certain categories of people. Public perception may, therefore, affect marketability and future value of the property. Further, and detailed, technical information can be obtained from the HPA, Centre for Radiation, Chemical and Environmental Hazards at Chilton, Didcot, Oxon, OX11 ORO or at http://www.hpa.org.uk/radiation/default.htm or the environmental health department of the local authority, or from the local electricity company. [A] As mentioned, this could affect future saleability and we therefore, refer you to our recommendations in Section F3.
68 [*] The Health Protection Agency (HPA) has identified the local area as one in which, in more than 1% of dwellings, the levels of radon gas entering the property are such that remedial action is recommended. It is not possible in the course of the inspection/survey to determine whether radon gas is present in any given building, as the gas is colourless and odourless. Tests can be carried out to assess the level of radon in a building. At a small charge test instruments and results are available by post from the HPA and other approved laboratories. The minimum testing period is 3 months. The HPA strongly advises against using shorter-term instruments as they can give misleading results. If tests have not been carried out, they are recommended. It has been the experience of the HPD that it is not expensive, in proportion to the value of the property, to effect the recommended remedial measures. You can obtain further information from the HPD, Centre for Radiation, Chemical and Environmental Hazards at Chilton, Didcot, Oxon, OX11 ORO or at http://www.hpa.org.uk/radiation/default.htm or the environmental health department of the local authority. [A] Further enquiries should be made by your legal advisers and we refer you to our comments in Section E4. [B] As this could also affect future saleability, you should consider our comments in Section F3.
69 [*] The [A] proposed [B] building [C] road [D] development which we believe is taking place in the vicinity\, [E] proximity of [F] the motorway\, [G] the main road\, [H] the footpath\, [I] the right of way\, [J] the railway\, [K] the public house\, [L] a livestock farm\, [M] the ... airport flight path\, [N] the industrial estate\, [O] the sewage treatment plant\, [P] ... [Q] some ... miles away [-] may be a nuisance. [R] Further enquiries should be made by your legal advisers and we refer you to our recommendations in Section E4. [S] As this could also affect future saleability, we refer you our comments in Section F3.
70 [*] We believe the property [A] may be listed and [B] has been listed and [C] may be within a conservation area and [D] is located within a conservation area and [E] may have an agricultural occupancy restriction and [F] has an agricultural occupancy restriction and [-] a number of planning restrictions may therefore, be in force. Your legal advisers should make further enquiries about this and we refer you to our comments in Section E2.
)
Loop, parse, list, `n, `r
{
StringLeft, Number, A_LoopField, (InStr(A_LoopField, A_Space) - 1)
Sentence%Number% := SubStr(A_LoopField, InStr(A_LoopField, A_Space))
}
Numpad0::
AutoTrim, on
ClipSaved := ClipboardAll ; Save the entire clipboard to restore later
Clipboard= ; clear clipboard
Send, ^+{left}^x ; cut word to the left
Clipwait, 2 ; wait for clipboard to have content
RegExMatch(Clipboard, "^\d+", Number) ; get sentence number
Line := Sentence%Number%
StringReplace, Line, Line, [-], _, All ; mark for later use - they MUST be included but can not be part of the sections array
StringSplit, Section, Line, [ ; split string into sections (array)
Loop, % Section0 ; loop to remove "letter]"
StringTrimLeft, Section%A_Index%, Section%A_Index%, 2
StringReplace, Shorthand, Clipboard, %Number%, , All ; translate shorthand code to section code
StringReplace, Shorthand, Shorthand, a, 3`,, all
StringReplace, Shorthand, Shorthand, b, 4`,, all
StringReplace, Shorthand, Shorthand, c, 5`,, all
StringReplace, Shorthand, Shorthand, d, 6`,, all
StringReplace, Shorthand, Shorthand, e, 7`,, all
StringReplace, Shorthand, Shorthand, f, 8`,, all
StringReplace, Shorthand, Shorthand, g, 9`,, all
StringReplace, Shorthand, Shorthand, h, 10`,, all
StringReplace, Shorthand, Shorthand, i, 11`,, all
StringReplace, Shorthand, Shorthand, j, 12`,, all
StringReplace, Shorthand, Shorthand, k, 13`,, all
StringReplace, Shorthand, Shorthand, l, 14`,, all
StringReplace, Shorthand, Shorthand, m, 15`,, all
StringReplace, Shorthand, Shorthand, n, 16`,, all
StringReplace, Shorthand, Shorthand, o, 17`,, all
StringReplace, Shorthand, Shorthand, p, 18`,, all
StringReplace, Shorthand, Shorthand, q, 19`,, all
StringReplace, Shorthand, Shorthand, r, 20`,, all
StringReplace, Shorthand, Shorthand, s, 21`,, all
StringReplace, Shorthand, Shorthand, t, 22`,, all
StringReplace, Shorthand, Shorthand, u, 23`,, all
StringReplace, Shorthand, Shorthand, v, 24`,, all
StringReplace, Shorthand, Shorthand, w, 25`,, all
StringReplace, Shorthand, Shorthand, x, 26`,, all
StringReplace, Shorthand, Shorthand, y, 27`,, all
StringReplace, Shorthand, Shorthand, z, 28`,, all
; etc if you need more.
StringTrimRight, Shorthand, Shorthand, 1 ; remove trailing ","
Shorthand = 2,%Shorthand% ; always include "first" sections (which is 2)
Loop, % Section0 ; loop all sections
{
Append:=Section%A_Index%
IfInString, Append, _ ; at least part of this section must always be included
{
StringSplit, SplitAppend, Append, _
Append:=SplitAppend1
}
If A_Index IN %Shorthand% ; get each section from Shorthand
{
IfInString, Append, ..
{
InputBox, InsertText, Insert Text, %FullText% %A_Space% %Append%
StringReplace, Append, Append, ..., %InsertText%, All
}
}
Else
Append=
FullText .= Append " " SplitAppend2
SplitAppend2=
}
Loop ; get rid of space comma
{
StringReplace, FullText, FullText, %A_Space%`,,`,,UseErrorLevel
if ErrorLevel = 0 ; No more replacements needed.
break
}
Loop ; get rid of double spacing
{
StringReplace, FullText, FullText, %A_Space%%A_Space%,%A_Space%,UseErrorLevel
if ErrorLevel = 0 ; No more replacements needed.
break
}
FullText = %FullText% ; get rid of leading and trailing spaces
FullText .= " " ; add space Smile
; if one instance of \, is found, it is removed,
; if two instances are found, the first is replaced with an 'and' and the second one removed,
; if three or more of the instances are found, the last but one is replaced with an 'and' and the other \, tags are replaced with commas;
StringReplace, FullText, FullText, \`, , \`,, UseErrorLevel ; get number of commas
Commas:=ErrorLevel
If (Commas = 1)
StringReplace, FullText, FullText, \`, ,
Else If (Commas = 2)
{
StringReplace, FullText, FullText, \`, , %A_Space%and
StringReplace, FullText, FullText, \`, ,
}
Else If (Commas > 2)
{
Loop % Commas
{
If (A_Index = Commas - 1)
{
StringReplace, FullText, FullText, \`, , %A_Space%and
StringReplace, FullText, FullText, \`, ,
Break
}
Else
StringReplace, FullText, FullText, \`, , `,
}
}
; if one instance of /, is found, it is removed,
; if two instances are found, the first is replaced with an 'and' and the second one removed,
; if three or more of the instances are found, the last but one is replaced with an 'and' and the other \, tags are replaced with commas;
StringReplace, FullText, FullText, /`, , /`,, UseErrorLevel ; get number of commas
Commas:=ErrorLevel
If (Commas = 1)
StringReplace, FullText, FullText, `/`, ,
Else If (Commas = 2)
{
StringReplace, FullText, FullText, `/`, , %A_Space%and
StringReplace, FullText, FullText, `/`, ,
}
Else If (Commas > 2)
{
Loop % Commas
{
If (A_Index = Commas - 1)
{
StringReplace, FullText, FullText, /`, , %A_Space%and
StringReplace, FullText, FullText, /`, ,
Break
}
Else
StringReplace, FullText, FullText, /`, , `,
}
}
;find any remaining ... and prompt for replacement
Loop {
If InStr(FullText, "...") {
StringReplace, promptText, FullText, ... , -->...<--
InputBox, InsertText, Insert Additional Text, %promptText%
StringReplace, FullText, promptText, -->...<--, %InsertText%
} else {
break
}
}
Clipboard:=FullText
Sleep, 10
FullText= ; clear variables to free the memory
Line=
Number=
Shorthand=
Commas=
Send ^v ; paste
Clipboard := ClipSaved ; Restore the original clipboard. Note the use of Clipboard (not ClipboardAll).
ClipSaved = ; Free the memory in case the clipboard was very large
Return