+ Reply to Thread
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 25
  1. #11
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    1,064

    Default

    Registered forum members do not see this ad.

    it all depends what your trying to do , if you want to pass a filename or command in a script and use " you would use


    Code:
     (write-line "(while (= 1 (logand (getvar \"cmdactive\") 1))(command \"Yes\"))" fp)
    but my workday is done so closing shop here... I leave you at the more than capable hands of RonjonP & rkmcswain

  2. #12
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 10
    Computer:
    HP Z240
    CPU:
    i7-7700k @ 4.20GHz
    RAM:
    64GB
    Graphics:
    Nvidia Quadro P1000
    Primary Storage:
    0.5TB SSD
    Secondary Storage:
    1TB SATA
    Monitor:
    Vizio 40"
    Discipline
    Civil
    Using
    Civil 3D 2019
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    4,595

    Default

    Quote Originally Posted by DGRL View Post
    Well i think i need some to use at my pc coz i am getting wicked results


    $ (strcat "sometext " (chr 34) "EXTRATEXT" (chr 34))
    "sometext \"EXTRATEXT\""


    What in the world is the \ doing up there?
    Yes, it will return that at the command prompt, but plug that code into something else.

    For example:

    Code:
    (alert (strcat "sometext " (chr 34)  "EXTRATEXT" (chr 34)))
    Returns this:

    R.K. McSwain
    CAD Panacea | twitter

  3. #13
    Senior Member
    Discipline
    Mechanical
    Using
    Plant 3D not applicable
    Join Date
    Feb 2018
    Posts
    123

    Default

    hmmmm


    Well how can i make an error when i am not using variables.


    DO NOT GIVE ME THEN ANSWER I WILL THINK IF THIS
    Bud you saw that i made an error so i will think of this for a few minutes to see if i can see what you already saw


    Thanks for the help so far

  4. #14
    Senior Member
    Discipline
    Mechanical
    Using
    Plant 3D not applicable
    Join Date
    Feb 2018
    Posts
    123

    Default

    @rkmcswain


    I am not using this in an alert but to set it as variable
    When using the alert in AutoCAD i get same result as you but when writing to an variable i get the extra / which messes up my code

  5. #15
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    895

    Default

    Quote Originally Posted by DGRL View Post
    hmmmm

    Well how can i make an error when i am not using variables.
    ....
    What editor are you using? It's easily identifiable in the Vlide that you ARE using a variable even if you don't mean to.
    Attached Images

  6. #16
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,474

    Default

    Start with the most simple explanations, to get the end conclusion:

    When you have a string variable, its content must be wrapped with double quotes: " <my string> "
    Example: "this is my string"
    The strcat function expects multiple string arguments, in order to merge them together:
    Code:
    (strcat
      "First string"
      "Second string"
      "Third string"
    )
    ; The above, condensed in one row it looks like this (which would help you to mess-up your double quotes understanding) :
    (strcat "First string" "Second string" "Third string")
    Now by knowing this, obviously if you try to add manually a ", the interpreter would expect you to put the closing " aswell, to finish the string wrapping, and by hitting enter you can see "_>
    Example:
    Code:
    _$ "my string is
    "_> finished now" ; the interpreter hints with "_> that it expects a closing "
    "my string is\nfinished now"
    Code:
    _$ (strcat "My string
    ("_> " ; the interpreter hints with "_> that it expects a closing " and a closing ')'
    (_> ", my next string" ; the interpreter hints with (_> a closing ')'
    (_> ); I'll close the ), for the (strcat) function
    "My string\n, my next string"
    Now by knowing all that stuff, about whats the logic - then how to include the actual " character in the string?
    Like Rlx told you, you have to use \" to get a "

    Code:
    (alert "Now I'll put this \"string\" in my double quotes")
    The string inside the code may confuse you, but interpreter checks the '\' infront the double quote ", and then knows that he has to pass it literally.

    Now the tricky part is when you use along it with the strcat function, you have to be careful how you put your " (double-quotes) :
    Code:
    _$ (setq MyVariable "DGRL")
    "DGRL"
    _$ (strcat "My nickname is " MyVariable " and I'm on cadtutor") ; notice the dobule-quote separators for (strcat)
    "My nickname is DGRL and I'm on cadtutor"
    _$ (strcat "My nickname is \"" MyVariable "\" and I'm on cadtutor") ; adding the literal quotes, notice that the dobule-quote separators for (strcat) remain the same
    "My nickname is \"DGRL\" and I'm on cadtutor" ; but it still looks confusing !
    _$ (alert "My nickname is \"DGRL\" and I'm on cadtutor") ; but the interpreter does his job, so when alerting it we'll be ok
    BTW did you notice the '\n' from the string "my string is\nfinished now" ? Whats that '\n' ? Its a newline character, I just pressed enter and the interpreter translated it like that so it knows:
    "Look theres \ infront of that n, which means this is a newline and not the 'n' letter".

  7. #17
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 10
    Computer:
    HP Z240
    CPU:
    i7-7700k @ 4.20GHz
    RAM:
    64GB
    Graphics:
    Nvidia Quadro P1000
    Primary Storage:
    0.5TB SSD
    Secondary Storage:
    1TB SATA
    Monitor:
    Vizio 40"
    Discipline
    Civil
    Using
    Civil 3D 2019
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    4,595

    AutoCAD

    Quote Originally Posted by DGRL View Post
    @rkmcswain


    I am not using this in an alert but to set it as variable
    When using the alert in AutoCAD i get same result as you but when writing to an variable i get the extra / which messes up my code
    Did you actually try it, or are you just reading the command line?
    Let's break it down

    Code:
    (setq var "SAMSUNG") ;<- a string
    (setq str (strcat 
        "My TV is a " ;<- a string
        (chr 34)      ;<- a string
         var          ;<- a string
        (chr 34)      ;<- a string
                   )
    )
    (progn (princ str)(princ)) ; returns 
    
    ;; My TV is a "SAMSUNG"
    No extra slashes or quote marks, etc.

    When you read the output at the command line, it will always show you the "\" marks. The symbol itself does not include them.
    R.K. McSwain
    CAD Panacea | twitter

  8. #18
    Super Member hanhphuc's Avatar
    Using
    AutoCAD 2007
    Join Date
    Apr 2013
    Location
    Happy Garden
    Posts
    749

    Default

    Simple test
    Code:
    (setq $ (getstring t "\nType your text here with quote mark : "))
    (print $)(princ)
    _$ ( apply 'equal "hp" "happy" "hạnh phúc" "ハッピー" "幸福" "행복" )
    ; error: too many arguments

  9. #19
    Senior Member
    Discipline
    Mechanical
    Using
    Plant 3D not applicable
    Join Date
    Feb 2018
    Posts
    123

    Default

    Guys


    This line needs to be STRCAT


    reg.exe add "HKEY_CURRENT_USER\Software\Autodesk\Autocad\R19.1 \ACAD-D001:409\Profiles\<<Unnamed Profile>>\Variables" /v "SECURELOAD" /t REG_SZ /d "1" /f


    Some have " and some not
    The one's the does not have the " are seen as variables (DUH) but I am struggling getting this in 1 line using strcat
    The line NEEDS to stay like this when putting it in an variable


    So what I want is


    (setq VAR (strcat reg.exe add "HKEY_CURRENT_USER\Software\Autodesk\Autocad\R19.1 \ACAD-D001:409\Profiles\<<Unnamed Profile>>\Variables" /v "SECURELOAD" /t REG_SZ /d "1" /f))


    When type VAR you will get --> reg.exe add "HKEY_CURRENT_USER\Software\Autodesk\Autocad\R19.1 \ACAD-D001:409\Profiles\<<Unnamed Profile>>\Variables" /v "SECURELOAD" /t REG_SZ /d "1" /f <--

  10. #20
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    1,064

    Default

    Registered forum members do not see this ad.

    this???
    Code:
    (setq VAR "reg.exe add \"HKEY_CURRENT_USER\\Software\\Autodesk\\Autocad\\R19.1 \\ACAD-D001:409\\Profiles\\<<Unnamed Profile>>\\Variables\" /v \"SECURELOAD\" /t REG_SZ /d \"1\" /f")
    Last edited by rlx; 17th Apr 2018 at 08:11 am.

Similar Threads

  1. HELP to include "AcDbAlignedDimension" code for a "Dimension deleting" LISP
    By vernonlee in forum AutoLISP, Visual LISP & DCL
    Replies: 14
    Last Post: 10th Apr 2015, 04:03 pm
  2. Replies: 0
    Last Post: 19th Nov 2013, 11:06 pm
  3. Replies: 7
    Last Post: 28th Sep 2010, 06:35 am
  4. (read (strcat "(" "1.5X250X600" ")"))
    By muthu123 in forum AutoLISP, Visual LISP & DCL
    Replies: 9
    Last Post: 10th Jul 2010, 01:05 pm
  5. (read (strcat "(" "TUBE150X150X4.5 20.2" ")"))
    By muthu123 in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 21st Jun 2010, 03:40 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts