Small Fish Posted July 8, 2009 Share Posted July 8, 2009 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 Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted July 8, 2009 Share Posted July 8, 2009 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 Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted July 8, 2009 Share Posted July 8, 2009 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. Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted July 8, 2009 Share Posted July 8, 2009 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. Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted July 8, 2009 Share Posted July 8, 2009 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 Quote Link to comment Share on other sites More sharing options...
Small Fish Posted July 9, 2009 Author Share Posted July 9, 2009 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 Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted July 9, 2009 Share Posted July 9, 2009 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. Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted July 9, 2009 Share Posted July 9, 2009 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; } } } Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted July 9, 2009 Share Posted July 9, 2009 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. Quote Link to comment Share on other sites More sharing options...
Small Fish Posted July 9, 2009 Author Share Posted July 9, 2009 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? Quote Link to comment Share on other sites More sharing options...
Patrick_35 Posted July 9, 2009 Share Posted July 9, 2009 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) @+ Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 9, 2009 Share Posted July 9, 2009 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: Quote Link to comment Share on other sites More sharing options...
Patrick_35 Posted July 9, 2009 Share Posted July 9, 2009 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. @+ Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 9, 2009 Share Posted July 9, 2009 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 Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted July 9, 2009 Share Posted July 9, 2009 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 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 9, 2009 Share Posted July 9, 2009 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. Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted July 9, 2009 Share Posted July 9, 2009 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! Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted July 9, 2009 Share Posted July 9, 2009 Just one more thing. Small Fish wanted the video to shut down automatically when done. Is this at all possible to do? Quote Link to comment Share on other sites More sharing options...
Patrick_35 Posted July 9, 2009 Share Posted July 9, 2009 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. (vlax-invoke mp 'close) don't work whell, I use a process's killer (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") @+ Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted July 9, 2009 Share Posted July 9, 2009 Thanks Patrick, But it seems to kill it too quickly. The player starts and shuts down before the video can play. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.