Speed of how the Macro plays back

Discussion in 'SolidWorks' started by Arthur Y-S, Aug 11, 2003.

  1. Arthur Y-S

    Arthur Y-S Guest

    can you control the seepd of the play back that you make with a macro?
     
    Arthur Y-S, Aug 11, 2003
    #1
  2. maybe you want it to run faster ;-)
    there are ways, especially when sketching (see ModelDoc2::SetAddToDB)
    why would you want it to run slower ? If you feel that something goes wrong
    because it runs too fast, you're certainly wrong. The fact that the display
    is regenerated asynchroneously with the API calls is sometimes misleading.
    anyway, use the debug buttons for debugging and Timers at run-time.
     
    Philippe Guglielmetti, Aug 11, 2003
    #2
  3. Arthur Y-S

    Arthur Y-S Guest

    I am asking for it to run slower because I would like to show an
    example of how to create something in the program. This is being shown
    to ppl that have not seen the program before, so if the speed is too
    fast they will miss out on some of the key points.
     
    Arthur Y-S, Aug 11, 2003
    #3
  4. What about having it step through on a keypress? That way they or you could
    proceed at the desired pace.

    WT
     
    Wayne Tiffany, Aug 11, 2003
    #4
  5. This can be done by adding Excel to your References.
    Then add this line with whatever value you want for the time.

    Excel.Application.Wait (Now + TimeValue("0:00:01"))

    this will pause for One second. I Know it will make atleast Excel
    inacessable, I also have noticed it takes up some of your resourses while it
    is paused somewhere between 10 and 50 percent. I have used this for a
    makeshift Notification watch because the application i was waiting for has
    no VBA accessible calls.

    "FOR I BELIEVE THAT ANY CALL NOMATER HOW SILLY IT SOUNDS HAS A USE TO
    SOMEONE, EVEN IF YOU CAN'T THINK OF ANY INSTANCE YOURSELF." - Corey Scheich
    LOL I laugh at my self, how lonely does that sound.
     
    Corey Scheich, Aug 11, 2003
    #5
  6. Arthur Y-S

    Arlin Guest

    You could also just throw in a large for:next loop where you want to
    pause. Like:

    for t = 1 to 100000
    next t
     
    Arlin, Aug 11, 2003
    #6
  7. Arthur Y-S

    Heikki Leivo Guest

    The following example shows a simple sub for waiting a specific time... Just
    call the sub and guess a proper value for the parameter. This is a better
    way than using a for loop, since you can use a specific value to determine
    the delay.

    Sub Pause(lngTime as Long)
    Dim lngStart As Long
    lngStart = Now() 'Store current time
    While (Now() - lngStart) < lngTime 'Keep on comparing until time has
    elapsed
    Wend
    End Sub


    -h-
     
    Heikki Leivo, Aug 11, 2003
    #7
  8. Arthur Y-S

    Arthur Y-S Guest

    I can assign each macro to a different key? or am I playing one Macro
    after the other?
     
    Arthur Y-S, Aug 11, 2003
    #8
  9. Arthur Y-S

    Joel Moore Guest

    Kinda bulky adding a reference to Excel just for its Wait function.

    Add this to the macro:

    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


    Wherever you want to pause:

    Sleep(1000) ' Sleep for 1 second
     
    Joel Moore, Aug 11, 2003
    #9
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.