Installing COMatePLUS

Just starting out? Need help? Post your questions and find answers here.
jsampson45
User
User
Posts: 18
Joined: Mon Nov 11, 2013 12:10 pm

Installing COMatePLUS

Post by jsampson45 »

I am trying to use COMatePLUS which has a help (.chm) file, but there is nothing in this to tell me where to extract the files to. If I try to run anything I get 'file not found' errors with generic path information. If I call XIncludeFile, where does PureBasic look for files? In the line 'IncludePath "..\"', relative to which folder is this path string?
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Installing COMatePLUS

Post by luis »

I've never used COMate in my life, but I tried to open the demo "Demo_SendKeys.pb" in "Basic demos" and it worked right away (*). The demo contains:

Code: Select all

IncludePath "..\"
XIncludeFile "COMatePLUS.pbi"
The first statement says all the following include files will be searched in the directory just above the "Demo_Sendkeys.pb" file (read the manual about "IncludePath"). And in fact the XIncludeFile "COMatePLUS.pbi" just includes the file in the that dir (the root file of the zip).

(*) The demos will probably raise an error "an array is expected"; just remove the "@" from the array name (evidently something is changed in the compiler along the way, and it does make sense since the param is declared as Array, so no need for an "@").

The include files, when no includpath is specified, are normally resolved relatively to the position on the MAIN source file, not as in other languages relative to the file containing the include statement. Don't ask me why, I always though it's a very bad idea.

Please see this thread and my example -> http://www.purebasic.fr/english/viewtop ... =3&t=35292. There is also a workaround I use constantly based on the #PB_Compiler_FilePath, again shown in that thread.
"Have you tried turning it off and on again ?"
jsampson45
User
User
Posts: 18
Joined: Mon Nov 11, 2013 12:10 pm

Re: Installing COMatePLUS

Post by jsampson45 »

Thanks for your help. I assume that you installed COMatePLUS first before opening "Demo_Sendkeys.pb". How did you do this? Where did you put "Demo_Sendkeys.pb" so that PureBasic found it?
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Installing COMatePLUS

Post by luis »

jsampson45 wrote: I assume that you installed COMatePLUS first before opening "Demo_Sendkeys.pb". How did you do this? Where did you put "Demo_Sendkeys.pb" so that PureBasic found it?
?

There is nothing to install, just unzip the zip in a path of your choice keeping the directory structure and it's ready to go.
Then you launch PB, navigate to the dir containing the demos and open open "Demo_Sendkeys.pb".
To use COMate in your programs instead, just mimic what that demo does.
Use includepath to specify the dir where you unzipped the archive, containing the main COMatePLUS.pbi file, and then include COMatePLUS.pbi. In turn, it will include other files as well, and that's why the includepath is needed.
As I said, PB try to resolve any include relative to position in the file system of the main file of your program. Includepath temporarily changes this.

The use of includepath could be avoided using the form XIncludeFile #PB_Compiler_FilePath + "MyFile.pb" inside the COMate source. But since that has not been used there you have to specify includepath instead.

Really, if you look at the help of all the include* commands + read the thread I linked, you *must* be able to sort it out.
Try some experiment writing a dummy program and putting some includes and maybe nested includes in it, like in my example. You have to grasp it how it works. When you do, you will be able to get any program posted in the forum and make it work on your system fixing any path problem (for example you could just add #PB_Compiler_FilePath in COMAte where needed to remove the includepath requirement).

Again, programs (especially include libraries like this one) written using the XIncludeFile #PB_Compiler_FilePath + "MyFile.pb" does not need any fix and they just work. So I suggest you to adopt that style in your future programs.
But first you need to understand how all this work, so try it. It's easy when you get used to it. :wink:
"Have you tried turning it off and on again ?"
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Installing COMatePLUS

Post by srod »

As Luis says; there is no install. Just look at the demo programs.

By the way, the manual covers all this. You obviously did not look closely enough.
I may look like a mule, but I'm not a complete ass.
jsampson45
User
User
Posts: 18
Joined: Mon Nov 11, 2013 12:10 pm

Re: Installing COMatePLUS

Post by jsampson45 »

Nevertheless, Luis's post should be a useful summary for those who are short of time.
Post Reply