String and Shell questions

Discussion in 'Questions (Windows Mobile)' started by HARRY, Dec 18, 2007.

  1. HARRY

    HARRY Active Member Licensed User

    Hi,

    Quite some time I had no opportunity to program; therefore I have forgotten some simple things. Two questions:

    1) How to include quote (") symbols in a string variable?

    2) Is Shell variable name a valid statement? Variable should include (" "," ")?

    Thanks for some help

    Harry
     
  2. agraham

    agraham Expert Licensed User

    "first bit " & chr(34) & "second bit". It's in Help - Main Help - Keywords - String - Chr

    Sorry, don't understand!
     
  3. agraham

    agraham Expert Licensed User

    Is this what you are asking about?

    Code:
    app = "someapp"
      arglist =
    Chr(34) & "this is arg0" & Chr(34) & " arg1" & " arg2 arg3"
      
    Shell(app, arglist)
    Note that the quoted string is a single argument and that spaces separate the non-quoted arguments otherwise they appear as one argument
     
  4. HARRY

    HARRY Active Member Licensed User

    Hello Agraham,

    Thanks for your prompt reply. The second question in fact was whether the parameter following the Shell statement can be a variable or must be a string itself. I think that a variable is allowed.

    Testing some more I got the following problem:

    Two lines of coding:
    DelStr="(" & Chr(34) & "C:\Program Files\MortScript\MortScript.exe" & Chr(34) & "," & Chr(34) & "C:\Program Files\MortScript\Delete.mscr, DelName=" & DestPath & "Data.zip" & Chr(34) & ")"

    Shell Delstr

    The contents of DelStr now is :

    ("C:\Program Files\MortScript\MortScript.exe","C:\Program Files\MortScript\Delete.mscr, DelName=C:\MIOMAP\UI_S\Data.zip")
    This results into the message: Invalid characters in path.

    Is this caused by the space between Program and Files and how to solve this ?

    Harry
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    You will need to use two variables. One for the first argument and one for the second:
    Code:
    V1 = Chr(34) & "C:\Program Files\MortScript\MortScript.exe" & Chr(34)
    V2 = 
    Chr(34) &  "C:\Program Files\MortScript\Delete.mscr, DelName=" &   DestPath &  "Data.zip" &  Chr(34)
    Shell(V1,V2)
     
Loading...