Under My Computer"/Tools/Folder Options/File Types" I added a new type called "ijs". In it I defined several options with one called "Run" as a default. It is defined as

 "c:\Program Files\j\J601\j.exe" -jprofile d:\juser\config\runprof.ijs "%1"

runprof.ijs is a script which sets up the full development environment except no ijx nor the ijs windows is displayed. It also sets up error handling so if there is an error the ijx window pops up to show the error instead of just J going away. It also allows the ijs script to be anywhere instead of just under ~user.

I haven't looked at it in a while; however, the script below should work for you. But if there is a problem let me know. Anyway, it should give you enough clues to write your own. This is the runprof.ijs script:

NB. Profile for runtime. ______________________

0 : 0
This alternate profile will run a script file name in the forth item in ARGV_z_ if it exists. The environment that the script runs in is the same as if it were run in the J development mode. Therefore, any script developed and tested in the J development mode can be run as a standalone application simply by starting J
as follows:

Jsystempath\j.exe -jprofile userpath\config\runprof.ijs scripttorun [more args]

The folders for J, current directory and scripttorun are independent of each other. If profile.ijs is modified to allow the user data to be outside the J folders then it is independent also. If the unmodified version of profile.ijs is run then
userpath would be the same as Jsystempath.

When scripttorun gets control the -jprofile and runprof.ijs items are removed.
So, when scripttorun gets control, ARGV_z_ will look like
+-----+-----------+--------+---------+
|j.exe|scripttorun|optional|arguments|
+-----+-----------+--------+---------+

By defining the file type ijs to envoke J as described above means that any ijs file can be run as a standalone application by simply double clicking the file name in a directory list or from a shortcut to the file. It is not necessary to
use the J Project Manager to make a standalone application.

The current directory is saved over the running of profile.ijs so if profile.ijs
were modified to use the current directory it will still work properly.

The *.ijx window is suppressed by setting IFJIJX_j_ to one before passing control to profile.ijs. It looks like scripttorun should be run as part of profile.ijs as ARGV_z_ is set up to run it; however, for some reason when IFJIJX_j_ is set to
one it doesn`t run it.  So there is a separate load to run it.

Most of this script is enclosed in a local verb to make sure that the local names
are really local and disappear before scripttorun gets control.

To do:
Fix the load of scripttorun to watch for errors and open an ijx window if an error
occurs.

Might want to add another parameter, -edit, which means to bring up the script in
an .ijs window instead of running it.
)

3 : 0 ''
ARGV_z_=:({.,3:}.])ARGV_z_
IFJIJX_j_=:1
startpath=.1!:43''
config=.;{.4!:3''
sep=.{.'\/'(e.#[)config
1!:44 config{.~2 i.~+/\sep=config
NB. Only J primitives are available before here.
0!:0<(config ((i:{.[),]) sep),'profile.ijs'
NB. From this point on the full facilities of J are available.
1!:44 startpath
)

(0!:0 :: (3 : 0)){:2{.ARGV_z_
newijx_jijs_ 0
(1!:2&2)'NB. Error in script.'
(1!:2&2) ARGV_z_
(1!:2&2)13!:12''
)

NB. End of Script _______________________________

In addition to "Run" I added a few other commands - "Edit" to bring up a script for testing without having to start J first.

Philip A. Viton wrote:


Does anyone know if it's possible (under MS Win) to associate an ijs file with J such that when you double-click on the ijs, J starts up opens the file in its own window (ie equivalent to starting J and then doing File Open on the file you've selected)? Is this something that windows users think might be useful?

------------------------
Philip A. Viton
City Planning, Ohio State University
275 West Woodruff Avenue, Columbus OH 43210
[EMAIL PROTECTED]

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm




----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to