Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Problem with include

Explorer ,
Mar 19, 2009 Mar 19, 2009
Hi,

I'm trying to use includes for the first time and I have

#include "writeHTML.js"

where 'writeHTML.js' is in the same directory as the script calling it.

I've tried setting includepath to "./" or "/" or leaving it out altogether, but no luck... what am I doing wrong? I really don't want to use an absolute path...

Thanks,
Stan
TOPICS
Actions and scripting
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Valorous Hero ,
Mar 19, 2009 Mar 19, 2009
if using cs3 or higher put this line above the #include
#includepath $.fileName.parent

or CS2
#includepath WhoAmI().parent
#include "writeHTML.js"

function WhoAmI() {
var where;
try {
var FORCEERROR = FORCERRROR;
}
catch( err ) {
where = File(err.fileName);
}
return where;
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2009 Mar 20, 2009
thanks, I tried adding that, but I still get the error

Error 48: File or folder does not exist

-> #include "writeHTML.js"
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2009 Mar 20, 2009
ok this is odd (and kinda lame)

If I add the line

includepath

with nothing behind it, the damn thing works. unbelievable.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2009 Mar 20, 2009
stan_alachniewicz@adobeforums.com wrote:
> ok this is odd (and kinda lame)
>
> If I add the line
>
> includepath
>
> with nothing behind it, the damn thing works. unbelievable.

Nearly all of my scripts have an includepath specified, whether it's used or
not. It appears that you have to have at least one for '.' to be implicitly part
of the include path. Odd indeed.

-X
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2009 Mar 20, 2009
Hi X, haven't seen you in a while. haven't scripted in a bit, and now I'm working on what else, my web gallery script...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 23, 2009 Mar 23, 2009
ok, now I'm really irritated... so the script dialog opens, but it's not finding a function within the included .js file. what is going on?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 23, 2009 Mar 23, 2009
It would depend on where the include is and what format the function is declared.
functionName = function(){
}
would need to be inserted before calling.
function functionName(){
}
This should work anywhere.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 23, 2009 Mar 23, 2009
nevermind i think i had the syntax wrong.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 24, 2009 Mar 24, 2009
ok this is @#$@#$ing ridiculous. Now it's not working again. I have changed NOTHING and it just decides not to work. great product Adobe.

Paul the include is the very first line in the script. It just isn't working. I'm convinced the code is right, I've tried it every way possible. It just plum isn't working. I guess I'll just reinsert my code into the file and forget the include.

Thanks for all your help gentlemen, not your fault this isn't working.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Mar 25, 2009 Mar 25, 2009
LATEST
Hi Stan,

I hate to say this but if include in not working for you it's not because of Adobe's products. Just have a look and photomerge. Not only does it have includes but some of those have their own includes as well.

Here is what I would do. First put an alert at the start on the include file. If you don't get that alert when your main script runs you know there is a problem with the include path or syntax.

If you do get the alert then you most likely have a scope issue.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines