PDA

View Full Version : Opening a HTML Workshop File


sossy
04-24-2007, 11:31 PM
Hi,

I've created a .chm file (HTML Workshop File) and I'm having problems with it when I have built my program. I've searched these forums and found some help which was great as I wasn't putting the hh.exe bit in front of the sourcefolder.

When I "Preview" the page within AMS and click on my help button it loads fine. But when I build the program and click on my help button it doesn't come up. This is the error message I am receiving:

Cannot open the file:
c:\DOCUME~1\Tara\LOCALS~1\Temp\ir_ext_temp_2\Autop lay\Docs\filename.chm


This is the code I have entered in my program:

File.Run("hh.exe ".._SourceFolder.."\\Autoplay\\Docs\\filename.chm", "", "", SW_SHOWNORMAL, false);


After sourcing some other help on the forum I also tried putting the working folder with c:\\temp and tempfolder - with value changed to true. None of these worked either.

I also wondered if the space after .exe and before " shouldn't be there (i.e. "hh.exe ") so I took it out and tried that too. When I took out the space after .exe nothing happened at all when I clicked on the Help button. I didn't get an error message and nothing happend.

I really feel like I'm running around in circles and have no idea what I am doing wrong. I'm most probably missing the obvious!! :huh

Would really appreciate your help. Thank you! :D

Tara.

CyberRBT
04-24-2007, 11:48 PM
It looks like this is the issue that occurs when you compile your app to a single file. See if the 2nd post on this page helps: _SourceFolder Enhancement (http://www.indigorose.com/forums/showthread.php?t=19510)

Also, the help file path (*.chm) needs to be the second argument in your File.Run command.

Dermot
04-25-2007, 12:00 AM
I always use this if I want to open the help file at the begining.
File.Open(_SourceFolder.."\\Autoplay\\Docs\\filename.chm", _SourceFolder.."\\Autoplay\\Docs", SW_SHOWNORMAL)

and this if I want to open it and jump to a topic.


TopicID = 100
File.Run("HH.EXE -mapid "..TopicID.." ms-its:".._SourceFolder.."\\Autoplay\\Docs\\filename.chm", "", _SourceFolder.."\\Autoplay\\Docs", , SW_MAXIMIZE, false);
I haven't had a single problem with 100's of installations.

CyberRBT
04-25-2007, 12:04 AM
That TopicID tip is GREAT. :yes

Thanks.

I think he still needs to get the source folder with the mentioned function, though.

Dermot
04-25-2007, 12:07 AM
That function would return the path where the exe was run from. If his help file is compiled in the exe then _SourceFolder is all he needs.

Just realized that he did not specify how is was building it, as an exe or to a folder. If it is a to a folder, the problem could be renaming resources.

sossy
04-25-2007, 12:45 AM
Thank you very much for your speedy replies!!! :D

I'm still experiencing the same problem :(

I did what you suggested and put in a File.Open command only. This is what I originally had but changed it because it wasn't working. Same prob as last time. When I preview from ams it's opening the help file fine. But when I build and try and open the help file nothing happens at all - almost as if there isn't a link. I no longer get the error message as explained previously when I use the File.Open command. Given that I only want to open to the beginning of the help file this command is okay for me :)

What I am doing is building as a web exe file - single file.

Any other theories? :) Thank you so much!

sossy
04-25-2007, 12:49 AM
Thank you for your reply CyberRBT.

I had a look at that post you suggested:

It looks like this is the issue that occurs when you compile your app to a single file. See if the 2nd post on this page helps: _SourceFolder Enhancement

But it refers to a CD which is what I'm not doing.... should I still be putting this code into my program?

If yes, where do I insert the code? All the rest is under "On Menu" - so should I add it to the top of all the code that I have already placed or below it?

Sorry for my ignorance - I'm new to all of this :) Thankyou!

CyberRBT
04-25-2007, 12:59 AM
When you compile to a single EXE, it doesn't matter whether you run your app from CD or from elsewhere on your computer. The project is actually expanded and stored in the Temp folder.

Doing this causes the usual _SourceFolder constant to fail. So ... using the function in that post, do this.


_MySourceFolder = appPathOriginal();



Now, use _MySourceFolder where you were using _SourceFolder. Note, however, that this function ADDS the trailing backslash for you (omit the \\ from the start of your next string concatenation).

Also, once you get past this hurdle, i think you'll find that Dermot's tip will enhance your results even more.

Dermot
04-25-2007, 01:01 AM
File.Open(_SourceFolder.."\\Autoplay\\Docs\\filename.chm", _SourceFolder.."\\Autoplay\\Docs", SW_SHOWNORMAL)
This works fine for me when I build to an exe. Can you post your app or an example showing the problem?

If the help file is compiled into the exe, which it will if you have it in the Docs folder, you do not need the function CyberRBT mentioned. You would only need that function if the help file is outside the exe and located in the same folder as the exe.

Doing this causes the usual _SourceFolder constant to fail. So ... using the function in that post, do this.
I don't think so. _SourceFolder returns the path to where the autorun.exe file is running from after it is expanded to the Temp folder.

Dermot
04-25-2007, 01:13 AM
Here is an example that uses the code I posted above. Build it to an exe and you will see it works using _SourceFolder.

sossy
04-25-2007, 01:24 AM
Thank you once again :)

Well, I'm quite perplexed!!!

