Launching Dyalog with Quad CMD

Using (or providing) components based on the "Win32" framework

Launching Dyalog with Quad CMD

Postby paulmansour on Mon Jan 26, 2015 3:49 pm

Hi All,

I cannot get ⎕CMD to launch another Dyalog session with a workspace with an embedded space in the name in a synchronous fashion. For example:

      ⎕CMD '"c:\really long path with spaces.dyalog.exe" c:\shortpathnospaces\myworkspace.dws'


works fine, but:

      ⎕CMD '"c:\really long path with spaces.dyalog.exe" "c:\path with spaces\myworkspace.dws"'


does not work.

I can get it to work using the windows scripting host Run method, no problem, which is what I am doing now, but I wondered if there is a simple way to get ⎕CMD to deal with it.
paulmansour
 
Posts: 420
Joined: Fri Oct 03, 2008 4:14 pm

Re: Launching Dyalog with Quad CMD

Postby Phil Last on Mon Jan 26, 2015 5:55 pm

You could use the scripting host's method "GetFile" to get a file object, then use the file object's property "ShortPath" to pass to ⎕CMD.

(Bit of a roadroller to avoid using a sledgehammer to crack a nut.)
User avatar
Phil Last
 
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: Launching Dyalog with Quad CMD

Postby DanB|Dyalog on Tue Jan 27, 2015 2:33 am

You could also use .Net which is much more reliable.
In general I found that using spaces and other "unusual" characters in filenames and folders is a bad idea. You`d think that in this day and age we should be able to but it's still a problem at times. I avoid using them.
DanB|Dyalog
 

Re: Launching Dyalog with Quad CMD

Postby Phil Last on Tue Jan 27, 2015 8:27 am

Dan wrote:You could also use .Net which is much more reliable.

From a nutcracker to a sledgehammer to a roadroller to a particle accelerator.

I agree with you Dan that using blanks is "a bad idea" 'though I thoroughly disagree that "in this day and age we should be able to". A huge mistake on MS's part.

Nevertheless I guess what we're actually looking at is a bug in the parsing of filenames in ⎕CMD. Perhaps that could be tackled.
User avatar
Phil Last
 
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: Launching Dyalog with Quad CMD

Postby AndyS|Dyalog on Tue Jan 27, 2015 9:03 am

Not so much a parsing bug in the interpreter, but rather a limitation of the underlying operating system call (cmd.exe /c); the Windows Command Processor does not allow more than one set of double quotes in a command string.

We added some details about this in the ⎕CMD section of the documentation (http://help.dyalog.com/14.0/Content/Language/System%20Functions/Execute%20Windows%20Command.htm); it's in the 14.0 documentation, but holds equally well for earlier versions of Dyalog too.

[BTW: clicking on the "Open topic with navigation" link at the top of the page brings you back into the normal online help system]
User avatar
AndyS|Dyalog
 
Posts: 257
Joined: Tue May 12, 2009 6:06 pm

Re: Launching Dyalog with Quad CMD

Postby Phil Last on Tue Jan 27, 2015 9:34 am

Isn't there a way (sure I've seen it somewhere) that we can specify the dyalog.exe in a short form using the environment variable "dyalog"? That would obviate the need for the first pair of doublequotes.
User avatar
Phil Last
 
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: Launching Dyalog with Quad CMD

Postby Vince|Dyalog on Tue Jan 27, 2015 10:10 am

Hi Paul,

You could also use ⎕na to get the Short Path Name of the workspace.

      ⎕na 'I4 kernel32.dll|GetShortPathName* <0T >0T I4'
GetShortPathName 'C:\Program Files (x86)\Dyalog\Dyalog APL 14.0 Unicode\ws\math.dws' 255 255
43 C:\PROGRA~2\Dyalog\DYALOG~3.0UN\ws\math.dws

⎕cmd '"C:\Program Files (x86)\Dyalog\Dyalog APL 14.0 Unicode\dyalog.exe" C:\PROGRA~2\Dyalog\DYALOG~3.0UN\ws\math.dws'


Regards,

Vince
Vince|Dyalog
 
Posts: 412
Joined: Wed Oct 01, 2008 9:39 am

Re: Launching Dyalog with Quad CMD

Postby paulmansour on Tue Jan 27, 2015 1:22 pm

Thanks for all the tips.

As on old timer myself, I also generally avoid blanks in files names and dots, and even file names longer than 8 letters!

But all this stuff creeps in when you are dealing with folders created by other apps and the operating system.
paulmansour
 
Posts: 420
Joined: Fri Oct 03, 2008 4:14 pm

Re: Launching Dyalog with Quad CMD

Postby ray on Tue Jan 27, 2015 2:04 pm

I use Dyalog to "launch" APL systems a lot, and I have been using a ⎕NA call to ShellExecute since Dyalog V7 and Windows 3.11.

In the early days, ⎕CMD used to have a lot of problems, and (due to local security restrictions) it is not an option that is currently available at one major site I support.

The main problem with a Dyalog application starting up another Dyalog system is that some routes end up having "command line length restrictions". This is especially a problem when trying to start Dyalog in development mode on a PC without Dyalog being installed, and so having to specify a large number of command line parameters, several with file names.

Good luck.
User avatar
ray
 
Posts: 221
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK

Re: Launching Dyalog with Quad CMD

Postby Tomas Gustafsson on Tue Jan 27, 2015 3:20 pm

Tomas Gustafsson
 
Posts: 101
Joined: Mon Sep 19, 2011 6:43 pm


Return to Windows: GUI, COM/OLE/ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest