Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    Indianapolis
    Posts
    7

    Default New to scripting - need a simple script

    Hello,

    Sorry if this is a really basic question but I can't quite wrap my head around "filter" and "select."

    What I want to do is load a saved session, move ZIP files from left to right, then sync all other files from left to right.

    I can do this by running 2 separate scripts, but I can't quite figure out how to do it in one script (i.e., I either end up moving everything or syncing everything...).

    I'm sure I'm missing something simple or doing something stupid - but I can't figure it out and thought this would be the quickest way... (I went looking for some sample scripts but none of them quite do what I need. Is there a library of samples somewhere online other than what is in the help files?)

    Thanks for any help!

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    Hello,

    Script commands execute sequentially, so you can:
    load folders
    set a filter for zip
    move them
    set the filter for "not zips"
    perform a sync

    Would this be the logic you are looking for? Scripting Reference is found in the Help file -> Using Beyond Compare chapter -> Scripting section. The syntax would be something similar to:
    load "session name"
    filter "*.zip"
    expand all
    select left.files
    move left->right
    filter "-*.zip"
    sync update:left->right
    Aaron P Scooter Software

  3. #3
    Join Date
    Feb 2004
    Location
    Indianapolis
    Posts
    7

    Default

    Yes - thank you - I have looked at the scripting help, but I am mostly just confused with "filter" and "select" -- i.e., does "filter" filter OUT files or does it "select" the things that match the filter? And then what does "select" do? Does it pick the things that were "filtered in" to operate on or does it pick the things that were "filtered out"?

    Just inexperience / foggy memory for me... I actually used to do a little database/SQL programming back in the days of FoxPro (for DOS!). I was just a hack though -- I could get eventually get it to do what I wanted to do, but I was not formally trained/educated and was certainly not fluent... same with scripting - I can usually figure it out, but I just haven't had the time to sit and tinker.

    Thanks again!

    Quote Originally Posted by Aaron View Post
    Hello,

    [snip]

    load "session name"
    filter "*.zip"
    expand all
    select left.files
    move left->right
    filter "-*.zip"
    sync update:left->right

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    Hello,

    Filter changes what can be in view (include or exclude, depending on the syntax used).
    The select command can then select files that exist in view.

    This mirrors actions you can take in the main interface. To preview, load the graphical interface, load a new Folder Compare, load your session, and copy/paste the filter string (without quotes) into the Filters toolbar box. This lets you preview which items remain visible.

    Selecting is then done with a combination of Display Filters and the mouse or the Edit menu -> Select commands. You can then alter the filter, and use the Sync command under the Actions menu -> Synchronize. If you are foggy about the steps, I would recommend stepping through each step in the graphical interface first (each script line roughly corresponds to an action in the interface), so you can see how each works with a graphical preview. The script will then be easier to work with, similarly stepping through (but not previewing) each action.
    Aaron P Scooter Software

  5. #5
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    I should add that Script actions and interface actions do not support Undo. So please test with test data/folders first while learning how to perform these actions or use the script. Script itself offers no preview or ability to undo after it is executed.
    Aaron P Scooter Software

Posting Permissions

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