Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • September 05, 2015, 11:19:18 AM
  • Proudly celebrating 10 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

Author Topic: Configuring user tools  (Read 8019 times)

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 2,856
    • View Profile
    • Donate to Member
Configuring user tools
« on: May 02, 2007, 10:09:46 AM »
Mouser,

Should the Configure User Tools menu be part of the main Options screen?

Please can you give an example of how to configure something, and how the macros work - how they relate to what the external tool wants to see?

Can you set up something that expects to read and write via standard input/output, rather than a file?


mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 35,014
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: Configuring user tools
« Reply #1 on: May 02, 2007, 10:24:06 AM »
great questions -- it's been so long since anyone actually inquired about user tools..

regarding the "macros" -- the basic idea is this.
when invoking a user tool, CHS:
1) creates a temp file with current clip contents; the full path to this file is %infile%.
2) thinks up a name for a temporary output file where it expects the changed clip to be stored; the full path to this is %outfile%.
3) invokes your tool with commandline you specify
4) it then looks in the %outfile% file to grab the new contents.

SO,
basically lets say you wanted to make a perl script to do lots of processing on some text, to clean it up.
you would make your script take 2 parameters, the input file and output file, and then youd pass them on the commandline when you configure your tool via CHS, like so:

myscript.exe "%infile% "%outfile%'

---

ok you asked about commandline input and output; right now its not supported, though you could very easily simply use a .bat file to execute whatever command you want that outputs to commandline and rout it to outfile, which is the easiest way to do it.

--

addendum:
im not sure now whether %infile% and %outfile% have the complete paths in them or whether the complete paths are specified by "%tmpdir%/%infile%" and "%tmpdir%/%outfile%" which now seems more likely looking at the tool properties screen.

---

im happy to talk more over email to help you get things working and i'd appreciate a summary if/when you do get something working right, so i can update the help file with any lessons learned.. i think it's a nice feature in CHS but no one uses it so it's got very little testing.  if there are issues i'm happy to try to improve it for the one user of it (you!). :)

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 2,856
    • View Profile
    • Donate to Member
Re: Configuring user tools
« Reply #2 on: May 03, 2007, 09:22:01 AM »
OK, thanks, Mouser.

I had trouble with the command-line app I was trying to use, so I put it into a batch file.  The batch seems to work from the command line, but, it doesn't work from inside CHS and even putting a PAUSE statement in the batch didn't stop the window closing before I could read it.  So I wrote a TEST.BAT thus:

echo %1 > c:\zdir\testbat.log
echo %2 >> c:\zdir\testbat.log
pause

and put it into CHS with only %infile% and %outfile% as arguments.  This time the Pause did work.  The contents of testbat.log are:

"C:\Program Files\Clipboard Help+spell\tmpin.txt"
"C:\Program Files\Clipboard Help+spell\tmpout.txt"

Even in quote marks, are plus signs legal in file or directory names?  I thought they were reserved for concatenation.


mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 35,014
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: Configuring user tools
« Reply #3 on: May 03, 2007, 09:28:33 AM »
plus is legal.  thats the full path to the program "C:\Program Files\Clipboard Help+spell\", so it looks like it is working exactly as it should.

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 2,856
    • View Profile
    • Donate to Member
Re: Configuring user tools
« Reply #4 on: May 04, 2007, 10:56:03 AM »
Oh yes, I should have spotted that CHS' directory had a plus sign.   I knew the program name was  ClipboardHelpAndSpell  in words.  OK, I'll take another look.

<later>

Are you certain that CHS does actually produce a tmpin.txt?  I've tried running the temprun.bat that CHS makes externally, which works OK if I manually make a tmpin.txt file first, but if I try from CHS' User tools menu, I get some kind of "command unrecognised, this isn't a file" type error window that pops up then disappears so fast I can't read it.  So I'm wondering if the command processor can't find the tmpin.txt file.



