[vwnc] External process examples

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] External process examples

Maarten Mostert-2
Hi,
 
I am strugling with the External process API.
 
I want to open and continue some document from a path with spaces.
 
Something like:
 
ExternalProcess
  fork: 'start'
  arguments: (Array with: '"c:\My Test\AppDevGuide.pdf"').
 
or:
ExternalProcess
  fork: 'cmd'
  arguments:
   (Array with: '/x' with: '/c' with: 'start' with:
     'c:\My Test\AppDevGuide.pdf').
 
But these don't work.
 
 
I can do something like:
 
 ExternalProcess shOne: 'c:\My Test\StakePoint_1.36_Setup.exe'.
 
Which works and takes care of the spaces in the path file but it still waits till the process is finished which is not allways what I want. Often I want a do and continue behaviour.
 
Does anyone has some exmples related to the use of External process.
 
 
Regards,

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

[vwnc] Net.MailMessage and "real names"

Carl Gundel
How can I set the "real name" of the person sending an email using the
SimpleSMTPClient and an instance of MailMessage?  For example, if my email
address is [hidden email] but I want it to say it's from Carl Gundel, how
does that code look?

Thanks,

-Carl Gundel
http://www.runbasic.com
http://www.libertybasic.com 

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Net.MailMessage and "real names"

Janko Mivšek


Carl Gundel wrote:
> How can I set the "real name" of the person sending an email using the
> SimpleSMTPClient and an instance of MailMessage?  For example, if my email
> address is [hidden email] but I want it to say it's from Carl Gundel, how
> does that code look?

'Carl Grundel <[hidden email]>' ?

Best regards
Janko


--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] External process examples

Steven Kelly
In reply to this post by Maarten Mostert-2
The first example won't work: you can't use "start" as a command, because it doesn't exist as a .exe or .com file. Also, when calling start with a filename in double quotes, you must supply a window title: the syntax of the start command is:
 
START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
      [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
      [/WAIT] [/B] [command/program]
      [parameters]
 
...so if the first argument starts with double quotes, it is interpreted as a window title. You want something like:
start "" "c:\My Test\AppDevGuide.pdf"
That will work from the command line, but for a process you must supply a valid executable file, as you try in the second example. You need a command line like this:
 
cmd /x /c start "" "C:\My Test\AppDevGuide.pdf"
 
With the odd quoting code in WinProcess>>startProcess:arguments:, the only way to get the above commandLine is this:
 
ExternalProcess
  fork: 'cmd'
  arguments:
   #('/x /c start "" "C:\My Test\AppDevGuide.pdf"')
 
Essentially, we have bypassed the odd code, which tries to add double-quotes to everything in the arguments collection. The odd code is clearly wrong, since it fails to quote the first argument (e.g. /x in your example). It would be fun to know what the programmer was thinking when writing it, and the accompanying comment:
 
"Windows may parse things incorrectly if the arguments contain spaces, so wrap them all in double quotes. Amazingly, this seems to be ok even if people had already put double quotes in them."
 
If you want VW to wait until the start'ed process finishes, insert /wait after the "".
 
Steve
 

From: [hidden email] on behalf of Maarten MOSTERT
Sent: Sat 9/27/2008 16:00
To: VWNC
Subject: [vwnc] External process examples

Hi,
 
I am strugling with the External process API.
 
I want to open and continue some document from a path with spaces.
 
Something like:
 
ExternalProcess
  fork: 'start'
  arguments: (Array with: '"c:\My Test\AppDevGuide.pdf"').
 
or:
ExternalProcess
  fork: 'cmd'
  arguments:
   (Array with: '/x' with: '/c' with: 'start' with:
     'c:\My Test\AppDevGuide.pdf').
 
But these don't work.
 
 
I can do something like:
 
 ExternalProcess shOne: 'c:\My Test\StakePoint_1.36_Setup.exe'.
 
Which works and takes care of the spaces in the path file but it still waits till the process is finished which is not allways what I want. Often I want a do and continue behaviour.
 
Does anyone has some exmples related to the use of External process.
 
 
Regards,

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Net.MailMessage and "real names"

Carl Gundel
In reply to this post by Carl Gundel
Thanks Deanna.  SimpleSMTPClient may be obsolete, but I am still using VW
7.4.1.  Hopefully soon we'll be able to move to 7.6.

-Carl Gundel
Easy Windows programming - http://www.libertybasic.com
Easy web programming - http://www.runbasic.com
----- Original Message -----
From: "Simpson, Deanna" <[hidden email]>
To: "Carl Gundel" <[hidden email]>
Sent: Saturday, September 27, 2008 9:32 PM
Subject: RE: [vwnc] Net.MailMessage and "real names"


SimpleSMTPclient uses an instance of NetUser to set the username. Try
setting the NetUser instance's fullName.

Also, keep in mind that SimpleSMTPClient is considered to be obsolete,
and you may want to start using SMTPClient.

Good luck,

Deanna Simpson

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Carl Gundel
Sent: Saturday, September 27, 2008 7:29 PM
To: VWNC
Subject: [vwnc] Net.MailMessage and "real names"

How can I set the "real name" of the person sending an email using the
SimpleSMTPClient and an instance of MailMessage?  For example, if my
email
address is [hidden email] but I want it to say it's from Carl Gundel,
how
does that code look?

Thanks,

-Carl Gundel
http://www.runbasic.com
http://www.libertybasic.com

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] External process examples