Dermot, I decided to quickly create a new little project doing exactly the same thing - my other project is way too large, plus I wanted to see what would happen if I did it again in a new project from scratch.

Amazingly it worked!!!! Thought there was no point in uploading that little project :)

So it must be the file / project I am currently working with. :(

sossy
04-25-2007, 01:35 AM
PS: Forgot to say that I did exactly the same thing. Created a menu - same File.Open command... and I built it the same way too. Funny hey?! :(

I opened your file Dermot and I know what you mean because the new project that I created I followed the same principles and it worked fine.

I exported my menu script but didn't know if I could post .lua files? And not sure where I post files?

Actually, just found where I post attachments, but not I cannot post .lua

sossy
04-25-2007, 02:02 AM
Apologies for all the posts!!

I did a little test. Replaced the Help file (.chm) with an HTML file, then a Word file, then a PDF file. All of the other files worked fine when I did a build and opened them. It's only the .chm Help file which isn't opening upon build. I left the same exact code, just replaced the file to open.

Does this help a little more? :)

Dermot
04-25-2007, 02:05 AM
There must be something different about your project.

To upload a project, use the Export option on the File menu to save it as an apz file. Then upload that file.

If you want to just post some code, just copy and paste into the post.

Dermot
04-25-2007, 02:09 AM
I did a little test. Replaced the Help file (.chm) with an HTML file, then a Word file, then a PDF file. All of the other files worked fine when I did a build and opened them. It's only the .chm Help file which isn't opening upon build. I left the same exact code, just replaced the file to open.

Does this help a little more?
Well that is strange. Could it be that the chm file is not being compiled into the exe? How large is the file? If you look in the temp folder (Something like this C:\Documents and Settings\Username\Local Settings\Temp\ir_ext_temp_0) and see if the chm file is in the Docs folder.

sossy
04-25-2007, 02:16 AM
Hi Dermot,

Thank you :) Ok - checked out that folder and nope, there's nothing in the docs folder.

The original help file is only 39kb

Dermot
04-25-2007, 02:22 AM
checked out that folder and nope, there's nothing in the docs folder.
So for some reason the file is not being compiled into the exe. Are you sure it is in the Docs folder in your project?

sossy
04-25-2007, 02:29 AM
yes, it's most definitely there... I checked several times just in case I'm getting a little weary :p Then I actually deleted it, then popped it back in there... then went and linked to it again. It's all rather strange, isn't it :eek:


Incidentally, I have 46 other documents - combination of Word and PDF docs - that are in the program, and every one of them opens fine in the build version. Don't know if that helps :)

sossy
04-25-2007, 02:46 AM
Dermot,

I just went through the built program, then went to the temps folder you mentioned before... but this one was called ir_ext_temp_02. The only docs which were listed there were the actual ones I opened... so all 47 docs were not listed in the docs folder under temp location... only the ones I clicked on in the program itself.

Really appreciate all your help with this! :)

wasim21k
04-25-2007, 02:54 AM
use this
File.Run("hh.exe ".._SourceFolder.."\\Autoplay\\Docs\\filename.chm" , "C:\\Temp", SW_SHOWNORMAL, true);



here is your one
File.Run("hh.exe ".._SourceFolder.."\\Autoplay\\Docs\\filename.chm" , "", "", SW_SHOWNORMAL, false);

the difference is c:\temp folder and if temp folder is missing you even dont get any error so you have to create temp folder by yourself or you can use system variable to point default temp folder yesterday i was having same problem

sossy
04-25-2007, 03:01 AM
Hello Wasim21k,

Thank you for replying :)

I did try that one too... but I was coming up with errors (refer my first post in this thread).

Now that we've been able to nut out a little what is happening, I think we have come to the conclusion that the .chm file isn't getting written to the exe file for some reason - have no idea way. Which makes sense why I was getting the original error right from teh very beginning (in reference to my first post)... it can't find the .chm file in temp because it isn't writing it for some reason.

For instance, because I'm getting so desparate with all of this :), I re-entered the same code you gave, and I came up with the same error as per originally saying it cannot open the file.

This is all very perplexing!!!! :huh

sossy
04-25-2007, 03:10 AM
Oh my goodness!!!!

You won't believe it guys - I've got it working!! YOOHOO!!!!

I kept on going back to the test project I did where I called my help file, just simply help.

The help file for my current project is very long - It had 7 words in it!!!! So it got me thinking... maybe the darn file name is too long or something!

So I renamed it to just plain old simple "Help" and miraculously it WORKED! Isn't that just amazing! And what a fluke!

This is perhaps something other people can learn from with .chm files - don't have too long a file name!! That's the only thing I'm putting it down to anyways as I haven't changed anything else.

Thank you so very very much everyone for your timely responses and help on this matter... it is has been greatly appreaciated!! :D This is a great little community!

wasim21k
04-25-2007, 03:13 AM
ooh good luck, thats nice tip to remember. :eek:

Dermot
04-25-2007, 10:48 AM
Wow! I would never had thought of that. Something to keep in mind for sure. Glad you got it working.

CyberRBT
04-25-2007, 07:13 PM
That's valuable info. How about actual character length of the filename? Have you determined what the max length is that works?

Intrigued
04-25-2007, 07:38 PM
It sounds like the 8.3 max (8 characters and 3 for extension, "DOS file name")