KenAB94662 Posted August 5, 2020 Share Posted August 5, 2020 I'm trying to insert or invoke sound when changing layer visibility in Vectorworks. The reason for this is that I'm displaying my screen in an online presentation using Vectorworks because no other software/ application/ platform has the necessary features to do it quickly. Ideally, I'm hoping for a user-selectable sound when manually turning on/off layer visibility in the Navigation palette. The Mac has built-in Sound Effects such as Basso, Boing, Blow, Bottle, Frog, Funk, Glass, Ping, Tink, etc. But calling a system sound is probably impossible. Or is it? Alternative approach I'm thinking is a script that calls up and plays an MP3 file. I would embed such a script in a Saved View to trigger various layer visiblities. But FindFile and GetFile scripts seem to explain that the files can only be VWX or text files, not any audio file such as MP3, WAV, or AIFF. Then I cannot find any script that plays such an audio file, even if it's as rudimentary as pausing everything else in Vectorworks to pop-up and play. Probably not possible — or is there an expert here? Of the above is not possible, what other ways are there to trigger a customized sound when navigating views in Vectorworks? Quote Link to comment
Pat Stanford Posted August 6, 2020 Share Posted August 6, 2020 The Vectorscript command SysBeep; plays the system default sound on Mac. If you add that one line to your Saved Views you should be able to get a single sound for all your view changes. If you need different sounds then you will need a different option. If you don't mind going slightly outside of VW there are a lot more options. The one I would suggest would be a set of Applescripts tied to keyboard shortcuts. Each AppleScript would execute one of your saved view and play the sound of your choice. Something like FastScripts from Red Sweater Software would make it realitivley easy to set up the keyboard shortcuts or even (I think) give you a menu of scripts to choose from. Let me know if you need more help. Quote Link to comment
KenAB94662 Posted August 6, 2020 Author Share Posted August 6, 2020 Thank you, Pat! The SysBeep; is quite the direct solution I was seeking. Now if only I can sneak under the hood and replace that little beep with another sound... probably not. I wouldn't mind temporarily changing my entire Mac beeping (or buzzing instead of beeping) if I can change it back after my presentation. I've now installed FastScripts. Applescripts are new territory for me. Not really sure where to start to tie it into a Vectorworks Saved View. Quote Link to comment
Pat Stanford Posted August 6, 2020 Share Posted August 6, 2020 Applescript is one way INTO VW. You can create an AppleScript and include Vectorscript (or I suppose Python) code that will be sent to VW and executed. I don't know of an (easy) way to get VW to execute an AppleScript. I take that back you could probably use the HTML Link object and use that to fire an AppleScript. I have used AppleScript a couple of times for batch conversion/export operations across multiple files. VW alone does not allow any cross file scripting. I used the AppleScript to open a VW file, Vectorscript the function(s) I needed, then had AppleScript close the file. Repeat that through a list of files. And you can certainly change your system sound before your presentation to what you need and then change it back when you are done. Quote Link to comment
KenAB94662 Posted August 6, 2020 Author Share Posted August 6, 2020 36 minutes ago, Pat Stanford said: And you can certainly change your system sound before your presentation to what you need and then change it back when you are done. Yes! I had to convert MP3 to raw but the single system alert sound is good enough. Changing it back in System Prefs is super simple too. Thanks again! Quote Link to comment
Vectorworks, Inc Employee klinzey Posted August 6, 2020 Vectorworks, Inc Employee Share Posted August 6, 2020 If you can I would recommend looking at Python Scripting rather than Vectorscript. With Vectorscript you are limited to what Vectorworks can do. With Python you have access to other Python libraries which allow you to do a lot more. A quick google search turned up several options for playing an audio file with Python. 1 Quote Link to comment
Pat Stanford Posted August 6, 2020 Share Posted August 6, 2020 I understand the Python is wider spread and more powerful, but it feels like I am going back to Fortran. Capitalization and white space delimited. Way to many chances to screw up on my bad eyes. ;-) I like begin/end and being able to indent as I see fit for clarity. Compile time error checking rather than run time is well worth the extra characters you have to type. IMNSHO. Quote Link to comment
Miguel Barrera Posted August 7, 2020 Share Posted August 7, 2020 But sometimes the result outweighs the pain of writing Python. Although I still prefer vectorscript because I am more familiar and it is easier to debug, python has access to most functions outside of VW and you could script almost anything. I have been able to directly import from and export to excel files which is not easy to do in vscript so learning and coding in python was well worth it 1 Quote Link to comment
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.