API, skip temp files

Discussion in 'SolidWorks' started by Sam, Sep 14, 2006.

  1. Sam

    Sam Guest

    I have a macro that will perform several operations on all the
    documents in a selected folder but it also selects all the temp files
    that are left over after a crash so I am trying to find a way to have
    the temp files skipped. I would like to use some code that will skip
    the file if the file name includes any special characters (for example
    ~ and $). Can anyone explain how to do this? Or is there a better way
    to handle this? Of course I could always just delete all the temp files
    prior to running the program but I would like for the user to not have
    to worry about doing that.

    Thanks

    Sam
     
    Sam, Sep 14, 2006
    #1
  2. My first thought is that as you get to each file, check for the presence of
    those characters (instring function?) and then skip to the next one in the
    list if you do find them.

    WT
     
    Wayne Tiffany, Sep 14, 2006
    #2
  3. Sam

    CS Guest

    What are you using to search the file system?
     
    CS, Sep 14, 2006
    #3
  4. Sam

    Sam Guest

    Thanks Wayne, that worked. I am not an educated programmer and was
    not aware of the instr function. I set it up so that if instr returns
    zero (character not found) the file is processed otherwise the file is
    skipped.


    Thanks again
     
    Sam, Sep 14, 2006
    #4
  5. Sam

    fcsuper Guest

    Sam,

    You would also write an old school bat routine that will automatically
    delete those files. Ok, actually, you could do it in S/W Api too, but
    will be a bit more involved. Can macros call *.bat files?

    Matt
     
    fcsuper, Sep 14, 2006
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.