Maarten Mostert-2
In reply to this post by Maarten Mostert-2

Hi Steve,

Well thanks this slowly getting better.  I now manage to open all kind of documents with the following.

ExternalProcess
  fork: 'cmd'
  arguments:
   #('/x /c start "" "C:\gtk\license.txt"')

The nice thing here is that my path names can conatin spaces which I didn't manage with the Aragon win32 thing.


I am also able to start programs  with some like:

ExternalProcess
  fork: 'cmd'
  arguments:
   #('/x /c start "" "c:\gtk\bin\gtk-demo.exe"').


Contrary to a document an executable makes VW wait for the demo to close so when I do the following.

[ExternalProcess
  fork: 'cmd'
  arguments:
   #('/x /c start "" "c:\gtk\bin\gtk-demo.exe"')] fork


A bit strange though that the External process fork does everything but forking.

Still strange also that I can't use something like:

ExternalProcess
  fork: 'c:\gtk\bin\gtk-demo.exe'
  arguments:
   #()

I think it would have been way more cool if the ExternalProcess class had an API with something like

   doLikeDoubleClickAndContinue: aFileName.

Regards,

@+Maarten,







> Message du 28/09/08 12:07

> De : "Steven Kelly"
> A : "VWNC"
> Copie à :
> Objet : Re: [vwnc] External process examples
>
>

The first example won't work: you can't use "start" as a command, because it doesn't exist as a .exe or .com file. Also, when calling start with a filename in double quotes, you must supply a window title: the syntax of the start command is:

 

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
>       [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
>       [/WAIT] [/B] [command/program]
>       [parameters]

 

...so if the first argument starts with double quotes, it is interpreted as a window title. You want something like:

start "" "c:\My Test\AppDevGuide.pdf"

That will work from the command line, but for a process you must supply a valid executable file, as you try in the second example. You need a command line like this:

 

cmd /x /c start "" "C:\My Test\AppDevGuide.pdf"

 

With the odd quoting code in WinProcess>>startProcess:arguments:, the only way to get the above commandLine is this:

 

ExternalProcess
>   fork: 'cmd'
>   arguments:
>    #('/x /c start "" "C:\My Test\AppDevGuide.pdf"')

 

Essentially, we have bypassed the odd code, which tries to add double-quotes to everything in the arguments collection. The odd code is clearly wrong, since it fails to quote the first argument (e.g. /x in your example). It would be fun to know what the programmer was thinking when writing it, and the accompanying comment:

 

"Windows may parse things incorrectly if the arguments contain spaces, so wrap them all in double quotes. Amazingly, this seems to be ok even if people had already put double quotes in them."

 

If you want VW to wait until the start'ed process finishes, insert /wait after the "".

 

Steve

 


From: [hidden email] on behalf of Maarten MOSTERT
> Sent: Sat 9/27/2008 16:00
> To: VWNC
> Subject: [vwnc] External process examples
>

>

Hi,

 

I am strugling with the External process API.

 

I want to open and continue some document from a path with spaces.

 

Something like:

 

ExternalProcess
>   fork: 'start'
>   arguments: (Array with: '"c:\My Test\AppDevGuide.pdf"').

 

or:

ExternalProcess
>   fork: 'cmd'
>   arguments:
>    (Array with: '/x' with: '/c' with: 'start' with:
>      'c:\My Test\AppDevGuide.pdf').

 

But these don't work.

 

 

I can do something like:

 

 ExternalProcess shOne: 'c:\My Test\StakePoint_1.36_Setup.exe'.

 

Which works and takes care of the spaces in the path file but it still waits till the process is finished which is not allways what I want. Often I want a do and continue behaviour.

 

Does anyone has some exmples related to the use of External process.

 

 

Regards,


>
> [ (pas de nom de fichier) (0.1 Ko) ]
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] External process examples

Alan Knight-2
In reply to this post by Steven Kelly
At 05:29 AM 9/28/2008, Steven Kelly wrote:
Essentially, we have bypassed the odd code, which tries to add double-quotes to everything in the arguments collection. The odd code is clearly wrong, since it fails to quote the first argument (e.g. /x in your example). It would be fun to know what the programmer was thinking when writing it, and the accompanying comment:
 
"Windows may parse things incorrectly if the arguments contain spaces, so wrap them all in double quotes. Amazingly, this seems to be ok even if people had already put double quotes in them."

Well, that would be me. I suspect what I was thinking was something along the lines of "ok, this seems to work for the cases I have". We'd already noticed the excessive quoting of the command-line options - that's in AR 54659, which primarily deals with using the right encoding when shelling out under Windows.

I certainly didn't know about the case of "start" treating its arguments differently if they're quoted or not. It seems to me that in this case the start can just be omitted anyway, as it's implicit in providing a data file name with an association. At least for me

ExternalProcess
  fork: 'cmd'
  arguments:
   (Array with: '/x' with: '/c' with:
     'c:\My Test\AppDevGuide.pdf').

works.
--
Alan Knight [|], Engineering Manager, Cincom Smalltalk

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] External process examples

