Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTA new window with Parameters

Status
Not open for further replies.

nguye103

Technical User
Apr 21, 2005
7
US
I have been working on this thing forever!! I am in desperate need of help!!

I currently am running an HTA file called h1.hta and I want to be able to open another HTA called h2.hta that will take in parameters and close the current HTA.

I am using this snippet of code to open the new h2.hta(parameters) within my current h1.hta :

nextpage = h2.hta?trial=2&condition=1

//vbscript
set WshShell = CreateObject("WScript.Shell")
WshShell.Run(nextpage)

When I run this, I get a "File not Found" error. I believe it's because the file in the system is entitled h2.hta and when i send it with the parameters, it does not recognize.

My question is how do I go to another hta file with parameters???
 
I have to use the 'nextpage' variable because it was passed in that way.

That code looks like I would have to hard code in the entire path....which I can't.
 
When you're in hta page and that you want to open a "nextpage", wshshell object should have no business in this functionality. You use window.open method, like this.
[tt] nextpage = [red]"[/red]h2.hta?trial=2&condition=1[red]"[/red]
window.open nextpage[/tt]
Then to close the window after, you use window.close method.
Ref
 
The problem with window.open(nextpage) is that it gives me an "Access is Denied" script error, despite the HTA being in the exact same directory.
 
The reason why I wanted to do it this way was because this pogram has a bunch of HTA pages and they are all able to move from page to page with the window.open(nextpage). For some reason though, it's this one page that won't move to the next one using that same command. It's only this page that creates the 'Access is Denied' script error. This was how the program was when i started working on this project.
 
Have you tried opening it using ShowModalDialog? Something like
Code:
   class ClsLoginParam
      dim m_login
      dim m_password
   end class
   
   sub Login_OnClick
      dim loginParam
      ' Create something for the dialog to return
      set loginParam = new ClsLoginParam
      window.showModalDialog "parchildLogin.htm", loginParam, "dialogHeight:130px;dialogWidth:300px;status:no;resizable:no;scroll:no"
...
In parchildLogin.htm, to get the parameters
Code:
      set loginParam = window.dialogArguments
      loginParam.m_login = logintxt.value
      loginParam.m_password = passwordtxt.value
You do not need to declare ClsLoginParam in the subsequent form. It gets the definition from the parent dialog.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top