topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 5:54 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: CHS: New Formatting Dialog  (Read 40051 times)

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #50 on: October 19, 2011, 03:10 PM »
you MUST include lines in your perl to flush stdout!
Is that just a PERL thing, or required with any utility?

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #51 on: October 19, 2011, 05:40 PM »
ah you caught me.  i can add an option to fix that.  right now it uses the clipboard to sanitize it and leaves the plaintext on it.  i could use a different technique.
Sorry, I didn't mean to "catch" you!
If it's too much hassle and a low priority to fix that, and if it's just for me, then I could always go back to using the AHK hotkey combo that I described above/elsewhere.

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #52 on: October 26, 2011, 06:57 PM »
Not sure if this is news to you, but I noticed last night that the CHS copy/paste functionality is different when you copy/paste an image as opposed to copy/paste text.

For example:
With .PNG/.JPG/.GIF image files: (and this is repeatable with consistent results):
  • Open a .PNG image file in Irfanview. Press Ctrl+c (for Copy). If the file is a smaller file, then a Copy "ping" sound occurs, or if a larger file, then No Copy "ping" sound occurs. (It should always sound.)
  • CHECK #1: Open CHS and look at last clipped record - If the file is a smaller file, then the image you just copied is there, or if a larger file, then the image you just copied is not there. (It should always be there.)
  • Open a page in MS OneNote or MS Word (the following steps work the same in either proggy).
  • Press Ctrl+v - the image is pasted OK.
  • CHECK #2: Press Ctrl+Shift+V - nothing is pasted (which is what I would expect, as that should only paste unformatted text).
  • Press Ctrl+v - the image is pasted OK. (This proves that the buffer holding the image has not been cleared.)
  • CHECK #3: Open CHS again and look at last clipped record - the image is either there/not there consistent with CHECK #1.