Steven Kelly
In reply to this post by Maarten Mostert-2

Surely you didn’t expect Windows to be consistent, Alan? :-). In any case, thanks for adding the honest comment: if there’s code that’s likely to break, I’d much rather see a comment like “Amazingly, this seems to be ok” than no comment.

 

FWIW, cmd /x /c will work for non-executable files if and only if command extensions are enabled (the default). For the full details, see “help cmd” and “help start” for the Windows versions you are interested in. Just cmd /x /c does not work for URLs – for those you must use START – so it seems easier to use START all the time.

 

Steve

 

From: Alan Knight [mailto:[hidden email]]
Sent: 29 September 2008 17:06
To: Steven Kelly; VWNC
Subject: Re: [vwnc] External process examples

 

At 05:29 AM 9/28/2008, Steven Kelly wrote:

Essentially, we have bypassed the odd code, which tries to add double-quotes to everything in the arguments collection. The odd code is clearly wrong, since it fails to quote the first argument (e.g. /x in your example). It would be fun to know what the programmer was thinking when writing it, and the accompanying comment:
 
"Windows may parse things incorrectly if the arguments contain spaces, so wrap them all in double quotes. Amazingly, this seems to be ok even if people had already put double quotes in them."


Well, that would be me. I suspect what I was thinking was something along the lines of "ok, this seems to work for the cases I have". We'd already noticed the excessive quoting of the command-line options - that's in AR 54659, which primarily deals with using the right encoding when shelling out under Windows.

I certainly didn't know about the case of "start" treating its arguments differently if they're quoted or not. It seems to me that in this case the start can just be omitted anyway, as it's implicit in providing a data file name with an association. At least for me

ExternalProcess
  fork: 'cmd'
  arguments:
   (Array with: '/x' with: '/c' with:
     'c:\My Test\AppDevGuide.pdf').

works.

 

--

Alan Knight [|], Engineering Manager, Cincom Smalltalk


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc