Jump to content
Macro Express Forums

HTA for multifield input revisited.


Cory

Recommended Posts

Floyd created a beautiful demonstration of the capabilities of HTA forms for multi-field input a while ago but it was beyond my scripting abilities. I could follow it somewhat but I know if I tried it I would get it wrong. As one tends to do we often like to showcase the full muscle of something including all the bells and whistles. But my challenge to him now is to create the simplest possible HTA file to demonstrate entry of three bits of data. First name, last name, and SSN. No pretty graphics, validation or any of that. Just make it super simple so a scriptophobe like myself could understand.

 

Should he accept the challenge I would like to make some additional requests. First don’t make a macro to generate the file dynamically and all that. Just make an HTA for the moment and post it here. Second describe the mechanism for getting the results back to ME. Also I there are various methods briefly outline them with the benefits. In the original demo I could not for the life of me figure out how the HTA returned the results. And of course I’m sure I’ll think of some more demands along the way.

 

My goal is to write an HTA file manually myself and get the results into a variable in ME. Once I can do that I would probably be interested in learning more but first I want to understand the fundamentals of how it works. I’ll kick it off with what I understand so far.

 

HTA is simply an HTML (web) document with a different extension in order to associate it with mshta.exe. This interprets the HTML and scripting and runs as a trusted app. OK, that’s all I know!

 

So the gauntlet has been thrown down. But I must add one caveat… If you can teach me this I’ll probably forever pester you with questions about VBSCript!

Link to comment
Share on other sites

that's no challenge, its more like you wanted to be taught step by step how it works, and I bet you know how basing from the number of post that you have.

 

1. the hta code is set into a variable

2. the variable then write it as a file.hta

3. macro runs the created file.hta

4. while the macro loops until file.hta window disappears, you key in data to the file.hta window, if you close this window, it will output a file.mex file

5. macro runs the file.mex file getting all the values

6. macro then displays the value into a window

 

what you really need to know is vbscript which isn't hard enough.

Link to comment
Share on other sites

Well I'm not sure what kind of person you think I am but I don't know how. This is why I ask questions.

 

You’re right, I want to know the VBScript mainly but I would like to see a simple example first so my simple brain can comprehend.

 

I understand that Floyd’s example was generating the VBScript but I did not understand how it was passing variables back to the macro. I did see the part about importing a macro file but I didn’t understand how it was being done. Never occurred to me that VBScript could build a file from scratch.

 

What I was hoping for was an example of a simple three line form that would create a simple text file or something as a mechanism for passing data back.

 

I don’t understand your statement “which isn't hard enough” Please explain.

Link to comment
Share on other sites

Never occurred to me that VBScript could build a file from scratch

That's correct Cory, it can. What the script does is to write native Macro Express code, like you see from the Direct Editor window, to a file. Macro Express, in the mean time, is waiting for the file to exist. Then it reads it into a variable and executes the variable using the Run Macro in Variable command. It's actually pretty neat.

strWrite = _
"<TVAR2:11:01:" & strFirstName & Chr(01) & ">" & _
"<TVAR2:12:01:" & strLastName & Chr(01) & ">" & _
"<TVAR2:13:01:" & strEmail & Chr(01) & ">"

I've looked to see how the example can be simplified. It might be done, although I'm not sure if it would make the VBScript part any clearer. Let's see how much time Floyd has available to help answer questions you, or anyone else, might have.

Link to comment
Share on other sites

Well don't bust a nut. This is one of those 'as and when' kind of things. I know you guys are busy and I don't have an immediate need so leave it for one of those rainy days. Also I'm motivated to pick up a beginners guide to VBScript and I can always figure it out myself later. Would be a good exercise.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...