How to call a function in other .js file?

Help with writing and running scripts

How to call a function in other .js file?

Postby yagumo » Wed May 23, 2007 5:06 am

hi,
I want to write some common functions into a library file, like 'common.js', how can I call a function in my real .js file? Is there a 'include' statement just like PHP?
User avatar
yagumo
Newbie
 
Posts: 2
Joined: Tue May 22, 2007 11:00 pm

Re: How to call a function in other .js file?

Postby jorrasdk » Wed May 23, 2007 6:24 am

No, it's not possible at the moment to include common functions as you describe.

I suggest you send your suggestion for such an enhancement to the scripting support to IDM support (support@idmcomp.com).

"Include" could be either as a command like:
UltraEdit.include(script path);

or it could be an option in the Scripting/Scripts... dialogue to specify 1 or more "commons script file" which will be loaded and ready when UE starts.
(and while we are at it, the same place you should be able to specify an "onLoad" and "onUnload" functions to be invoked when opening and closing a file).

What do you think ?
User avatar
jorrasdk
Master
Master
 
Posts: 275
Joined: Mon Mar 19, 2007 11:00 pm
Location: Denmark

Re: How to call a function in other .js file?

Postby yagumo » Wed May 23, 2007 7:14 am

Thank you for your reply. Well, maybe this is the only thing what I can do now, I will send a mail for this suggestion. :D
User avatar
yagumo
Newbie
 
Posts: 2
Joined: Tue May 22, 2007 11:00 pm

Re: How to call a function in other .js file?

Postby SeeSea » Mon Jun 18, 2007 12:01 pm

Great~~
User avatar
SeeSea
Newbie
 
Posts: 1
Joined: Wed May 09, 2007 11:00 pm

Re: How to call a function in other .js file?

Postby Jurriaan » Thu Jun 21, 2007 9:19 am

While any of the above alternatives would be much better, there is one way to do it now if you would really want it. Just create a script, that writes the snippets/function(s) you want. So a script to create a script. when you create a new script, you just run that and your functions are 'included'. Of course when you would update that script, than only scripts made after that would be updated, which makes it bad for code reusability, but it beats retyping common use functions over and over.
User avatar
Jurriaan
Basic User
Basic User
 
Posts: 16
Joined: Wed Aug 30, 2006 11:00 pm


Return to Scripts

cron