AfterGrasp GLPRO replacement project start Feb 27th, 2002 ---------------------------------------------------------------------------- Tue, 18 December 2018 Removed 31 character limit on PRINTSTART command. Newer versions of windows do not have this limit. I recommend sticking with 31 characters for your print job title if you are using older windows versions. Limit is now 1023 characters. ---------------------------------------------------------------------------- Thu, 13 December 2018 New html text option to control whether
tags that have
no closing tag.
A note on clipboard use in AfterGRASP.
In AfterGRASP the clipboardGET commands all return the clipboard, they
don't set a variable.
drawclear white
color black
clipboardCLEAR ;clear the Windows clipboard
clipboardPUTTEXT "Hello there"
textln clipboardGETTEXT() ;displays "Hello there"
wait
This applies to RTF text and images as well:
drawclear white
set texthtml on
text ""
text strrtftohtml(clipboardgettextrtf())
wait
And here is a more complete example that checks a string if it's
a valid URL or valid eMail address:
drawclear white
color black
messagebox ValidURLCheck("http://www.google.com/test?") "http://www.google.com/test?"
messagebox ValidURLCheck("http://www.1google.com/test?") "http://www.1google.com/test?"
messagebox ValidURLCheck("http://www.google.c1om/test?") "http://www.google.c1om/test?"
messagebox ValidURLCheck("http://www.g_oogle.com/test?") "http://www.g_oogle.com/test?"
messagebox ValidURLCheck("www.google.com/test?") "www.google.com/test?"
messagebox ValidURLCheck("http://192.168.2.2@admin:test") "http://192.168.2.2@admin:test"
messagebox ValidEmailCheck("rob.howarth@eu.jll.com") "rob.howarth@eu.jll.com"
messagebox ValidEmailCheck("john.hello@ibm.com") "john.hello@ibm.com"
messagebox ValidEmailCheck("john.hello@ibm.coma") "john.hello@ibm.coma"
messagebox ValidEmailCheck("john.hello@ibm.c1om") "john.hello@ibm.c1om"
messagebox ValidEmailCheck("john.@hello@ibm.com") "john.@hello@ibm.com"
messagebox ValidEmailCheck("john.@hello@ibm.co.uk") "john.@hello@ibm.co.uk"
messagebox ValidEmailCheck("john.@hello@ibm.co.k") "john.@hello@ibm.co.k"
exitnow
ValidEmailCheck:
declare emailstr
local atcount 0
for i count strlen(@emailstr)
c = strmid(@emailstr, @i, 1)
if @c=="@"&&!@atcount
inc atcount
continue
endif
if strsearch("_%+-.0123456789",@c) continue
if strupper(@c)==strlower(@c) failemail
next
domainstr = strleftright(@emailstr, strsearch(@emailstr, "@")+1)
return ValidDomainCheck(@domainstr)
failemail:
return @FALSE
ValidURLCheck:
declare urlstr
for i count strlen(@urlstr)
c = strmid(@urlstr, @i, 1)
if strsearch("-_.!~*'()a-zA-Z0-9;/?:@&=+$,%#0123456789",@c) continue
if strupper(@c)==strlower(@c) failurl
next
urlstr = strlower(@urlstr)
if strleft(@urlstr,4)=="www."
else if strleft(@urlstr,7)=="http://"
urlstr = strleftright(@urlstr, 8)
else if strleft(@urlstr,8)=="https://"
urlstr = strleftright(@urlstr, 9)
else if strleft(@urlstr,6)=="ftp://"
urlstr = strleftright(@urlstr, 7)
else
goto failurl
endif
domainstr = @urlstr
if strsearch(@domainstr, "/")
domainstr = strleft(@domainstr, strsearch(@urlstr, "/")-1)
endif
if strsearch(@domainstr, "@")
domainstr = strleft(@domainstr, strsearch(@urlstr, "@")-1)
endif
if strsearch(@domainstr, ":")
domainstr = strleft(@domainstr, strsearch(@urlstr, ":")-1)
endif
return ValidDomainCheck(@domainstr)
failurl:
return @FALSE
ValidDomainCheck:
declare domainstr
if !strsearch(@domainstr, ".") faildomain
if strleft(@domainstr,1)=="."||strright(@domainstr,1)=="." faildomain
local anyletter @FALSE
for i count strlen(@domainstr)
c = strmid(@domainstr, @i, 1)
if strsearch(".0123456789",@c) continue
anyletter = @TRUE
if strupper(@c)==strlower(@c) faildomain
next
if @anyletter
domainsuffix = strlower(strleftright(@domainstr, strsearchreverse(@domainstr, ".")+1))
for i count strlen(@domainsuffix)
c = strmid(@domainsuffix, @i, 1)
if strupper(@c)==strlower(@c) faildomain
next
if strlen(@domainsuffix)<2 faildomain
if strlen(@domainsuffix)>2
local domains array("com","org","net","gov","mil","biz","info","mobi","name","aero","jobs","museum")
if !arraysearch(&domains, @domainsuffix)->size faildomain
endif
endif
return @TRUE
faildomain:
return @FALSE
----------------------------------------------------------------------------
Mon, 08 September 2008
STRHTMLTAGS changed to return an array, not a list of seperate values.
This is because the index of the array is the string position where
each tag is found in the string.
TAGLISTARRAY = STRHTMLTAGS(STRING, POSITION)
The count for STRMID now defaults to 1 if none given, for example
this routine checks a string to see if it's a valid email address:
drawclear white
color black
messagebox ValidEmailCheck("john.hello@ibm.com") "john.hello@ibm.com"
messagebox ValidEmailCheck("john.hello@ibm.coma") "john.hello@ibm.coma"
messagebox ValidEmailCheck("john.hello@ibm.c1om") "john.hello@ibm.c1om"
messagebox ValidEmailCheck("john.@hello@ibm.com") "john.@hello@ibm.com"
messagebox ValidEmailCheck("john.@hello@ibm.co.uk") "john.@hello@ibm.co.uk"
messagebox ValidEmailCheck("john.@hello@ibm.co.k") "john.@hello@ibm.co.k"
exitnow
ValidEmailCheck:
declare emailstr
local atcount 0
for i count strlen(@emailstr)
c = strmid(@emailstr, @i)
if @c=="@"&&!@atcount
inc atcount
continue
endif
if strsearch(".0123456789",@c) continue
if strupper(@c)==strlower(@c) fail
next
domainstr = strleftright(@emailstr, strsearch(@emailstr, "@")+1)
if !strsearch(@domainstr, ".") fail
domainsuffix = strlower(strleftright(@domainstr, strsearchreverse(@domainstr, ".")+1))
for i count strlen(@domainsuffix)
c = strmid(@domainsuffix, @i)
if strupper(@c)==strlower(@c) fail
next
if strlen(@domainsuffix)<2 fail
if strlen(@domainsuffix)>2
local domains array("com","org","net","gov","mil","biz","info","mobi","name","aero","jobs","museum")
if !arraysearch(&domains, @domainsuffix)->size fail
endif
return @TRUE
fail:
return @FALSE
----------------------------------------------------------------------------
Wed, 20 August 2008
STRHTMLREPAIR and STRHTMLCLEAN now have one or more optional position
options.
SET RESULT STRHTMLREPAIR(STR)
SETS RESULT NEWPOS1 STRHTMLREPAIR(STR, POS1)
SETS RESULT NEWPOS1 NEWPOS2 STRHTMLREPAIR(STR, POS1, POS2)
SET RESULT STRHTMLCLEAN(STR)
SETS RESULT NEWPOS1 STRHTMLCLEAN(STR, POS1)
SETS RESULT NEWPOS1 NEWPOS2 STRHTMLCLEAN(STR, POS1, POS2)
POS is a string position from 1 to the length of STR
Any number of string positions are supported (not just 1 or 2).
Useful for tracking a position in a HTML string after
it's been repaired or cleaned, for instance:
rstr = "Hello There"
rstrstart = strsearch(@rstr, "Hello")
rstrend = strsearch(@rstr, "There")-1
sets rstr rstrstart rstrend strhtmlclean(@rstr, @rstrstart, @rstrend)
messagebox @rstr strmidhtml(@rstr, @rstrstart, @rstrend-@rstrstart) ; shows "Hello"
----------------------------------------------------------------------------
Sun, 10 August 2008
Fixed several crashing bugs with IMAGEPUT and other image operations when
DRAWOFFSET is set to coordinates outside valid coordinates.
All the TEXTRECTS commands now have the RIGHT edge value stored at the start
of the list corrected. It was too large, having the left position added
to it twice by accident.
DRAWLISTIMAGE has been expanded to have 3 more (optional) options.
IMAGEBUF = DRAWLISTIMAGE(DRAWLIST)
IMAGEBUF = DRAWLISTIMAGE(DRAWLIST, STARTPOS)
IMAGEBUF = DRAWLISTIMAGE(DRAWLIST, STARTPOS, COUNT)
IMAGEBUF = DRAWLISTIMAGE(DRAWLIST, STARTPOS, COUNT, COLOR)
DRAWLIST is the array of rectangles, generally created by TEXTLINESRECTS.
STARTPOS is the offset to start drawing from the list from, default is 1
COUNT is the number of RECTS to draw from the list, default is all.
COLOR is a color to draw the RECTS in, default is to use index as color value.
These options make it possible to use DRAWLISTIMAGE to create a mask
used to show a selected body of text. For instance, something like this:
drawclear white
color black
rectarray = textlinesrects("Hello There")
rectimage = drawlistimage(rectarray, 2, 4, white)
with drawxor on imageput rectimage
wait
New WHEN option "OTHER" used in the same circumstances as INSIDE and OUTSIDE.
WHEN name MOUSE[DOWN|UP][1|2|3] OTHER
It is triggered if no other defined whens are triggered by the MOUSEUP
or MOUSEDOWN eventid. This is useful for handling the case where someone clicks
outside all active hotspots or other WHEN INSIDE whens.
----------------------------------------------------------------------------
Thu, 07 August 2008
Three new commands, STRHTMLTAGS, STRHTMLREPAIR and STRHTMLCLEAN.
STRHTMLCLEAR and STRHTMLREPAIR are still under development and
do not work correctly yet.
STRHTMLTAGS gives a list of active tags at that string position.
It returns multiple values, so you would commonly use functions like
ARRAY or STRLIST on the return values.
TAGLIST = ARRAY(STRHTMLTAGS(STRING, POSITION))
For instance strhtmltags("
Hello
",4) gives "b".
Tags are converted to all lower case.
STRHTMLREPAIR removes any duplicate/redundant tags, fixes mismatched trailing
tags, and adds any missing trailing tags.
REPAIRSTRING = STRHTMLREPAIR(STRING)
For instance:
strhtmlrepair("Hello") gives "Hello"
strhtmlrepair("Hello") gives "Hello"
strhtmlrepair("Hello") gives "Hello"
strhtmlrepair("Hello