« Last Edit: May 04, 2007, 10:58:39 AM by rjbull »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 35,014
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: Configuring user tools
« Reply #5 on: May 04, 2007, 11:11:17 AM »
ill check and report.

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 2,856
    • View Profile
    • Donate to Member
Re: Configuring user tools
« Reply #6 on: May 15, 2007, 04:05:25 AM »
Mouser,

It does make a tmpin.txt.  Maybe I'm getting errors because owing to "security restrictions" I can't access CMD.EXE on this machine, only COMMAND.COM, and there might be a problem about passing LFNs.


mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 35,014
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: Configuring user tools
« Reply #7 on: May 15, 2007, 12:44:30 PM »
when you pass %infile% and %outfile% make sure you put them in double quotes;
i could try setting them as short filenames if you think that will help.

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 2,856
    • View Profile
    • Donate to Member
Re: Configuring user tools
« Reply #8 on: May 16, 2007, 03:52:14 AM »
I used the macro picker, which adds double quotes itself.  Don't think I need to redouble those?

I'm limited to a COMMAND.COM shell; would that limit path length?


mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 35,014
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: Configuring user tools
« Reply #9 on: May 16, 2007, 08:48:21 AM »
no need to double.
yes path length is limited but it's pretty long.. so i doubt that's the problem.

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,896
    • View Profile
    • Donate to Member
Re: Configuring user tools
« Reply #10 on: May 23, 2007, 06:55:14 PM »
BTW this is ideal for something like HtmlTidy (http://tidy.sourceforge.net/) copy html and reformat it in one go! I might have a go at that.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 35,014
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: Configuring user tools
« Reply #11 on: May 23, 2007, 07:01:30 PM »
please let me know if you get it to work and if not what problems you have..
it would be nice to have a little list of tools and how to configure them somewhere, maybe start a thread for it.

oldHacker

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: Configuring user tools
« Reply #12 on: May 19, 2008, 01:26:58 PM »
user tools ~ are they still available?

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 2,856
    • View Profile
    • Donate to Member
Re: Configuring user tools
« Reply #13 on: May 20, 2008, 03:32:49 AM »
user tools ~ are they still available?

I'm using CHS 1.19.02.

User tools aren't a separate download, if that's what you mean.  You get to them by bringing up CHS's main window, picking a clip, and pressing the [M]odify format/case button.  That brings up a Modify Format/Case screen with User Tools as the middle menu item.  Click that and you get Configure User Tools.  Here you enter any suitable tool you fancy.  One of mine looks like the image below.

The batch file is:

Code: [Select]
c:\dos\utils\sed-359.exe -f c:\pcw\spellchk\CHS.SED < %1 > %2

and CHS.SED is just a set of search-and-replace pairs, like this:

Code: [Select]
s/INTERNATIONAL BUSINESS MACHINES CORPORATION/IBM CORP\./g
s/INTERNATIONAL/INTL\./g
s/KABUSHIKI KAISHA/K\.K\./g

HTH, though I doubt it   ;)



« Last Edit: May 20, 2008, 03:37:37 AM by rjbull »

oldHacker

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: Configuring user tools
« Reply #14 on: May 20, 2008, 11:06:51 AM »
user tools ~ are they still available?

I'm using CHS 1.19.02.

User tools aren't a separate download, if that's what you mean.  You get to them by bringing up CHS's main window, picking a clip, and pressing the [M]odify format/case button...
thanks ~  8)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 35,014
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: Configuring user tools
« Reply #15 on: May 20, 2008, 11:59:11 AM »
rjbull got it right -- there are no predefined user tools to download, it's a mechanism for configuring your own commandline tools to work with CHS.

thanks for the nice example rj, i might put that in the help file if you don't mind  :up:

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 2,856
    • View Profile
    • Donate to Member
Re: Configuring user tools
« Reply #16 on: May 21, 2008, 03:44:16 AM »
thanks for the nice example rj, i might put that in the help file if you don't mind  :up:

Go ahead, mouser  :)