Clearly, the image is retained in a buffer somewhere, but apparently if it is over a certain size, then it never gets stored in the CHS database.
User requirements not met:
   1. The "ping" sound should sound on each Copy, if a sound has been selected/enabled in CHS for this.
   2. The image copied should always be stored in the database. (At least, that's what I would presume the user requirement to be.)

(I couldn't recall whether you had set a max upper size limit for the image size that could be stored in a CHS database.)

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #53 on: October 26, 2011, 08:24 PM »
Is it this?

CH+SImageSize.pngCHS: New Formatting Dialog

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #54 on: October 26, 2011, 09:27 PM »
@cranioscopical: Thanks for pointing that out. Actually, I'm not sure what that is.
My settings say "Max X*Y area (Kb) 1000" - I presume that relates to Kb of data, but I am not certain.
I guess I need to understand what it is first.

One of the smaller images that CHS stored in its database was a .JPG file of size 41.9kB, and 900x750 pixels on display.
One of the larger images that CHS did not store in its database was a .PNG file size of 172.4kB, and 1349x1766 pixels on display.


mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #55 on: October 27, 2011, 09:55 AM »
you MUST include lines in your perl to flush stdout!
Is that just a PERL thing, or required with any utility?

it might be with any language/utility where one redirects stdin and stdout, it may depend on the way the language does it.  only way is to try.
but i still recommend using the file input and output methods -- that seems more reliable to me than redirecting stdin/stdout.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #56 on: October 27, 2011, 09:58 AM »
The way to read that threshold number in the options is to multiply the new candidate image width*height, then divide by 1000.
If the value you get for your new image is larger than that number, it will be rejected.

For your sample image that was rejected your image was:  (1349*1766)/1000 = 2382.334

So the default options value of 1000 would have rejected it.

If you want to copy every image just set that value to something like 99999.

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #57 on: October 27, 2011, 11:34 AM »
So the default options value of 1000 would have rejected it.

If you want to copy every image just set that value to something like 99999.

Thanks for the solution.
I just reached that empirically and returned here only to find your response. Last past the post, as ever  ;D

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #58 on: October 27, 2011, 03:32 PM »
+1 for what @cranioscopical said. Many thanks for the explanation of that. Sorry if I had missed it elsewhere.    :-[

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #59 on: November 13, 2011, 04:47 PM »
Just been trying to put Jason Hood's version of "Ministry of Truth," a multiple search-and-replace utility, as a user tool into the Presets.  I'm getting an error message from it:

mtr: \N is not a valid escape sequence in C:\NoInst\ClipboardHelpAndSpell\tmpin.txt


When I look at the (test) input text in CHS's grid, it looks like the first screenshot below.

Where are the "\n" coming from?  Is that what's causing a problem?



mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #60 on: November 13, 2011, 05:03 PM »
I'm fairly sure it's mad about the commandline invocation with the %infile% name having spaces in it and not being double quoted.

In your arguments list, try putting double quotes around the %infile%, so its "%infile%"

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #61 on: November 14, 2011, 03:11 PM »
I'm fairly sure it's mad about the commandline invocation with the %infile% name having spaces in it and not being double quoted.

Still didn't work.  Essentially the same command line does work as a Text Filter in TED Notepad, using its %~S parameter for marked text, so either I haven't understood CHS's parameters correctly, or there's a significant difference in how the two programs handle STDIN/STDOUT, or both.  I found I could make it work by a minor cheat; wrapping the utility in a batch file.  The batch file is:
c:\dos\utils\mtrw.exe -q -n -w -o+ -b- -c- -i:"c:\Users\R.J. Bull\pcw\Spellchk\SPELC_MT.MT" C:\NoInst\ClipboardHelpAndSpell\tmpin.txt > C:\NoInst\ClipboardHelpAndSpell\tmpout.txt

and the matching CHS Preset configuration is as in the screenshot.

How does one delete a user-entered Preset, please?

I should add: you give four slots for search-and-replace pairs in CHS's standard presets, which is generous; that's the same as the payware version of Boxer Software's Text Monkey.  The advantage of using MiniTrue is that it's a freeware that gives you an essentially unlimited number of pairs, especially now it's available in Windows 32-bit form.  It's still a rather strange program, though.
« Last Edit: November 14, 2011, 03:17 PM by rjbull »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #62 on: November 14, 2011, 03:23 PM »
or there's a significant difference in how the two programs handle STDIN/STDOUT,

this would be my first guess.

could you do this: take the commandline that CHS would run, and run that manully under a dos window.  does it produce the right output?

and when you try to run it from CHS, what error does it give you?

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #63 on: November 18, 2011, 02:53 PM »
could you do this: take the commandline that CHS would run, and run that manully under a dos window.  does it produce the right output?

and when you try to run it from CHS, what error does it give you?

Here's what I did, but it's getting my head in a spin.  Both these command lines - minor variations - work properly in a console window:

c:\DOS\Utils\mtrw.exe -q -n -w -o+ -b- -c- -i:SPELC_MT.MT test.txt > mod.txt

type test.txt | c:\DOS\Utils\mtrw.exe -q -n -w -o+ -b- -c- -i:SPELC_MT.MT >
mod.txt

So far, the batch file method in the earlier message seems to work perfectly.  It's the only one that does.  I also tried the following, to the point where I lost track of what I was doing:

---------

Using MT to change the file in-place:

Program/Script: c:\DOS\Utils\mtrw.exe

Arguments: -q -n -w -b- -c- -i:"c:\Users\R.J.
Bull\pcw\Spellchk\SPELC_MT.MT""%infile%"

Input: Create %inifile%

Output: Read from %inifile%

Returned:
Error RE-reading input file C:\NoInst\ClipboardHelpAndSpell\tmpin.txt (for tool
output, see tool config) -- nothing changed in file --  after tool run:
c:\DOS\Utils\mtrw.exe with params -q -n -w -b- -c- -i:"c:\Users\R.J.
Bull\pcw\Spellchk\SPELC_MT.MT""C:\NoInst\ClipboardHelpAndSpell\tmpin.txt"

---------

Using MT to change the file in-place, ignore outfile:

Program/Script: c:\DOS\Utils\mtrw.exe

Arguments: -q -n -w -b- -c- -i:"c:\Users\R.J.
Bull\pcw\Spellchk\SPELC_MT.MT""%infile%"

Input: Create %inifile%

Output: Ignore

Returned:
CHS reported Custom tool finished successfully, but it didn't do anything (no
changes)

---------

Using redirection to make a new file:

Program/Script: c:\DOS\Utils\mtrw.exe

Arguments: -q -n -w -o+ -b- -c- -i:"c:\Users\R.J. Bull\pcw\Spellchk\SPELC_MT.MT"
"%inifile%" > "%outfile%"

Input: Create %inifile%

Output: Read from %outfile%

Returned:
Error reading output file C:\NoInst\ClipboardHelpAndSpell\tmpout.txt after tool run:
c:\DOS\Utils\mtrw.exe with params -q -n -w -o+ -b- -c- -i:"c:\Users\R.J.
Bull\pcw\Spellchk\SPELC_MT.MT" "%inifile%" >
"C:\NoInst\ClipboardHelpAndSpell\tmpout.txt"

---------


As above but with redirection symbol wrapped in quotes, ">"

Returned:
Error reading output file C:\NoInst\ClipboardHelpAndSpell\tmpout.txt after tool run:
c:\DOS\Utils\mtrw.exe with params -q -n -w -o+ -b- -c- -i:"c:\Users\R.J.
Bull\pcw\Spellchk\SPELC_MT.MT" "%inifile%" ">"
"C:\NoInst\ClipboardHelpAndSpell\tmpout.txt"

---------

Reading from STDOUT;

Program/Script: c:\DOS\Utils\mtrw.exe

Arguments: -q -n -w -o+ -b- -c- -i:"c:\Users\R.J. Bull\pcw\Spellchk\SPELC_MT.MT"
"%inifile%"

Input: Create %inifile%

Output: Read from STDOUT

Returned:
ERROR: Previously launched tool is still running. Close that process before
continuing.


Had to kill process.  Later found an open and empty console window.

---------

Send on STDIN, Read from STDOUT

Program/Script: c:\DOS\Utils\mtrw.exe

Arguments: -q -n -w -o+ -b- -c- -i:"c:\Users\R.J. Bull\pcw\Spellchk\SPELC_MT.MT"

Input: Send on STDIN

Output: Read from STDOUT

Returned:
CHS reported Custom tool finished successfully, but it didn't do anything (no
changes)

---------

Repeat: the batch file method worked OK.  What have I missed?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #64 on: November 18, 2011, 03:03 PM »

Using MT to change the file in-place..:

for this you should have told CHS to read output from input file.  that should work.

as for the failure to read from stdout -- i suspect the cause is chs failing to read stdout properly, i will look into it.

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #65 on: November 18, 2011, 03:28 PM »

Using MT to change the file in-place..:

for this you should have told CHS to read output from input file.  that should work.

I thought I had, but, I was getting in a tangle.  Look at the one that starts "Reading from STDOUT;".  That's the one where I had to kill the process.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #66 on: November 28, 2011, 08:28 PM »
rj, i could use a little more help in understanding a test i can do to fix this.

your commandline arguements to spellcheck files make it hard for me to figure out.

can you give me a sample text, and a sample mtrw invocation that reads from stdin, writes to stdout, and tell me what i should see.  and that doesnt use any additional files like some spellcheck?

so tell me the original text, and then give me a commandline that when run reads from stdin, writes to stdout, and tell me what it produces.

then i can try to make chs work on it.

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: CHS: New Formatting Dialog
« Reply #67 on: November 30, 2011, 04:14 PM »
rj, i could use a little more help in understanding a test i can do to fix this.

your commandline arguements to spellcheck files make it hard for me to figure out.
Figuring out command lines is hard work!

can you give me a sample text, and a sample mtrw invocation that reads from stdin, writes to stdout, and tell me what i should see.  and that doesnt use any additional files like some spellcheck?

For anyone wishing to quarry more information out of the Help files, here are some Ministry of Truth resources:
  • Andrew B. Pipkin, home page of original author
  • Jason Hood's updated version.  Note, I'm using his Win32 port.
  • Eric Pement's MiniTrue page, useful supplementary information, though it refers to the original version, not Jason Hood's updated one.

The basic use of MT is:

mtr <OPTIONS> <FILES> - <STRINGS>

i.e., it expects to operate on files in situ.  <STRINGS> is the search-and-replace pairs.  These options are modified by the arguments.

Now for the way I've used it.  I don't claim to fully understand things, but - E&OE - these are the command line arguments I use:

  • -q
    Quiet mode; don't write to screen unless a match is found
  • -n
    No prompting; make all replacements automatically.  (MT can be used as a file viewer, and replacements can be made interactively)
  • -w
    Whole words only
  • -o+
    Matches and their surrounding context will be written to standard output instead of being displayed in the textviewer.  The "+" causes MT to print both matching and non-matching lines, otherwise it would behave like a grep.
  • -b-
    Don't make numbered backup files.  May not be relevant if using STDIN/STDOUT.
  • -c-
    Case sensitive
  • -i:SPELC_MT.MT
    As stated above, by default MT expects to find its search/replace strings on the command line.  -i says to take them from a file, in this case, SPELC_MT.MT
When giving MT its search/replace strings from a file, the format is simple, one line per pair,  SEARCH = REPLACE
My file is as follows, though perhaps I should explain how this came about.  When I was writing current awareness bulletins, I preferred not to use a spell checker as it slowed me down and upset the flow.  Instead, I waited until "going to press time" and tidied everything up at that stage.  I found I frequently made the same typos, so used MT to replace them before using an interactive spelling checker to catch everything else.  SPELC_MT.MT was my typo-repair file:
abd = and
abouot = about
accomodate = accommodate
accoring = according
acrulic = acrylic
additon = addition
additoinal = additional
adequaate = adequate
afecting = affecting
alos = also
alterntaive = alternative
amd = and
amke = make
angluar = angular
anounced = announced
annnounced = announced
aplication = application
applicatin = application
applicaton = application
applicatons = applications
applicaiton = application
asurance = assurance
Australina = Australian
availabilty = availability
avaiable = available
avaialable = available
avaialble = available
blck = black
caoted = coated
caoting = coatings
cardinla = cardinal
cartrdige = cartridge
carridge = cartridge
carteridge = cartridge
carrtridge = cartridge
carttridge = cartridge
cartride = cartridge
cartrige = cartridge
catridge = cartridge
chemcial = chemical
chemsitry = chemistry
cleaing = cleaning
cleimed = claimed
coier = copier
coor = colour
coour = colour
coours = colours
cooor = colour
cooour = colour
coolour = colour
coloor = colour
coloour = colour
colouor = colour
colouir = colour
colur = colour
Colur = Colour
comapny = company
comaptible = compatible
compatbile = compatible
compatilbe = compatible
commerical = commercial
Commerical = Commercial
communicaton = communication
communicaton = communication
completly = completely
compnay = company
compsition = composition
consders = considers
consumpton = consumption
containign = containing
continous = continuous
continuos = continuous
containint = containing
converson = conversion
corect = correct
corection = correction
cotaings = coatings
coyright = copyright
curently = currently
deistribution = distribution
demostrated = demonstrated
deisgned = designed
deisnged = designed
desribe = describes
detectin = detecting
detectin = detection
develped = developed
differnet = different
ditigal = digital
divison = division
Divison = Division
dramataically = dramatically
electrophotograpy = electrophotography
emphsaize = emphasize
emulson = emulsions
engien = engine
enginering = engineering
Enginering = Engineering
epxoy = epoxy
equaton = equation
estimaed = estimated
euroepan = european
Europena = European
examinaton = examination
excpet = except
exhbiton = exhibition
Exhbiton = Exhibition
exhibiton = exhibition
feaure = feature
foramt = format
fomrs = forms
formaulation = formulation
functinal = funtional
functon = function
grnding = grinding
grphics = graphics
gropu = group
Helath = Health
helath = health
hihglight = highlight
http:////www = http://www
ilustrated = illustrated
iks = inks
iks. = inks.
imporved = improved
impproved = improved
inaging = imaging
Inaging = Imaging
indistiguishable = indistinguishable
informatin = information
inlcuding = including
inlcude = include
inlcuded = included
inproved = improved
instruciton = instruction
instrucitons = instructions
inteface = interface
Internatonal = International
intorduced = introduced
introduciton = introduction
Japense = Japanese
litle = little
machie = machine
machne = machine
magentic = magnetic
managemtn = managment
Managemtn = Managment
managment = management
Managment = Management
managmetn = managment
Managmetn = Managment
manufactuirng = manufacturing
manufctured = manufactured
marekt = market
materil = material
measurment = measurement
mentoned = mentioned
mesurement = measurement
Milikan = Millikan
modifiaction = modification
modifed = modified
mrket = market
multifuncion = multifunction
natinal = national
newtork = network
novle = novel
Oc‚ = Oce
opprtunity = opportunity
Opprtunity = Opportunity
otical = optical
palstic = plastic
particulalry = particularly
peformed = performed
performacne = performance
pigmetned = pigmented
Pigmetned = Pigmented
pigmetn = pigment
Pigmetn = Pigment
photorecptor = photoreceptor
poolymer = polymer
poymer = polymer
porces = proces
priners = printers
priner = printer
printint = printing
priter = printer
priters = printers
priting = printing
pritn = print
printng = printing
pritning = printing
pritnr = printer
pritns = prints
prniter = printer
pritners = printers
printrs = printers
prnits = prints
produciton = production
proudction = production
prodcut = product
pront = print
ptiner = printer
qulaity = quality
questin = question
ractialc = ractical
radiaton = radiation
raidation = radiation
Raidation = Radiation
reactons = reactions
realted = related
reamnufacturing = remanufacturing
recahrger = recharger
Recahrger = Recharger
recyling = recycling
reistance = resistances
repalce = replace
repalces = replaces
reporducible = reproducible
requre = require
reserach = research
Reserach = Research
resistane = resistance
resoultion = resolution
resoution = resolution
respetively = respectively
rodcution = roduction
rpelace = replace
rpinter = printer
rreleased = released
rpinting = printing
safty = safety
Safty = Safety
saveing = saving
searhc = search
serice = service
Shapr = Sharp
slected = selected
Smasung = Samsung
solvnet = solvent
sophisiticated = sophisticated
soulbe = soluble
soulble = soluble
soultion = solution
snnounced = announced
Statci = Static
suplies = supplies
supllier = supplier
sympton = symptom
sythesis = synthesis
technoogy = technology
tensin = tension
theree = three
thermodyamic = thermodynamic
thje = the
thjere = there
threee = three
tjat = that
tje = the
uisng = using
unchaged = unchanged
unusualy = unusually
upgraes = upgrades
upgrde = upgrade
utiities = utilities
variaton = variation
varnsihe = varnishes
vesion = version
wateer = water
whcih = which
wher = where
whihc = which
wiht = with
wnat = want
wolrdwide = worldwide
xperimetn = xperiment

In order to test it, I tried a few words from that file.  Hence test.txt:
tje wolrdwide catridge


If you open a CMD.EXE console and run this line:
c:\DOS\Utils\mtrw.exe -q -n -w -o+ -b- -c- -i:SPELC_MT.MT test.txt > mod.txt
you don't see anything on screen - you aren't supposed to - but you find a new file mod.txt that contains
the worldwide cartridge

which is the correct transformation.
type test.txt | c:\DOS\Utils\mtrw.exe -q -n -w -o+ -b- -c- -i:SPELC_MT.MT > mod.txt
also works, as does
c:\DOS\Utils\mtrw.exe -q -n -w -o+ -b- -c- -i:SPELC_MT.MT < test.txt > mod.txt

Is that enough explanation?  I can't immediately think of anything else to add.