The SH code from David Mitchell works.
I can now experiment and see how it works.

Thanks for the support.


Bill Szuch

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Saturday, 18 June 2011 2:00 PM
To: [email protected]
Subject: Programming Digest, Vol 69, Issue 27

Send Programming mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://jsoftware.com/cgi-bin/mailman/listinfo/programming
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific than
"Re: Contents of Programming digest..."


Today's Topics:

   1. Re: wd and winexec (bill lam)
   2. Re: wd and winexec (David Mitchell)
   3. Re: wd and winexec (Devon McCormick)
   4. Re: wd and winexec (David Mitchell)
   5. Re: wd and winexec (David Mitchell)
   6. Re: wd and winexec (Devon McCormick)
   7. Re: wd and winexec (David Mitchell)
   8. hfd compatibility (Ric Sherlock)


----------------------------------------------------------------------

Message: 1
Date: Fri, 17 Jun 2011 12:17:41 +0800
From: bill lam <[email protected]>
Subject: Re: [Jprogramming] wd and winexec
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

> Eg.   wd 'winexec  ...'

For linux/mac, try 2!:0 or 2!:1
For windows, try window api or task package,

eg, type browse_j_ or xedit_j_ in gtkide

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3


------------------------------

Message: 2
Date: Fri, 17 Jun 2011 04:56:41 -0400
From: David Mitchell <[email protected]>
Subject: Re: [Jprogramming] wd and winexec
To: Programming forum <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

This works for me using J701 on Win7_64:

SH=: 3 : 0
   '' SH y
:
   ShellExecute=. 'shell32 ShellExecuteW > i x *w *w *w *w i'&cd
   SW_SHOWNORMAL=. 1
   NULL=. <0
   if. 0=#x do.
     r=. ShellExecute 0;(uucp 'open');(uucp y);NULL;NULL;SW_SHOWNORMAL
   else.
     r=. ShellExecute 0;(uucp 'open');(uucp x);(uucp dquote
y);NULL;SW_SHOWNORMAL
   end.
)

   SH 'd:\TestJ.xlsm'                        NB. excel
   SH 'd:\win7x64sdkset.txt'                 NB. text with default program
   'notepad.exe' SH 'd:\win7x64sdkset.txt'   NB. text with notepad

--
David Mitchell

On 6/16/2011 21:02, William Szuch wrote:
> In J602 I could execute various programs as part of a job when a script
was
> loaded,
>
>
>
> Eg.   wd 'winexec  ...'
>
>
>
> This was used to open excel  workbooks,  word reports, notepad  etc.
>
>
>
> As WD is not supported in J701  I have not been able to achieve  the same
> functionality in J701.
>
>
>
> Any help greatly appreciated.
>
>
>
>
>
> Regards
>
>
>
> Bill Szuch
>
>
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


------------------------------

Message: 3
Date: Fri, 17 Jun 2011 08:24:08 -0400
From: Devon McCormick <[email protected]>
Subject: Re: [Jprogramming] wd and winexec
To: Programming forum <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8

This works for me for J7 on Windows XP:
fork 'C:\Program Files\Microsoft Office\Office14\Excel.exe'

On Thu, Jun 16, 2011 at 9:02 PM, William Szuch
<[email protected]>wrote:

> In J602 I could execute various programs as part of a job when a script
was
> loaded,
>
>
>
> Eg.   wd 'winexec  ...'
>
>
>
> This was used to open excel  workbooks,  word reports, notepad  etc.
>
>
>
> As WD is not supported in J701  I have not been able to achieve  the same
> functionality in J701.
>
>
>
> Any help greatly appreciated.
>
>
>
>
>
> Regards
>
>
>
> Bill Szuch
>
>
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail


------------------------------

Message: 4
Date: Fri, 17 Jun 2011 08:51:12 -0400
From: David Mitchell <[email protected]>
Subject: Re: [Jprogramming] wd and winexec
To: Programming forum <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

One grumble I have had for a while with fork (at least on Windows) is its
lack 
of any result indicating success or failure:

fork 'xwy'
fork 'd:\TestJ.xlsm'
fork 'C:\Program Files\Microsoft Office\Office14\Excel.exe'
fork 'C:\Program Files\Microsoft Office\Office14\Excel.exe'
fork 'D:\Program Files (x86)\Microsoft Office\Office14\Excel.exe'
fork 'D:\Program Files (x86)\Microsoft Office\Office14\Excel.exe
d:\TestJ.xlsm'

The first 4 failed with no result.  The last two succeeded with no result.

    SH 'Excel.exe'  NB. Worked
42
    SH 'xwy'        NB. Failed
2
    SH 'C:\Program Files\Microsoft Office\Office14\Excel.exe'  NB. failed
2

The verb SH returns the result from ShellExecute:

"If the function succeeds, it returns a value greater than 32. If the
function 
fails, it returns an error value that indicates the cause of the failure."

#define ERROR_FILE_NOT_FOUND        2

--
David Mitchell

On 6/17/2011 8:24, Devon McCormick wrote:
> fork 'C:\Program Files\Microsoft Office\Office14\Excel.exe'


------------------------------

Message: 5
Date: Fri, 17 Jun 2011 11:06:28 -0400
From: David Mitchell <[email protected]>
Subject: Re: [Jprogramming] wd and winexec
To: Programming forum <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

The SH verb works for me on WinXP also:

    SH 'c:\t.txt'
42
    'wordpad.exe' SH 'c:\t.txt'
42

--
David Mitchell

On 6/17/2011 8:24, Devon McCormick wrote:
> This works for me for J7 on Windows XP:
> fork 'C:\Program Files\Microsoft Office\Office14\Excel.exe'
>
> On Thu, Jun 16, 2011 at 9:02 PM, William
Szuch<[email protected]>wrote:
>
>> In J602 I could execute various programs as part of a job when a script
was
>> loaded,
>>
>>
>>
>> Eg.   wd 'winexec  ...'
>>
>>
>>
>> This was used to open excel  workbooks,  word reports, notepad  etc.
>>
>>
>>
>> As WD is not supported in J701  I have not been able to achieve  the same
>> functionality in J701.
>>
>>
>>
>> Any help greatly appreciated.
>>
>>
>>
>>
>>
>> Regards
>>
>>
>>
>> Bill Szuch
>>
>>
>>
>>
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>


------------------------------

Message: 6
Date: Fri, 17 Jun 2011 11:36:23 -0400
From: Devon McCormick <[email protected]>
Subject: Re: [Jprogramming] wd and winexec
To: Programming forum <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8

I like something like "fork" because it's more platform-independent.  It
would be nice if it returned a PID, though.

On Fri, Jun 17, 2011 at 11:06 AM, David Mitchell
<[email protected]>wrote:

> The SH verb works for me on WinXP also:
>
>    SH 'c:\t.txt'
> 42
>    'wordpad.exe' SH 'c:\t.txt'
> 42
>
> --
> David Mitchell
>
> On 6/17/2011 8:24, Devon McCormick wrote:
> > This works for me for J7 on Windows XP:
> > fork 'C:\Program Files\Microsoft Office\Office14\Excel.exe'
> >
> > On Thu, Jun 16, 2011 at 9:02 PM, William Szuch<[email protected]
> >wrote:
> >
> >> In J602 I could execute various programs as part of a job when a script
> was
> >> loaded,
> >>
> >>
> >>
> >> Eg.   wd 'winexec  ...'
> >>
> >>
> >>
> >> This was used to open excel  workbooks,  word reports, notepad  etc.
> >>
> >>
> >>
> >> As WD is not supported in J701  I have not been able to achieve  the
> same
> >> functionality in J701.
> >>
> >>
> >>
> >> Any help greatly appreciated.
> >>
> >>
> >>
> >>
> >>
> >> Regards
> >>
> >>
> >>
> >> Bill Szuch
> >>
> >>
> >>
> >>
> >>
> >> ----------------------------------------------------------------------
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> >
> >
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail


------------------------------

Message: 7
Date: Fri, 17 Jun 2011 13:40:37 -0400
From: David Mitchell <[email protected]>
Subject: Re: [Jprogramming] wd and winexec
To: Programming forum <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

I hate to say it but fork (via fork_jtask_) is implemented in a very
different 
way on J701 for Windows than it is on J701 for Linux, for example.

On Windows, fork_jtask_ uses the CreateProcess API Windows call.  On Linux,
it 
uses the 2!:1 foreign verb.

Looking at the J source, 2!:1 seems to use the Linux function system().
This is 
the brief documentation for system() that I found:

system - execute a shell command

So, to me, using ShellExecute in Windows actually seems a bit more similar
to 
what J is doing in Linux to execute a command than what fork_jtask_ does in
Windows.

--
David Mitchell

On 6/17/2011 11:36, Devon McCormick wrote:
> I like something like "fork" because it's more platform-independent.  It
> would be nice if it returned a PID, though.
>
> On Fri, Jun 17, 2011 at 11:06 AM, David
Mitchell<[email protected]>wrote:
>
>> The SH verb works for me on WinXP also:
>>
>>     SH 'c:\t.txt'
>> 42
>>     'wordpad.exe' SH 'c:\t.txt'
>> 42
>>
>> --
>> David Mitchell
>>
>> On 6/17/2011 8:24, Devon McCormick wrote:
>>> This works for me for J7 on Windows XP:
>>> fork 'C:\Program Files\Microsoft Office\Office14\Excel.exe'
>>>
>>> On Thu, Jun 16, 2011 at 9:02 PM, William Szuch<[email protected]
>>> wrote:
>>>
>>>> In J602 I could execute various programs as part of a job when a script
>> was
>>>> loaded,
>>>>
>>>>
>>>>
>>>> Eg.   wd 'winexec  ...'
>>>>
>>>>
>>>>
>>>> This was used to open excel  workbooks,  word reports, notepad  etc.
>>>>
>>>>
>>>>
>>>> As WD is not supported in J701  I have not been able to achieve  the
>> same
>>>> functionality in J701.
>>>>
>>>>
>>>>
>>>> Any help greatly appreciated.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Regards
>>>>
>>>>
>>>>
>>>> Bill Szuch
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>
>>>
>>>
>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>


------------------------------

Message: 8
Date: Sat, 18 Jun 2011 15:05:46 +1200
From: Ric Sherlock <[email protected]>
Subject: [Jprogramming] hfd compatibility
To: Programming forum <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

In J6 the hfd (hex from decimal) verb in the convert script was:
hfd=: '0123456789ABCDEF' {~ 16 #.^:_1 ]

In J7 the hfd verb is incorporated into the stdlib.ijs script (loaded
automatically) and is defined as:
hfd=: '0123456789abcdef' {~ 16 #.^:_1 ]

One side effect of this change is the potential for unintended
incompatibilities between J6 & J7 code.

For example the recent J Rosetta Code submissions for the URL
encode/decode tasks work fine in J6 but
http://rosettacode.org/wiki/URL_decoding#J
http://rosettacode.org/wiki/URL_encoding#J

Are there good reasons for the definition change? If there aren't my
suggestion is that the old definition be reinstated.

Ric


------------------------------

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

End of Programming Digest, Vol 69, Issue 27
*******************************************


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

Reply via email to