Rocket Software Homepage
Forum Home Forum Home > AccuTerm Knowledge Base (read only) > Scripting & Automation
  New Posts New Posts RSS Feed - How to include double-quotes in Shell command?
  FAQ FAQ  Forum Search   Register Register  Login Login

The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum.

Forum LockedHow to include double-quotes in Shell command?

 Post Reply Post Reply
Author
Message
lucasn View Drop Down
Newbie
Newbie


Joined: September 02 2016
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote lucasn Quote  Post ReplyReply Direct Link To This Post Topic: How to include double-quotes in Shell command?
    Posted: October 10 2016 at 4:31pm
I'm attempting to use ImageMagick's "identify" command to programmatically determine the dimensions of an image file for use in positioning / scaling / centering within an AccuTerm GUI Picture control.  The identify command -format requires some parameters to be enclosed in double quotes.

A command such as the following works in a regular DOS command box:
C:\identify -format "%w %h\r" "U:\My Documents\My Pictures\Test.jpg" > c:\xxyz.txt'


I am able to get things to work with a straight-forward command execution in a BASIC program:
EQU ESC TO CHAR(27), STX TO CHAR(2), CR TO CHAR(13)
CMD = 'identify -format "%f %wx%h\r" "U:\My Documents\My Pictures\Test.jpg" > c:\xxyz.txt'
CRT ESC:STX:'<;':CMD:CR


"forum.asent.com/topic1618.html" indicates the above method won't eliminate the DOS box that pops up, so I was wondering if there is a way to use Shell function in scripting instead?

I tried this, but it doesn't seem to produce the desired output file "xxyz.txt":
CMD = 'identify -format ""%f %wx%h\r"" ""U:\My Documents\My Pictures\Test.jpg"" > c:\xxyz.txt'
CRT ESC:STX:'P':\X = Shell("\:CMD:\")\:CR


What am I doing wrong here?  I haven't done a whole lot of VBA scripting or AccuTerm scripting yet.

Any help would be appreciated.

Thanks,
Lucas
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: October 11 2016 at 6:26pm
Hi Lucas -

You may need to create a .BAT (or powershell?) file to run your command. One problem is that the VBA Shell function does not provide redirection, which you are using to capture the results of the command. A .BAT file is executed by the command processor (cmd.exe) which provides the redirection. The Shell function has an optional WindowType argument you can set to vbHide which should run the command in a hidden DOS box.

If you don't mind the DOS box, you could re-write your command line using cmd.exe /C ... Look near the end of this thread for an example: http://forum.asent.com/using-ft_topic477.html

Thanks,

Pete

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.