[jawsscripts] Re: Problem with StringToFile, Jamal's HSL

  • From: "Brian Hartgen" <jaws@xxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Thu, 22 Nov 2012 22:08:04 -0000

Hi Gordon

Thanks so much again for your help. I've just got home and had to try it out 
straight away, it works a treat by the looks of it.

Thanks again.


-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx 
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Luke, Gordon
Sent: 22 November 2012 15:56
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Problem with StringToFile, Jamal's HSL

Hi Brian
It's not a space at the end of the file.  Instead it's a character 0.  Not 
entirely sure why Jaws 14 is adding this in but I'm sure people with far 
greater knowledge than myself can let us know.  Perhaps there's a compiler 
directive that is required to make the string concatenation behave in a similar 
way to earlier Jaws versions.

Anyway all you need to do is to call Jamal's function and replace the character 
0 characters with empty strings e.g.

StringToFile (StringReplaceSubstrings (temp, "\0", ""), "c:\\temp\\test.txt")

Hope this helps

Cheers

Gordon Luke 
Senior Systems Analyst

IT Services
Capita
PO Box 25, Craigforth, Stirling, FK9 4UE
 
Tel (Ext) : +44 (0) 1732 42 9044
Tel (Int) : 2319044
Email      : Gordon.Luke@xxxxxxxxxxxx
 
www.capita-its.co.uk

Data Classification: Internal Use Only [ x] / Confidential [ ] / Commercial in 
Confidence [ ] / Public [ ]

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx 
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Brian Hartgen
Sent: 22 November 2012 14:41
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Problem with StringToFile, Jamal's HSL

Hi
I have a problem which is baffling me at the moment. For various projects 
available to the community, I use Jamal's Homer Script Library. It is full of 
useful functions and I've used it for years.

However there is one function which is causing a problem. It works fine with 
many jaws versions up to and including 13, but it does not work correctly in 14 
and I do need it to if anyone can please suggest a solution.

The function, StringToFile, writes a string to a text file. In jaws 14, this is 
working fine except that it leaves an extra space character at the end. This 
can be simulated simply as follows:

Assume that homer.jsb is attached via a use statement to your script.

Script test700 ()

saystring ("ok")

var

string temp

let temp = "hello "

let temp = temp +"goodbye"

StringToFile (temp, "c:\\temp\\test.txt")

ã

ã

EndScript


This outputs to a text file "hello goodbye", then a space character, rather 
than just having a clean file.

Does anyone have a suggestion as to how I may erase the space character?

Thank you.

Brian Hartgen

__________ï

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts





This email is confidential and should not be used by anyone who is not
the original intended recipient. Prudential cannot accept liability
for statements made which are clearly the sender's own and not made
on behalf of the Prudential. In addition, no statement should be
construed as giving investment advice within or outside the United
Kingdom

Prudential plc, incorporated and registered in England and Wales.
Registered Office at Laurence Pountney Hill, London, EC4R 0HH.
Registered number 1397169. Prudential plc is a holding company,
subsidiaries of which are authorised and regulated by the Financial
Services Authority (FSA)

'Prudential' is a trading name of The Prudential Assurance Company
Limited, which is incorporated and registered in England and Wales.
Registered Office at Laurence Pountney Hill, London, EC4R 0HH.
Registered number 15454. Authorised and regulated by the Financial
Services Authority. 'Prudential' is also used by other companies within
the Prudential Group, which between them provide a range of financial
products including life assurance, pensions, savings and investment
products

'Prudential' is also a trading name of Prudential Distribution Limited, 
which is incorporated and registered in Scotland.  Registered Office at 
Craigforth, Stirling, FK9 4UE.  Registered number SC212640. Authorised 
and regulated by the Financial Services Authority.

A list of other Prudential companies together with their registered
statutory details can be found in 'About Prudential' on 
http://www.prudential.co.uk/prudential-plc/aboutpru

An email reply to this address may be subject to interception or
monitoring for operational reasons or for lawful business practices.
__________ï

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

__________ï

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: