[jawsscripts] Re: Piping a string variable to a txt file as part of a script

  • From: Soronel Haetir <soronel.haetir@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Wed, 20 Jan 2010 08:11:11 -0900

Jeff,

No specific feature in mind, but having access to all of the
scriptible objects (or even a significant subset  -- I suspect JAWS
script type limitations may prevent using some classes) makes for
better ways to do things like interact with office.  Instead of
sending keystrokes you could instead directly invoke the commands
using the object interface.

I'm going to have to look at this and see if it can give access to the
visual studio wizards that I currently have to use the jaws cursor
(and poorly at that) to access.  Also implementing a simple automation
object is easy enough that I may create such an interface to perform
tasks that the jaws script language is not capable of, will just have
to see.  Like I said, it opens up a lot of possibilities.

On 1/20/10, Geoff Chapman <gch@xxxxxxxxxxxxxxxx> wrote:
> hi Soronel.
>
> if you'd care to, would you perhaps like to elaborate for those of us much
> much greener in the field of coding, how the Automation aware aspect of
> which you speak so lovingly and excitedly below, might assist? and in what
> kinds of ways perhaps? I know that's probably a pretty big call to ask, so
> if it's one of those, "look it'd be just toooo hard to explain if you've no
> idea," type deals, which I well realize this might be, then just ignore. ok?
> <grin.>
>
> Geoff c.
> ----- Original Message -----
> From: "Soronel Haetir" <soronel.haetir@xxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Wednesday, January 20, 2010 2:26 AM
> Subject: [jawsscripts] Re: Piping a string variable to a txt file as part of
> a script
>
>
>> Oh man, jaws scripting is automation aware?  I hadn't realized that.
>> That opens so many possibilities.  I had thought the object type was
>> just another opaque value type.  I don't think either of FSDN or the
>> basics of scripting manual mention that it can actually make calls to
>> automation objects.
>>
>> Although that does make me wonder why they bothered writing their own
>> script language rather than re-using windows script host.  Oh well,
>> probably a historical decision and next to impossible to change now.
>>
>> On 1/19/10, Paul Magill <magills@xxxxxxxxxxx> wrote:
>> > Hi Logan,
>> >
>> > - this is not as straight forward as it might seem.  There are no FS
> built
>> > in functions that write to text type files other than the INI functions,
>> > such as IniWriteString etc.
>> >
>> > These do not provide for appending, other than creating additional keys
> etc.
>> >
>> > Fortunately, especially for me, Jamal Masrui provided to the list, a set
> of
>> > functions that do that task very well.
>> >
>> > Below are those functions, only slightly modified to suit my needs.
>> >
>> > * The last one is what you are looking for.  It, and the other 2 file
>> > accessing functions need the first function. I included the other 2 as
> you
>> > may need them at some time.
>> >
>> > Note 1: The read function reads the entire file into a string variable,
> &
>> > the Write function writes a file which will contain only the contents of
> the
>> > string variable passed to it.  i e. anything already in the file will be
>> > overwritten. The append function adds to any text already in the file,
> but
>> > the file must already exist.
>> > Note 2: you need to look after any linebreaks that you may need, as none
> are
>> > provided by the functions. - this is very useful in most situations
>> >
>> >
>> > Object Function ObjectCreate (string S_Object)
>> >
>> > Var
>> >
>> > Object o_return
>> >
>> > Let o_return =CreateObjectEx (s_object, True)
>> >
>> > ;SayString ("first")
>> >
>> > If !o_return Then
>> >
>> > Let o_return =CreateObjectEx(s_object, False)
>> >
>> > ;SayString ("second")
>> >
>> > EndIf
>> >
>> > If !o_return Then
>> >
>> > Let o_return =GetObject(s_object)
>> >
>> > ;SayString ("third")
>> >
>> > EndIf
>> >
>> > Return o_return
>> >
>> > EndFunction
>> >
>> >
>> >
>> > String Function ReadStringFromFile (string S_File)
>> >
>> > Var
>> >
>> > Object Null,
>> >
>> > Object o_system,
>> >
>> > Object o_file,
>> >
>> > String s_return
>> >
>> > Let o_system =ObjectCreate("Scripting.FilesystemObject")
>> >
>> > Let o_file =o_system.OpenTextFile(s_file, 1, 0)
>> >
>> > Let s_return =o_file.ReadAll()
>> >
>> > o_file.close()
>> >
>> > Let o_file =Null
>> >
>> > Let o_system =Null
>> >
>> > Return s_return
>> >
>> > EndFunction
>> >
>> >
>> >
>> > Int Function WriteFileFromString (string S_Text, string S_File)
>> >
>> > Var
>> >
>> > Object Null,
>> >
>> > Object o_system,
>> >
>> > Object o_file
>> >
>> > Let o_system =ObjectCreate("Scripting.FilesystemObject")
>> >
>> > Let o_file =o_system.CreateTextFile(s_file, 1, 0)
>> >
>> > o_file.write(s_text)
>> >
>> > o_file.close()
>> >
>> > Let o_file =Null
>> >
>> > Let o_system =Null
>> >
>> > EndFunction
>> >
>> >
>> >
>> >
>> >
>> > Int Function AppendStringToFile (string S_Text, string S_File)
>> >
>> > ; *** this function *ONLY* appends to already existing files. use
>> > WriteFileFromString to create the file
>> >
>> > ; each append adds to the previous record without line breaks etc
>> >
>> > Var
>> >
>> > Object Null,
>> >
>> > Object o_system,
>> >
>> > Object o_file
>> >
>> > Let o_system =ObjectCreate("Scripting.FilesystemObject")
>> >
>> > Let o_file =o_system.OpenTextFile (s_file, 8, 0)
>> >
>> > o_file.write (s_text)
>> >
>> > o_file.close()
>> >
>> > Let o_file =Null
>> >
>> > Let o_system =Null
>> >
>> > EndFunction
>> >
>> >
>> >
>> >
>> > ----- Original Message -----
>> > From: "Logan McMullen" <loganmcmullen@xxxxxxxxxxxxxxx>
>> >
>> >
>> > Hi everyone,
>> >
>> > I'd like to use an input box to get some content from a user and to then
>> > have the variable that is returned by the box save/piped to a txt file
> that
>> > the script also creates.
>> >
>> > The process would go like this(** note keystrokes are not what I'm using
> in
>> > the actual script)
>> >
>> > 1. User hits ctrl+p and gets presented  with the  input box
>> > 1(a) A text file with a filename  of the current system time is created.
>> > 2. User inputs  content(text) in the box and hits enter(string variable
> is
>> > then created by the input box
>> > 3.  String variable is appended to a txt file that has been created.
>> >
>> > I have the time variable already sorted and could use a batch file to
> create
>> > the txt file  but would rather use all script functions to achieve this
> if
>> > possible to remove the need for the batch file to be on the users
> machine.
>> >
>> > Thoughts appreciated.
>> >
>> > Logan.
>> >
>> > __________
>> > Visit and contribute to The JAWS Script Repository
> http://jawsscripts.com
>> >
>> > View the list's information and change your settings at
>> > http://www.freelists.org/list/jawsscripts
>> >
>> >
>>
>>
>> --
>> Soronel Haetir
>> soronel.haetir@xxxxxxxxx
>> __________
>> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>>
>> View the list's information and change your settings at
>> http://www.freelists.org/list/jawsscripts
>>
>
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
>


-- 
Soronel Haetir
soronel.haetir@xxxxxxxxx
__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

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

Other related posts: