[jawsscripts] Re: Linking a file to the compiler, a similar query?

  • From: Doug Lee <doug.lee@xxxxxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Sun, 17 Nov 2013 08:20:56 -0500

It may expand if used in a run() function call, but I haven't tried
that. I know there's a way to expand those using COM because one of
the COM objects you can get from Windows provides a method of doing it.

What follows is a slightly edited version of a VBScript function I
wrote as part of my script installers. This may give you some ideas.

private function envVar(varname)
' Expand %varname% via shell.expandEnvironmentStrings,
' or use alternative means where known and necessary,
' or quit the program if varname won't expand.
        dim goShell : set goShell = createObject("wscript.shell")
        ' The program will exit with an error if this init fails.
        if not (left(varname, 1) = "%" and right(varname, 1) = "%") then
                varname = "%" &varname &"%"
        end if
        dim expanded : expanded = goShell.expandEnvironmentStrings(varname)
        if expanded <> varname then
                envVar = expanded
                exit function
        end if

        ' Standard env vars like APPDATA can be missing (e.g., under Cygwin).
        ' This gets those that we know how to find manually.
        dim ev_lc : ev_lc = lcase(mid(varname, 2, len(varname)-2))
        if ev_lc = "appdata" then
                expanded = ""
                on error resume next
                expanded = goShell.regRead("HKEY_CURRENT_USER\Volatile 
Environment\APPDATA")
                on error goto 0
                if len(expanded) > 0 then
                        envVar = expanded
                        exit function
                end if
        end if
        wscript.echo "Error: Unable to expand " &varname &"."
        wscript.quit(1)
end function


On Sun, Nov 17, 2013 at 04:41:44PM +1100, Paul Magill wrote:
Hi all,

Csaba has prompted me to follow up on a similar issue I've been chasing for
a while, & it may also resolve Csaba'squestion.

Is it possible to have Jaws apply one of the system environment variables?

The one I would like to use is, AppData, which provides the path up to
where Freedom Scientific begins as follows:

C:\Users\admin\AppData\Roaming\Freedom Scientific\JAWS\13.0\Settings\enu

Which is the path to my users folder at home, & the part from 
Freedom Scientific\JAWS\13.0\Settings\enu
Is exactly the same at work, where the path up to that point is
different,but importantly, the, appData,  environment variable always
returns the correct path leading to the Freedom Scientific...

I use the environment variable in the same  batch file to backup my user
folder, both at home and at work.

Now, if I can have the script compiler use an environment variable, then I
can do similar things to what Csaba is looking at, by just changing the path
after Freedom Scientific...  

Is there a way?

Thanks,
Paul from Australia

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Csaba Godo
Sent: Sunday, 17 November 2013 8:51 AM
To: JAWSScripts List
Subject: [jawsscripts] Linking a file to the compiler

Hi guys,

I'm back in with a question. Now it concerns about the use and include
directrives in JAWS Basic. Mmy question is whether they can accept only
fully qualified pathes or not? I mean if it is somehow possible to use path
string with them like in HTML pages, where it is not necessary to fuly
qualify the path if it refers to a subdirectory of the directory where the
actual page is located. Like this "../pages/x.jpg". I'm not at home in C
programming, so I do not know how files can be linked into the compilation
process.

I would like to separate my scripts into two parts and place the reusable
library scripts into a subdirectory of the common directory of JAWS. When I
pass only the file name then the compiler looks for the referred file in the
same directory where the JSS file, which refers to it is located. If I pass
the fully qualified path, like the one  below, it works.

This works: use "C:\\JFW Extensions\\Lib.Messages.jsb".
But I'd like to put them into a subdirectory of the common JAWS directory,
whose exact path is unknown.

Thanks in advance for your help!

Csaba

__________???

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

-- 
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:doug.lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________�

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

Other related posts: