Jump to content
Macro Express Forums

Need Some Help Running An Hta File


Recommended Posts

I read this Post over in the Third Party Tools section, and a form like that is exactly what I need. After some hair pulling, it was obvious that trying to modify the posted forms for my own use was well beyond my meager knowledge. I instead did some searching, and found a nice piece of java script that would save the input from an hta form to a csv file. After whipping up a VERY basic html form using and using that script, I was very pleased with myself. I had the information I wanted in a csv file that I could easily have ME read and insert that data into variables. BUT for some reason if I run the hta file from a macro, it won't produce the csv file!?! If I just double click on it, or run it from the command line, it will produce the csv file ever time I press the submit button, but if I use ME to launch the program as part of a macro, nothing happens when I hit the submit button. I've literally spent all day banging away at this and when I filially thought I had it, nope. :( Any one have any ideas why it won't produce the file when ME tries to run it (security settings maybe?) or does anyone have a less complex method of using forms with ME than the one suggest in the post I linked to?

Link to comment
Share on other sites

Ok I pulled the original java script from this web site. Originally, the java script took the input from the html file, and saved each pressing of the submit button as a separate csv file, named differently based on a time stamp. So each file was named something like "sid=1234(timestamp)". That wouldn't work for what I wanted, every press of the submit button had to generate a csv file named the same. So I modified the java script (took me 2 hours to figure out how...) to keep a stable file name "sid=new.txt" I didn't figure out how to make it leave off the sid= part, but it worked like I wanted. Here is the code I modified and the hta form that I edited up from the html form that originally came with the java script. It's VERY basic, but when you smack the submit button, it creates a txt file with the data in csv format "it adds a time stamp field as well for some reason, but I just ignore that when I process the file". It's just that when I use a macro to run the hta file, it won't produce the csv file when I press submit. I'm certain that the java script file could be pretty easily modified by some one with a little more knowledge than I have about this stuff "pretty much 0" and that it might actually make a form like this usable.

Link to comment
Share on other sites

One more foot note, the way my macro was going to work "this won't make sense until you look at the modified script I posted", was for it to delete the sid=new.txt when you run the macro, then run test3.hta, and wait for the creation of the sid=new.txt file, once it detects that that file exists, it will close the test3.hta window, and process the txt file to assign the value of the variables in the macro. Kind of a back door to making the form work, without all the other complication in the original thread I referenced. If it would have worked, you could create some pretty complicated forms "the java script supports radio buttons and drop down menus" using simple HTML and have any script simply process the created csv file to assign the variables. Much easier to modify IMHO.

Link to comment
Share on other sites


Looks great.

Works for me doing;

Change Directory/Folder: "C:\Programs\SearchEngine"

Program Launch: "test3.hta"


Perhaps you have made the new text file in nthe default directory and couldn't find it? Change directory first?

Best, randall

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.

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.

  • Create New...