Jump to content

avi from dcl function?


Small Fish

Recommended Posts

Has anyone activated a avi demo from a dialog button?

I want to add a demo avi onto my help file. I know that it can be done with slides. But can a avi file be activated from dcl?

thanks

Link to comment
Share on other sites

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

  • Patrick_35

    12

  • Lee Mac

    11

  • The Buzzard

    11

  • Small Fish

    7

Has anyone activated a avi demo from a dialog button?

I want to add a demo avi onto my help file. I know that it can be done with slides. But can a avi file be activated from dcl?

thanks

 

 

Small Fish,

 

This is just a simple dcl and lisp to start realplayer and run a file called CLOCK.avi.

You need to make sure realplayer is in the ACAD Search Support Path as well as the 3 files in the zip folder.

 

I just tested it and it works. If you want to make this more fancier you could add a popup list with AVI files to run, This will require some conditionals added to the code.

 

Try it out.

The Buzzard

clock.zip

Link to comment
Share on other sites

I also would like to point out, If you are going to use this program for one file than you really do not need the dcl. If you are planning for a selection of files to run than the dcl is the way to go.

Link to comment
Share on other sites

The startapp function can run any exe file outside of ACAD. I use it to start adobe for PDF help files that I create for some of my programs. You can use this with many other applications. You just need to make sure you application exe file is in ACAD's search support path. This is very important.

Link to comment
Share on other sites

The attached zip file has a popup list on the DCL with two AVI files to be selected of your choice.

 

Just wanted to make the DCL file seem more useful in this case.

 

Give it a shot.

The Buzzard

AVI.zip

Link to comment
Share on other sites

Hey thanks Buzzard that was a great help. I now have it working well :-)

Just an few other questions although its probably not for this forum.

We use 'windows media player' rather than 'real player' so have adjusted the code to suit. However what happens is 'windows media player' opens up but the 'PLAY' button needs to be pressed, then the user needs to close it down. I was wondering if this could be automated?

Programatically closing down windows media player, I guess is the opposite of 'startapp'. Is there a way of doing this?

 

thanks for a reply

Link to comment
Share on other sites

Hey thanks Buzzard that was a great help. I now have it working well :-)

Just an few other questions although its probably not for this forum.

We use 'windows media player' rather than 'real player' so have adjusted the code to suit. However what happens is 'windows media player' opens up but the 'PLAY' button needs to be pressed, then the user needs to close it down. I was wondering if this could be automated?

Programatically closing down windows media player, I guess is the opposite of 'startapp'. Is there a way of doing this?

 

thanks for a reply

 

I just tried wmplayer.exe and got a message the media could not be found.

 

In place of wmplayer.exe try mplayer2.exe instead.

 

This will open Windows Media Player in a reduced mode. It seems to work without a hitch. It starts the file without a problem.

 

As far as automatically shutting the player off I would think that would be set in the player itself. You only have so much control over it.

 

Thats about the best I can do for you at this point.

Link to comment
Share on other sites

Oh by the way. The version of Windows Media Player I am using is Version 11.

 

Did you also download the lisp that uses the list? Its the second file I posted.

 

Program

(defun C:AVI ()
 (setq MEDIA "CLOCK.AVI")
 (setq AVI_LST (list "CLOCK.AVI" "WAITING.AVI"))
 (setq dcl_id (load_dialog "AVI.dcl"))
 (if
   (not
     (new_dialog "AVI" dcl_id)
   )
   (exit)
 )
 (start_list "SEL")
 (mapcar 'add_list AVI_LST)
 (end_list)
 (action_tile "cancel"
"(done_dialog)(setq button nil)")
 (action_tile "accept"
   (strcat
    "(progn
       (setq MEDIA (atoi (get_tile \"SEL\")))"
      "(done_dialog)(setq button T))"))
 (start_dialog)
 (unload_dialog dcl_id)
 (if button
   (progn
     (setq MEDIA (fix MEDIA))
     (setq MEDIA (nth MEDIA AVI_LST))
     (cond
       ((= MEDIA "CLOCK.AVI"))
       ((= MEDIA "WAITING.AVI"))
     )
     (AVI_SAVI)
   )
 )
 (princ)
)
;;;/////////////////////////////////////////////////////////////////
(defun AVI_SAVI (/ MED)
 (if
   (not
     (setq MED (findfile MEDIA))
   )
   (alert (strcat "\nSorry - "MEDIA" Missing"))
   (startapp "mplayer2.exe" MED)
 )
 (princ)
)
;;;/////////////////////////////////////////////////////////////////

 

DCL

AVI : dialog {
     label = "AVI Lisp, AVI.lsp";
     : column {
       : popup_list {
         key = "SEL";
       }
       : button {
         label = "OK";
         key = "accept";
         mnemonic = "O";
         width = 25;
         fixed_width = true;
         alignment = centered;
         is_default = true;
       }
       : button {
         label = "Cancel";
         key = "cancel";
         mnemonic = "C";
         width = 25;
         fixed_width = true;
         alignment = centered;
         is_cancel = true;
       }
     }
   }

Link to comment
Share on other sites

On second thought scratch the mplayer2.exe. I have K-LITE Codec Pack Media Player Classic installed on my system. This allows Windows Media Player to run files of other types not supported.

Link to comment
Share on other sites

yes thanks for the code - I don't have any problems with it. The problem is, as you say controlling the avi. Perhaps I should make a gif file instead, it may be easier to control?

Has any had any experience of using a gif rather than a avi file for the purpose I want to use it?

Link to comment
Share on other sites

Hi

 

An example

 

(setq video "Une_video.avi")
(setq mp (vlax-create-object "WMPlayer.OCX"))
(vlax-invoke mp 'openPlayer (findfile video))
(vlax-dump-object mp T) ; to look full functions
(vlax-release-object mp)

@+

Link to comment
Share on other sites

Wouldn't this be better Patrick?

 

(setq video "Une_video.avi")
(setq mp ([color=Red]vlax-get-or-create-object[/color] "WMPlayer.OCX"))
(vlax-invoke mp 'openPlayer (findfile video))
(vlax-dump-object mp T) ; to look full functions
(vlax-release-object mp)

 

Sorry if I'm being petty :wink:

Link to comment
Share on other sites

No, because with Vlax-create-object, you use the activex only to your file without you worry if there is one already open.

But an vlax-get-or-create-object is useful for example with excel.

 

Sorry if I'm being petty :wink:

No, when I see what you do, you become a king of lisp.

 

@+

Link to comment
Share on other sites

No, because with Vlax-create-object, you use the activex only to your file without you worry if there is one already open.

But an vlax-get-or-create-object is useful for example with excel.

 

Ahh, I see. Thanks :)

 

No, when I see what you do, you become a king of lisp.

 

Thanks Patrick :)

Link to comment
Share on other sites

Hi

 

An example

 

(setq video "Une_video.avi")
(setq mp (vlax-create-object "WMPlayer.OCX"))
(vlax-invoke mp 'openPlayer (findfile video))
(vlax-dump-object mp T) ; to look full functions
(vlax-release-object mp)

@+

 

 

Patrick,

 

I placed your code in place of my function and got this:

 

; error: Parameter not optional

Link to comment
Share on other sites

Patrick,

 

I placed your code in place of my function and got this:

 

; error: Parameter not optional

 

Patrick has only posted it as an example - so it has no error trapping, the error occurs when the file is not found. :)

Link to comment
Share on other sites

Patrick has only posted it as an example - so it has no error trapping, the error occurs when the file is not found. :)

 

 

Sorry Patrick

 

My mistake, it works great!

Link to comment
Share on other sites

Just one more thing. Small Fish wanted the video to shut down automatically when done. Is this at all possible to do?

Link to comment
Share on other sites

Just one more thing. Small Fish wanted the video to shut down automatically when done. Is this at all possible to do?

 

grrrr... I don't find. :x

(vlax-invoke mp 'close) don't work

 

whell, I use a process's killer :roll:

 

(defun kill(qui / item meth1 meth2 obj WMI)
 (setq WMI (vlax-create-object "WbemScripting.SWbemLocator")
       meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil)
       meth2 (vlax-invoke meth1 'ExecQuery "Select * from Win32_Process")
 )
 (vlax-for item meth2
   (and (setq obj (vlax-get item 'CommandLine)) (vl-string-search (strcase qui) (strcase obj))
     (vlax-invoke item 'Terminate)
   )
 )
 (foreach item (list WMI meth1 meth2)
   (vlax-release-object item)
 )
)

(kill "wmplayer.exe")

@+

Link to comment
Share on other sites

Thanks Patrick,

 

But it seems to kill it too quickly.

The player starts and shuts down before the video can play.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...