<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META name=Generator content="Microsoft Word 14 (filtered medium)">
<STYLE>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
..shape {behavior:url(#default#VML);}
</STYLE>
<STYLE><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
..MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></STYLE>
</HEAD>
<BODY dir=ltr lang=EN-NZ vLink=purple link=blue>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV><STRONG>I recall there are undocumented limits on the length of line that
can be executed as well from cmd and batch files, as well features such as
redirect ( > and >> and | ). These may or may not work at cmd
prompt level and may not work the same from a batch file, and similar
limitations likely apply to Shellexecute. I was wondering if the
length of your command might be hitting such a limit.</STRONG></DIV>
<DIV><STRONG></STRONG> </DIV>
<DIV><STRONG>The advantage of a batch file is you can test it from a cmd prompt,
if it works there then if should work from shellexecute.</STRONG></DIV>
<DIV><STRONG></STRONG> </DIV>
<DIV><STRONG>I would also be inclined to put the SQL into a separate file if
there was an option to do that just for tidiness, or at least put the SQL and
the encoding options into separate strings, so that each can be made
standard.</STRONG></DIV>
<DIV> </DIV>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 12pt">John Bird<BR>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none"><B></B></DIV></DIV>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none"><B>From:</B>
<A title=Conor_Boyd@trimble.com href="mailto:Conor_Boyd@trimble.com">Conor
Boyd</A> </DIV>
<DIV style="FONT: 10pt tahoma">
<DIV style="BACKGROUND: #f5f5f5">
<DIV><B>Sent:</B> Monday, February 13, 2012 10:31 AM</DIV>
<DIV><B>To:</B> <A title=delphi@listserver.123.net.nz
href="mailto:delphi@listserver.123.net.nz">NZ Borland Developers Group - Delphi
List</A> </DIV>
<DIV><B>Subject:</B> Re: [DUG] Shell Execute</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV class=WordSection1>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt">You
can only ShellExecute one command at a time. You’ll have to have two
separate calls to ShellExecute for your two invocations of
ogr2ogr.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"><o:p></o:p></SPAN> </P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt">Only
other way I can think might work would be to write a temporary batch file with
both ogr2ogr invocations in it, and ShellExecute that, but I think two separate
calls to ShellExecute would be clearer.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"><o:p></o:p></SPAN> </P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt">Cheers,<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"><o:p></o:p></SPAN> </P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt">Conor<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"><o:p></o:p></SPAN> </P>
<DIV>
<DIV
style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 0cm; PADDING-RIGHT: 0cm; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<P class=MsoNormal><B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt"
lang=EN-US>From:</SPAN></B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt" lang=EN-US>
delphi-bounces@listserver.123.net.nz
[mailto:delphi-bounces@listserver.123.net.nz] <B>On Behalf Of </B>Bob
Pawley<BR><B>Sent:</B> Monday, 13 February 2012 10:20 a.m.<BR><B>To:</B> NZ
Borland Developers Group - Delphi List<BR><B>Subject:</B> Re: [DUG] Shell
Execute<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p></o:p> </P>
<DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">Thanks, I missed that.
However I still get only the second table blocks. The first table entities is
missed.<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">Bob<o:p></o:p></SPAN></P></DIV>
<DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<DIV>
<P style="BACKGROUND: whitesmoke" class=MsoNormal><B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt">From:</SPAN></B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"> <A
title=Conor_Boyd@trimble.com href="mailto:Conor_Boyd@trimble.com">Conor Boyd</A>
<o:p></o:p></SPAN></P></DIV>
<DIV>
<P style="BACKGROUND: whitesmoke" class=MsoNormal><B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt">Sent:</SPAN></B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt">
Sunday, February 12, 2012 12:01 PM<o:p></o:p></SPAN></P></DIV>
<DIV>
<P style="BACKGROUND: whitesmoke" class=MsoNormal><B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt">To:</SPAN></B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"> <A
title=delphi@listserver.123.net.nz href="mailto:delphi@listserver.123.net.nz">NZ
Borland Developers Group - Delphi List</A> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P style="BACKGROUND: whitesmoke" class=MsoNormal><B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt">Subject:</SPAN></B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"> Re:
[DUG] Shell Execute<o:p></o:p></SPAN></P></DIV></DIV></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: black"> <o:p></o:p></SPAN></P></DIV></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt">Unless
I’m reading it wrong, you’re missing a backslash in the path that you’re
constructing to the ogr2ogr binary.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="COLOR: black"> </SPAN><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="COLOR: #00002b">ProgramName
:=<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="COLOR: #00002b">
'"'+s+'\Quantum GIS Wroclaw\bin'+<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="COLOR: #00002b">'ogr2ogr"<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="COLOR: black"> </SPAN><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt">I
think there should be a slash after the “bin”?<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="COLOR: black"> </SPAN><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"><o:p></o:p></SPAN></P>
<DIV>
<DIV
style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 0cm; PADDING-RIGHT: 0cm; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<P class=MsoNormal><B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"
lang=EN-US>From:</SPAN></B><SPAN
style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"
lang=EN-US> <A
href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</A>
<A
href="mailto:[mailto:delphi-bounces@listserver.123.net.nz]">[mailto:delphi-bounces@listserver.123.net.nz]</A>
<B>On Behalf Of </B>Bob Pawley<BR><B>Sent:</B> Monday, 13 February 2012 6:54
a.m.<BR><B>To:</B> DUG<BR><B>Subject:</B> [DUG] Shell
Execute<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><SPAN style="COLOR: black"> <o:p></o:p></SPAN></P>
<DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">Hi <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">I’m having a further problem
with shell execute. There seems to be a dearth of information on the web other
than a simple “open” procedure.<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">The following two part code
performs well when I copy and paste it into command
prompt.<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">However when I use it in shell
execute there is a problem getting both parts to run
together.<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">In shell execute each part of
the code does its thing when the other part is commented
out.<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">I have tried joining the two
parts with the ogr2ogr command &&, and as it appears below. I have also
removed the second path to ogr2ogr with no joy.<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">I either get “unable to run” or
the second part of the code is recognized with the first part being
ignored.<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">The following is my command
prompt code – which works as shown<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">set
PGCLIENTENCODING=LATIN1&&set DXF_ENCODING=LATIN1&&set
DXF_INLINE_BLOCKS=FALSE&&set
DXF_MERGE_BLOCK_GEOMETRIES=FALSE&&ogr2ogr -f "PostgreSQL"
PG:"host=localhost user=postgres dbname=*** password=*****"
Water2000.dxf -lco DIM=2 -nlt GEOMETRY -sql "select layer, linetype,
subclasses, ogr_style, blockname, blockangle, blockscale, text from entities"
-append -update -skipfailures <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">set
PGCLIENTENCODING=LATIN1&&set DXF_ENCODING=LATIN1&&set
DXF_INLINE_BLOCKS=FALSE&&set
DXF_MERGE_BLOCK_GEOMETRIES=FALSE&&ogr2ogr -f "PostgreSQL"
PG:"host=localhost user=postgres dbname=*** password=****"
Water2000.dxf -lco DIM=2 -nlt GEOMETRY -append -update -skipfailures
-sql "select layer, linetype, subclasses, ogr_style, blockname, text from
blocks" <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">Here is the shell execute code
which is giving me a challenge -<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">ProgramName
:=<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">
'"'+s+'\Quantum GIS Wroclaw\bin'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">'ogr2ogr" "-f"
'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b">'"PostgreSQL";'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">' PG:"host='+DBHost+'
user=postgres dbname='+DBName+' password='+Pass+'" "'+ DXFfile +'"
'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">' --config DXF_INLINE_BLOCKS
FALSE --config DXF_MERGE_BLOCK_GEOMETRIES FALSE --config DXF_ENCODING=UTF8
'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">' -lco DIM=2 -nlt GEOMETRY
-overwrite -skipfailures'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">' -sql "select layer, linetype,
subclasses, ogr_style, blockname, blockangle, blockscale, text from
entities"'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">
'"'+s+'\Quantum GIS Wroclaw\bin'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b">'ogr2ogr""-f"'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">'
"PostgreSQL";'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">'PG:"host='+DBHost+'
user=postgres dbname='+DBName+' password='+Pass+'" "'+ DXFfile +'"
'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">' --config DXF_INLINE_BLOCKS
FALSE --config DXF_MERGE_BLOCK_GEOMETRIES FALSE --config DXF_ENCODING=UTF8
'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">' -lco DIM=2 -nlt GEOMETRY
-overwrite -skipfailures'+<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">' -sql "select layer, linetype,
subclasses, ogr_style, blockname, text from
blocks"';<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN style="COLOR: #00002b">Thanks in advance for any
suggestions.<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="COLOR: #00002b">Bob<o:p></o:p></SPAN></P></DIV></DIV></DIV>
<DIV style="TEXT-ALIGN: center" class=MsoNormal align=center><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: black">
<HR align=center SIZE=2 width="100%">
</SPAN></DIV>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: black">_______________________________________________<BR>NZ
Borland Developers Group - Delphi mailing list<BR>Post: <A
href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</A><BR>Admin:
<A
href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</A><BR>Unsubscribe:
send an email to <A
href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</A>
with Subject: unsubscribe<o:p></o:p></SPAN></P></DIV></DIV></DIV></DIV>
<P>
<HR>
_______________________________________________<BR>NZ Borland Developers Group -
Delphi mailing list<BR>Post: delphi@listserver.123.net.nz<BR>Admin:
http://delphi.org.nz/mailman/listinfo/delphi<BR>Unsubscribe: send an email to
delphi-request@listserver.123.net.nz with Subject:
unsubscribe</DIV></DIV></DIV></BODY></HTML>