Re: JAWS Script Exchange, script installer question?

  • From: "Bryan Garaventa" <bgaraventa11@xxxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 15 Oct 2007 23:24:16 -0700

That's alright, I was able to create a script that reverses the merge. This is how.


I have a dll which is installed along with the scripts, called HTMLParser.dll, and is then registered using RegAsm.

Within the HTMLParser library is a function called ExCommandPrompt, which takes two parameters, FilePath, and Arguments. FilePath is the executable, and Arguments is whatever you want the executable to process. So basically, the function creates an invisible instance of the command prompt, and passes it whatever you like.

I've also made use of the FileSystemObject ( http://www.w3schools.com/asp/asp_ref_filesystem.asp ), and the FileStream object ( http://www.w3schools.com/asp/asp_ref_textstream.asp ), to clear up the remaining dll's and supporting files. These objects can be directly instantiated within JAWS.

It's sort of funny really, that it works at all. For instance
First I use the FileSystemObject and FileStreamObject to open and read the contents of DEFAULT.JSS, placing the string into a variable. Then I use the StringSubReplace function (or whatever it is called), to remove the string: Use "SSB-UltraModuleMaker.jsb"
I then overwrite the contents of default.jss with the new string.
An instance of the command prompt is then instantiated, using HTMLParser.dll, sending the FilePath for scompile.exe, and for Arguments, the path to default.jss to be compiled. Also using the command prompt instance, the currently running dll is unregistered using RegAsm.exe. After a bit of ini file cleanup, the FileSystemObject instance is used to delete the rest of the files, such as the dlls and tlb files, and the rest of the script files, including the .jsb file that's running this script.
Still the script runs on like a good little work horse, untill the end...

Here's the code for making it work...


Script Uninstall ()

if ExMessageBox ("Are you sure you want to uninstall the SSB Ultra Module Maker?", "Uninstall SSB Ultra Module Maker V" + BuildVersion, mb_yesno) != 6 then

Return

endif

var object FileObject, object fs, string fp, string FileName, string kFileName, string ft, string section

let FileName = "DEFAULT.JSS"

let kFileName = "Default.JKM"

let fp = GetJAWSSettingsDirectory () + "\\" + FileName

let FileObject = fsoCreateInstance ()

if not FileObject then

MessageBox ("Unable to create the file system object")

Return

endif

let fs = fsoOpenTextFile (fp, 1, false, FileObject)

if not fs then

MessageBox ("The file stream object could not be created")

Return

endif

let ft = fs.ReadAll

Pause ()

fs.Close

if StringIsBlank (ft) then

MessageBox ("The contents of " + FileName + " could not be read.")

Return

endif

let ft = StringReplaceSubstrings (ft, "Use \"" + MainFolderName + ".jsb\"", "")

let fs = fsoOpenTextFile (fp, 2, false, FileObject)

Pause ()

if not fs then

MessageBox ("The file stream object could not be created for writing")

Return

endif

fs.Write(ft)

Pause ()

fs.Close

if not RunThroughCommandline (GetJAWSDirectory () + "\\scompile.exe", "\"" + GetJAWSSettingsDirectory () + "\\" + FileName + "\"") then

MessageBox ("An error occured when attempting to run scompile.exe")

Return

endif

let section = "Common Keys"

IniRemoveKey (section, "Alt+`", kFileName, true)

IniRemoveKey (section, "Control+Shift+`", kFileName, true)

IniRemoveKey (section, "Alt+Shift+`", kFileName, true)

IniRemoveKey (section, "Control+Alt+`", kFileName, true)

let fp = GetJAWSDirectory () + "\\RegAsm.exe"

if not RunThroughCommandline (GetJAWSDirectory () + "\\RegAsm.exe", "/u /s \"" + GetJAWSDirectory () + "\\HTMLParser.dll\" /tlb:HTMLParser.tlb") then

MessageBox ("An error occured when attempting to run RegAsm.exe")

Return

endif

if FileExists (GetJAWSSettingsDirectory () + "\\MiniCap") then

FileObject.DeleteFolder(GetJAWSSettingsDirectory () + "\\MiniCap", true)

endif

if FileExists (GetJAWSDirectory () + "\\HTMLParser.dll") then

FileObject.DeleteFile(GetJAWSDirectory () + "\\HTMLParser.dll")

endif

if FileExists (GetJAWSDirectory () + "\\HTMLParser.tlb") then

FileObject.DeleteFile(GetJAWSDirectory () + "\\HTMLParser.tlb")

endif

if FileExists (GetJAWSDirectory () + "\\Interop.SHDocVw.dll") then

FileObject.DeleteFile(GetJAWSDirectory () + "\\Interop.SHDocVw.dll")

endif

if FileExists (GetJAWSSettingsDirectory () + "\\" + MainFolderName + ".JKM") then

FileObject.DeleteFile(GetJAWSSettingsDirectory () + "\\" + MainFolderName + ".JKM")

endif

if FileExists (GetJAWSSettingsDirectory () + "\\" + MainFolderName + ".jsd") then

FileObject.DeleteFile(GetJAWSSettingsDirectory () + "\\" + MainFolderName + ".jsd")

endif

if FileExists (GetJAWSSettingsDirectory () + "\\" + MainFolderName + ".JSS") then

FileObject.DeleteFile(GetJAWSSettingsDirectory () + "\\" + MainFolderName + ".JSS")

endif

if FileExists (GetJAWSSettingsDirectory () + "\\" + MainFolderName + ".txt") then

FileObject.DeleteFile(GetJAWSSettingsDirectory () + "\\" + MainFolderName + ".txt")

endif

if FileExists (GetJAWSSettingsDirectory () + "\\" + MainFolderName + "1.wav") then

FileObject.DeleteFile(GetJAWSSettingsDirectory () + "\\" + MainFolderName + "1.wav")

endif

if FileExists (GetJAWSSettingsDirectory () + "\\" + MainFolderName + "2.wav") then

FileObject.DeleteFile(GetJAWSSettingsDirectory () + "\\" + MainFolderName + "2.wav")

endif

if FileExists (GetJAWSSettingsDirectory () + "\\" + MainFolderName + "3.wav") then

FileObject.DeleteFile(GetJAWSSettingsDirectory () + "\\" + MainFolderName + "3.wav")

endif

if FileExists (GetJAWSSettingsDirectory () + "\\" + MainFolderName + ".jsb") then

FileObject.DeleteFile(GetJAWSSettingsDirectory () + "\\" + MainFolderName + ".jsb")

endif

MessageBox ("You must restart JAWS for these changes to take effect.")

let FileObject = Null ()

EndScript


Object Function fsoCreateInstance ()

Return CreateObjectEx ("Scripting.FileSystemObject", true)

EndFunction


Int Function RunThroughCommandline (string FilePath, string Arguments)

var object Parser, string ParserError

let Parser = CreateObjectEx ("HTMLParser.Capture", false)

Pause ()

if not Parser then

MessageBox ("The Parser object could not be created")

Return false

endif

Parser.ExCommandPrompt(FilePath, Arguments)

let ParserError = Parser.ExError

if not StringIsBlank (ParserError) then

MessageBox (ParserError)

Return false

endif

Return true

EndFunction



----- Original Message ----- From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, October 15, 2007 7:35 AM
Subject: Re: JAWS Script Exchange, script installer question?


JSX does not have such a capability at present.  It does backup
existing script files by default, so the user could unzip them into the
user script folder to restore previous settings.

Jamal
On Mon, 15 Oct 2007, Bryan
Garaventa wrote:

Date: Mon, 15 Oct 2007 00:55:03 -0700
From: Bryan Garaventa <bgaraventa11@xxxxxxxxxxxxxx>
Reply-To: programmingblind@xxxxxxxxxxxxx
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: JAWS Script Exchange, script installer question?

Is it also possible to create an uninstaller that would reverse the merge?

----- Original Message -----
From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Thursday, October 11, 2007 2:14 PM
Subject: Re: JAWS Script Exchange, script installer question?


