1. #31
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    And interestingly the direction of the slash makes no difference.

  2. #32
    Senior Member Follow User Gallery
    Join Date
    Jan 2003
    Location
    NYC
    Posts
    1,626

    Default

    Argh! UpperCase grem strikes again.

    Thanks TV, I guess that makes sense in a ZScript sort of way. I've long since stopped kicking myself over ZScript, though.

    [edit: ignore me for a while, I need a break!]

    Sven

  3. #33
    Senior Member Follow User Gallery
    Join Date
    Jan 2003
    Location
    NYC
    Posts
    1,626

    Red face OK, Break over.

    Here's another apparent gotcha that might be good to know.

    Using the previous code examples of Script A calling Script B... and Script B calling Script A, (with ZBRUSH_ appropriately capitalized of course... )

    Each time one script calls the other, there is a tiny bit of MEM creep - - when you run the two, toggling back and forth, you can watch the MEM numbers click up in the title bar. (ZSCRIPT:Record is turned off)

    However, if the code in each is changed so each calls the .zsc version of the other, the MEM creep stops. My guess is there's some slight, unrecoverable overhead when ZScript's interpreter converts .txt to .zsc to run it?

    Agreed this is a special case situation... I was having the scripts call each other in .txt form so edits during script development would be immediately effective. However the creeping choke-off was creating stability problems - at least that's what I'd like to think was causing it.

    Anyway, this is just another of those "BTW" observations. Any comments or feedback appreciated, especially if your milage varies.

    Thanks, Sven

  4. #34
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Sven,

    That's interesting. I recently suffered serious stability problems after repeatedly reloading a script I was testing. I thought I was going to have to reinstal ZB but then the problem went away by itself. I don't know why. With slight trepidation I'll test your scripts to see what happens...

    The defaultzscript is not rewritten as a zsc, is it? Although that doesn't mean it's not converted in memory.

  5. #35
    New Member Follow User Gallery
    Join Date
    Apr 2015
    Posts
    4

    Default

    Hi there,

    I recently started using Zscript and I followed this thread for a while now as I run into problems with Dialogues every now and then. I can't help with the problem at hand, but I have a question and feel that it is not to far off topic...

    I am working on a SaveDialogue for ztl.-Format with a custom File Path that I currently read out with FileNameGetLastUsed. The Path I read out is a subdirectory to the directory I want to save my Files to, so I have to return to the parent directory. On the first page of this thread TVeyes mentioned through the use of "..\" in StrMerge this can be done. My attempt looks like this:

    [StrMerge, [FileNameExtract, [FileNameGetLastUsed, ] , 1 ], "..\"]

    Instead of delivering the parent directory I end up with two additional points merged to the path. Did i get something wrong about this functionality? How do I cut the last part from my Path?

    Thanks for all the great answers to this topic so far, already helped me out a bunch!

  6. #36
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    That doesn't seem to work any longer... An alternative way would be to have a routine that searches for the second-to-last backslash and trims the path appropriately:

    [RoutineDef,GetParentFolder,
    [VarSet,pPath,[StrExtract,pPath,0,[StrLength,pPath]-2]]//trim off last backslash
    [VarSet,index,[StrLength,pPath]-2]
    [VarSet,lp,index]
    [Loop,lp,//loop checking for backslash while decrementing index
    [If,[StrFind,"\",pPath,index]>-1,
    [LoopExit]
    ]
    [VarDec,index]
    ]
    [VarSet,i,[StrFind,"\",pPath,[Val,index]]]
    [If,i > -1,
    [VarSet,pPath,[StrExtract,pPath,0,i]]
    ]
    ,pPath]


    [IButton,TestPath,,
    [VarSet,filePath,[FileNameExtract,[FileNameGetLastUsed],1]]
    [RoutineCall,GetParentFolder,filePath]
    [Note,filePath]
    ]



    **Note that the output using the example above won't show the backslashes as [Note] does not display them but the path will be correct. Also, if coding for MacOSX allowance would need to be made for MacOSX paths and forward slashes.

  7. #37
    New Member Follow User Gallery
    Join Date
    Apr 2015
    Posts
    4

    Default

    Thank you for your help! I still have to try it out, but I'll reply if I encounter a problem with it.

Page 3 of 3 FirstFirst 123

Posting Permissions

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