Re: Passing parameters from page to page in HTA app
From: benben (benhongh_at_yahoo.com.au)
Date: 12/03/04
- Next message: Trent: "Re: Passing parameters from page to page in HTA app"
- Previous message: McKirahan: "Re: Passing parameters from page to page in HTA app"
- In reply to: Trent: "Re: Passing parameters from page to page in HTA app"
- Next in thread: Trent: "Re: Passing parameters from page to page in HTA app"
- Reply: Trent: "Re: Passing parameters from page to page in HTA app"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 3 Dec 2004 18:46:58 +0800
Well, it is so true of what you said. Indeed. But let's just review the
include file option. You can actually write a master page which is only for
page switching. Within the master page implement a javascript interface (a
set of functions, or objects if you'd like to go oop), so that child pages
can make calls to this interface for a page switch.
Then child pages then, are loaded by the master page into <div>'s. You can
use file system object or msxml to implement. Easy huh?! Again, all the page
loading / swtiching are done by the master page, and so to keep the child
pages very clean.
Now your coworkers only have to understand the child pages, plus the
page-switching interface defined in the master page. It is for their
advantage not to examine the master page anyway.
An alternative is to define pages (both child pages and the master page) in
xml format. Then you will write an XSL Transform to work out the rest. Lot's
of fun.
ben
> Yeah, I am already using div within the pages I have created and
> hiding/showing different options as I go.
> But the amount of code for each page I am writing is getting long and
> combining the pages all in one would make it difficult for a coworker to
> pick up an easily understand. I thought if I kept it modular it would be
> easier for them to support or modify as needed.
>
> I have also considered using includes to pull in the modular pieces into
one
> working file but again, it get's confusing for troubleshooting later on.
>
> I just tried using parent.location to change pages but it actually
launches
> another window when used within an hta.
>
> I think you are right and that putting it all in one file is the better
way
> to go to make an efficient application but my coworkers keep hitting me
over
> the head saying "I can't understand your code, how can I support it?" I
> have had to work HARD to try and soften up my code a bit and end up with
> lots if statments where I could have setup a nested loop and done it in 10
> lines rather than 40. Things like that. :)
>
> "benben" <benhongh@yahoo.com.au> wrote in message
> news:#aXgSHI2EHA.2572@tk2msftngp13.phx.gbl...
> > If all you have to do is to break the application into a number of pages
> and
> > to switch between pages, you can use <div>'s to "contain" the pages
inside
> > the HTML body. Set the display property to hidden all <div>'s except the
> one
> > you want to show. You will save all the hassel of parameter passing and
> page
> > loading and it is fast.
> >
> > benben
> >
> > > Never mind, I managed to get the value to set. Just a matter of
> figuring
> > > out the correct syntax for the commands.
> > > Mixing of VBScript, JavaScript and WScript is confusing the hell out
of
> > me.
> > > :)
> > >
> > > What is the best method of switching pages for the app?
> > > I am building this in sections and will then pass the few values I
need
> > > through the environment variables as you showed me but how should I
> switch
> > > from one page to the next? Using the HTML form action and just
calling
> > the
> > > next page? Or should I close/open windows, or is there a way to
reload
> a
> > > new HTA in the same window that I do not know yet?
> > >
> > > They moved my deadline. Rather than having it complete on Dec 15 they
> > want
> > > something they can begin testing with tomorrow. It does not have to
be
> > > perfect but my approach has to change since I was building individual
> > > components and had not tied them together yet (or completed all the
> > > components) so now I have to scramble to get a basic menu system
> working.
> > >
> > > Thanks very much for your help. So little info is out there on HTA
and
> my
> > > company closed their library. I have access to an online library but
> have
> > > not checked it out yet to see if it might have any books applicable to
> my
> > > current application.
> > >
> > > "McKirahan" <News@McKirahan.com> wrote in message
> > > news:mwqrd.700314$8_6.362928@attbi_s04...
> > > > "Trent" <notvalid@dontspam.com> wrote in message
> > > > news:uzVkxy91EHA.936@TK2MSFTNGP12.phx.gbl...
> > > > > Leaving the key would not necessarily be a problem as long as I
> alter
> > > the
> > > > > value so on next run it does not have one in there until I set it.
> > > > > Is there an easy method of removing the key at the end as a
cleanup
> > > > process?
> > > > > If I always use the same key name it does not really matter but I
> like
> > > to
> > > > > code clean as possible and not leave stuff behind that does not
need
> > to
> > > be
> > > > > there. :)
> > > > >
> > > > > Thanks.
> > > >
> > > > [snip]
> > > >
> > > > This should do it: look at "delENV(ENV)".
> > > >
> > > > <html>
> > > > <head>
> > > > <title>ENV.hta</title>
> > > > <script type="text/vbscript">
> > > > Option Explicit
> > > > '*
> > > > '* Declare Constants
> > > > '*
> > > > Const cHTA = "ENV.hta"
> > > > '*
> > > > '* Set Parameter
> > > > '*
> > > > document.write cHTA
> > > > document.write "<br><br> setENV('Hello=World')"
> > > > Call setENV("Hello=World")
> > > > '*
> > > > '* Get Parameter
> > > > '*
> > > > document.write "<br><br> getENV('Hello')"
> > > > document.write "<br><br> Hello = " & getENV("Hello")
> > > > '*
> > > > '* Del Parameter
> > > > '*
> > > > document.write "<br><br> delENV('Hello')"
> > > > Call delENV("Hello")
> > > >
> > > > Sub delENV(ENV)
> > > > '*
> > > > '* Get Environment Variable
> > > > '*
> > > > Dim objWSS
> > > > Set objWSS = CreateObject("WScript.Shell")
> > > > Dim objENV
> > > > Set objENV = objWSS.Environment("Volatile")
> > > > objENV(ENV) = ""
> > > > Set objENV = Nothing
> > > > objWSS.RegDelete "HKCU\Volatile Environment\" & ENV
> > > > Set objWSS = Nothing
> > > > End Sub
> > > >
> > > > Function getENV(ENV)
> > > > '*
> > > > '* Get Environment Variable
> > > > '*
> > > > Dim objWSS
> > > > Set objWSS = CreateObject("WScript.Shell")
> > > > Dim objENV
> > > > Set objENV = objWSS.Environment("Volatile")
> > > > getENV = objENV(ENV)
> > > > Set objENV = Nothing
> > > > Set objWSS = Nothing
> > > > End Function
> > > >
> > > > Sub setENV(ENV)
> > > > '*
> > > > '* Set Environment Variable
> > > > '*
> > > > If InStr(ENV,"=") = 0 Then Exit Sub
> > > > Dim arrENV
> > > > arrENV = Split(ENV,"=")
> > > > Dim objWSS
> > > > Set objWSS = CreateObject("WScript.Shell")
> > > > Dim objENV
> > > > Set objENV = objWSS.Environment("Volatile")
> > > > objENV(arrENV(0)) = arrENV(1)
> > > > Set objENV = Nothing
> > > > Set objWSS = Nothing
> > > > End Sub
> > > > </script>
> > > > </head>
> > > > <body>
> > > > </body>
> > > > </html>
> > > >
> > > >
> > >
> > >
> >
> >
>
>
- Next message: Trent: "Re: Passing parameters from page to page in HTA app"
- Previous message: McKirahan: "Re: Passing parameters from page to page in HTA app"
- In reply to: Trent: "Re: Passing parameters from page to page in HTA app"
- Next in thread: Trent: "Re: Passing parameters from page to page in HTA app"
- Reply: Trent: "Re: Passing parameters from page to page in HTA app"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|