> JSX creates a file called temp.iss in the JSX program folder (c:\jsx by
> default).  It then calls the Inno Setup command-line compiler with that
> file as a parameter to create the installer executable.  If you load
> temp.iss into an editor, you can manually change some settings, such as
> AppName and AppVerName. Then open temp.iss via Windows Explorer to > load > it into the Inno Setup IDE. Press Control+F9 to recompile the > installer
> executable.
>
> Jamal
> On Thu, 11 Oct 2007, Bryan Garaventa wrote:
>
>> Date: Thu, 11 Oct 2007 12:27:02 -0700
>> From: Bryan Garaventa <bgaraventa11@xxxxxxxxxxxxxx>
>> Reply-To: programmingblind@xxxxxxxxxxxxx
>> To: programmingblind@xxxxxxxxxxxxx
>> Subject: Re: JAWS Script Exchange, script installer question?
>>
>> Wow, that's impressive. It works great.
>>
>> One last question though, is it possible to modify the default title >> of
>> the
>> installer, so that it reflects the name of the product being >> installed?
>>
>> thanks,
>>
>> Bryan
>> ----- Original Message -----
>> From: "Jamal Mazrui" <empower@xxxxxxxxx>
>> To: <programmingblind@xxxxxxxxxxxxx>
>> Sent: Wednesday, October 10, 2007 9:47 AM
>> Subject: Re: JAWS Script Exchange, script installer question?
>>
>>
>> > Everything in the zip archive gets unzipped into the user script >> > folder
>> > or
>> > subfolders of it. The .NET COM callable wrapper should be >> > separately >> > added to the zip archive (by means other than JSX), since it needs >> > to
>> > be
>> > in the same folder as jfw.exe. The sample custom.iss file shows how >> > to
>> > do
>> > this using the JFWDir variable that the Inno Setup script gets after
>> > running JSX. Unfortunately, this is complex, so you will probably >> > need
>> > to
>> > learn about Inno Setup as well, e.g., from the isetup.txt >> > documentation
>> > file in the JSX folder.
>> >
>> > Jamal
>> > On Wed, 10 Oct 2007, Bryan Garaventa wrote:
>> >
>> >> Date: Wed, 10 Oct 2007 09:31:25 -0700
>> >> From: Bryan Garaventa <bgaraventa11@xxxxxxxxxxxxxx>
>> >> Reply-To: programmingblind@xxxxxxxxxxxxx
>> >> To: programmingblind@xxxxxxxxxxxxx
>> >> Subject: Re: JAWS Script Exchange, script installer question?
>> >>
>> >> Thanks, I'll give it a go. This is the first time I've ever used >> >> the
>> >> app,
>> >> so
>> >> I'll have to trial and error a bit. One thing though, about >> >> creating
>> >> the
>> >> zip
>> >> file...
>> >> I'll need to include my dll with RegAsm.exe within the install
>> >> process.
>> >> I've
>> >> read the bit in the documentation about the special configuration
>> >> using
>> >> an
>> >> ISS file, but I admit to being a novice, so much isn't very clear >> >> to
>> >> me
>> >> as
>> >> yet.
>> >> Should I include the dll and RegAsm.exe within the same zip folder >> >> as
>> >> the
>> >> scripts, or should there be a subfolder for this?
>> >> Thanks for the help,
>> >>
>> >> Bryan
>> >>
>> >>
>> >> ----- Original Message -----
>> >> From: "Jamal Mazrui" <empower@xxxxxxxxx>
>> >> To: <programmingblind@xxxxxxxxxxxxx>
>> >> Sent: Wednesday, October 10, 2007 7:31 AM
>> >> Subject: Re: JAWS Script Exchange, script installer question?
>> >>
>> >>
>> >> > Make sure you have the current JSX (May 31, 2007), and check the
>> >> > "Merge" section of the documentation.  There are two possible
>> >> > approaches
>> >> > to do what you want. One is to select the Merge radio button in >> >> > the
>> >> > JSX
>> >> > Installer dialog and check Guide Installation in the Packager
>> >> > dialog.
>> >> > Then, default.jss in the .zip archive should get merged with the
>> >> > user's
>> >> > default.jss and recompiled. In this case, the new default.jss >> >> > would
>> >> > get
>> >> > appended to the end of the existing one.
>> >> >
>> >> > A second approach is to name your script file anything you like, >> >> > not
>> >> > necessarily default.jss.  On the first line of the file, put the
>> >> > following text:
>> >> > Merge "Default.jss"
>> >> >
>> >> > Suppose your file is called def.jss.  Then JSX will add the
>> >> > following
>> >> > line to the bottom of the existing default.jss:
>> >> > use "def.jsb"
>> >> >
>> >> > Jamal
>> >> > On Tue, 9 Oct 2007, Bryan
>> >> > Garaventa wrote:
>> >> >
>> >> >> Date: Tue, 9 Oct 2007 23:13:22 -0700
>> >> >> From: Bryan Garaventa <bgaraventa11@xxxxxxxxxxxxxx>
>> >> >> Reply-To: programmingblind@xxxxxxxxxxxxx
>> >> >> To: programmingblind@xxxxxxxxxxxxx
>> >> >> Subject: JAWS Script Exchange, script installer question?
>> >> >>
>> >> >> I can see in the doc how to designate an app.exe, and reference >> >> >> a
>> >> >> name
>> >> >> within the configNames.ini to associate the scripts being >> >> >> installed
>> >> >> during a merge, but how can you merge into Default.jsb?
>> >> >>
>> >> >> I'm building an app that needs to be globally accessible, so >> >> >> I'll
>> >> >> need
>> >> >> to
>> >> >> merge the script jsb and jkm files into the default script set.
>> >> >> Preferably, using the Use "module.jsb" syntax to do so for
>> >> >> simplicity.
>> >> >>
>> >> >> Is there a way to do this using the script installer?
>> >> >>
>> >> >>
>> >> > __________
>> >> > View the list's information and change your settings at
>> >> > //www.freelists.org/list/programmingblind
>> >> >
>> >>
>> >> __________
>> >> View the list's information and change your settings at
>> >> //www.freelists.org/list/programmingblind
>> >>
>> > __________
>> > View the list's information and change your settings at
>> > //www.freelists.org/list/programmingblind
>> >
>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: