Script Files and Slide Shows Sacramento City College Engineering Design Technology Script Files and Slide Shows 1 Slides and Slide Shows Script Files and Slide Shows 2 Slides and Slide Shows A slide in AutoCAD Is similar to a slide in photography. Is a snapshot of graphics screen display. Cannot be edited or plotted. Can be viewed one at a time on the screen. A continuous slide show can be created. Script Files and Slide Shows 3 Slides and Slide Shows Slides are excellent for Demonstrations. Presentations. Displays. Script Files and Slide Shows 4 Slides and Slide Shows A slide show is a group of slides that are displayed at preset time intervals. The display of the slides is controlled by a script file. A script file is a logical sequence of valid AutoCAD commands stored in a .txt file. Script Files and Slide Shows 5 Slides and Slide Shows To make slides Display the drawing for which you need a slide. Select the MSLIDE command Pick the drive and folder in which the file is to be stored. Enter the file name in the File name: text box for the slide Pick the Save button. AutoCAD automatically attaches an .sld file extension. Script Files and Slide Shows 6 Slides and Slide Shows Choose stored. location where slides will be AutoCAD by default stores slides in the AutoCAD directory. This is not a good location for slides. Keep the AutoCAD directory free of drawing, slides, and AutoLISP files. Script Files and Slide Shows 7 Slides and Slide Shows Good locations for slides Local hard disk drive USB media Create a separate folder in the location where you choose to store slides. Script Files and Slide Shows 8 Script Files and Slide Shows 9 Naming Slides Script Files and Slide Shows 10 Slides and Slide Shows Slide names should follow a pattern. Name the slide to reflect the Client name or Project number Examples: weyersld01, weyersld02, etc. 4305sld01, 4305sld02, etc. Script Files and Slide Shows 11 Slides and Slide Shows To view a slide, type VSLIDE Command: VSLIDE The Select Slide File dialog box appears. Pick the slide you want to display Pick OK. The slide is displayed in the graphics window. Script Files and Slide Shows 12 Creating Script Files to Automate AutoCAD Script Files and Slide Shows 13 Slides and Slide Shows A Script File is a list of valid AutoCAD commands stored in a text file. Is created using a wordprocessor. Notepad MS Has DOS EDIT a .scr file extension Script Files and Slide Shows 14 Slides and Slide Shows Running the Script file When the script file is read by AutoCAD, the entire list of commands is performed without additional input from the user. Script Files and Slide Shows 15 Slides and Slide Shows A Script File contains valid AutoCAD commands in a specific sequence. VSLIDE (AutoCAD command - displays slide) DELAY (A slide display time) VSLIDE DELAY RSCRIPT (AutoCAD command to cause the show to repeat.) Three blank lines at the end of the file. Script Files and Slide Shows 16 Creating Script Files Scripts enable nonprogrammers to automate AutoCAD functions. Scripts can be used for specific functions, such as Plotting a drawing with the correct PLOT command values and settings Creating a slide show. Script Files and Slide Shows 17 Writing Script File - Basic Rules Script Files and Slide Shows 18 Creating Script Files When 1. writing a script file, Use one command or option per line. Makes the file easier to fix if the script does not work properly. 2. Press [Enter] after typing a command. 3. A blank line = [Enter] If the next option of a command is a default value to be accepted, press [Enter] again. This leaves a blank line in the script file, which represents pressing [Enter]. Script Files and Slide Shows 19 Creating Script Files When writing a script file, 4. A space = [Enter] 5. A blank line = [Enter] 5. Three blank lines are required at the end of the script file. Script Files and Slide Shows 20 Writing a Slide Show Script File Script Files and Slide Shows 21 Writing a Slide Show Script File A slide show script file Contains only three AutoCAD commands. VSLIDE. DELAY. VSLIDE. DELAY. VSLIDE. DELAY. RSCRIPT. Script Files and Slide Shows 22 Writing a Slide Show Script File A slide show script file Can be a single pass or continuous show. If RSCRIPT and three blank lines are included The If slide show will repeat not included The slide show will run one time only. Script Files and Slide Shows 23 Writing a Slide Show Script File VSLIDE The displays a slide. name of the slide follows the command. VSLIDE kenslide01 Script Files and Slide Shows 24 Writing a Slide Show Script File An asterisk (*), in front of the slide file name causes the next slide to be preloaded. VSLIDE kenslide01 VSLIDE *kenslide02 DELAY VSLIDE A VSLIDE command that is not followed by a slide name displays the pre-loaded slide. Script Files and Slide Shows 25 The DELAY Command DELAY Specifies the display time in milliseconds Maximum delay = 33 seconds (33,000) Examples: DELAY 33000 (33 second delay) DELAY 4000 (4 second delay) Script Files and Slide Shows 26 The RSCRIPT Command RSCRIPT is used at the end of a script file. RSCRIPT Exactly causes the script file to repeat. three blank lines MUST be entered at the end of the script file. The script will NOT run correctly without them. Script Files and Slide Shows 27 The RESUME Command RESUME Restarts the slide show where it left off (Sometimes) Does not always work correctly. Any script file can (theoretically) be interrupted and restarted using RESUME. Script Files and Slide Shows 28 Writing A Script File - Example Script Files and Slide Shows 29 Writing a Slide Show Script File The following script uses four slides. Each slide appears for three seconds. The script repeats. The next slide is preloaded while the previous one is viewed. Script Files and Slide Shows 30 Script Files and Slide Shows 31 Writing a Slide Show Script File When storing slide files, include in the script file, the disk drive letter and path in front of the file name. Example: Use F:cadlsld2 this method with each VSLIDE command. Script Files and Slide Shows 32 Viewing the Slide Show Script Files and Slide Shows 33 Viewing the Slide Show Start the slide show by Entering SCR or SCRIPT at the Command: prompt OR Picking Run Script... from the Tools pull-down menu. OR Select the script file name show.scr from the Select Script File dialog box. Script Files and Slide Shows 34 Script Files and Slide Shows 35 Script Files and Slide Shows 36 Viewing the Slide Show The commands in the script file are displayed at the Command: prompt window as the slides appear. To stop the show, Press the [Backspace] key or [ESC] key. Script Files and Slide Shows 37 Troubleshooting the Slide Show Script Files and Slide Shows 38 Troubleshooting the Slide Show To correct, problems in your script file. 1. Run the script to see where it crashes (quits working). 2. Check the command line for the last command that was executed. Script Files and Slide Shows 39 Troubleshooting the Slide Show 3. Look for error messages, such as: Can't open slide file xxxxx (Incorrect slide file name). xxxxx Unknown command (Command spelled incorrectly or a space left at the end of the line). Requires an integer value (Delay value not all numerical characters. Possibly a space at the end of the line). Script Files and Slide Shows 40 Troubleshooting the Slide Show 4. Correct the problem in the script file and save the file. 5. Test the script. The most common errors are Misspelled commands. Spaces at the end of lines. Script Files and Slide Shows 41 Troubleshooting the Slide Show The process of “debugging” the script file is performed by AutoCAD open in one window Script file open in a NOTEPAD window. Script Files and Slide Shows 42 Troubleshooting the Slide Show Alt-TAB between the windows Run Script file Find location where it stops Switch to NOTEPAD window with Alt-TAB Correct mistake SAVE the script file! Go back to AutoCAD using Alt-TAB Run script file again. Repeat steps over and over until script works. Script Files and Slide Shows 43 Troubleshooting the Slide Show Watch for extra spaces! If you suspect there is a space at the end of a line, it is best to delete the line and retype it. If you use Notepad or EDIT, It is easy to see if a space exists. The flashing cursor, when placed at the end of a line, does not rest on the last character. Script Files and Slide Shows 44 Using Text Editors Script Files and Slide Shows 45 Using Text Editors Word processing or text editor programs can be used to write scripts. The program must be capable of saving the file in “ASCII” format. Script Files and Slide Shows 46 Using Text Editors ASCII is an acronym for American Standard Code for Information Interchange. Computer with: ASCII text files can be created The MS-DOS EDIT text editor Windows Notepad Windows WordPad. Script Files and Slide Shows 47 Using Text Editors Word processing files must be saved in ASCII format to be readable by AutoCAD. Script Files and Slide Shows 48 Using Text Editors Typical commercial wordprocessing programs: Windows WordPad. Microsoft Word. Corel WordPerfect. Ami Pro. Do NOT save in ASCII format by default! You must choose option to save as .txt file Script Files and Slide Shows 49 Using Wordprocessors If you choose to use a word processor, save the document as a text file. This prevents the inclusion of special formatting codes. Script Files and Slide Shows 50 Script Files and Slide Shows 51 ASCII ASCII was established in 1950’s Many computer manufacturers were designing computers. No standard representation existed of Alphabet (A-Z) Numbers (0-9) Special characters (<>, . [ ] { } ( ) +, - =) etc. Script Files and Slide Shows 52 ASCII Character Set Script Files and Slide Shows 53 ASCII ASCII Work on ASCII formally began October 6, 1960. The first edition of the standard was published during 1963, A major revision during 1967. The most recent update during 1986 Script Files and Slide Shows 54 ASCII Established a standard set of characters that was recognized by ALL computer manufacturers and the US government. Allowed interchange of information much more readily. Script Files and Slide Shows 55 ASCII On March 11, 1968, U.S. President Lyndon B. Johnson mandated that all computers purchased by the United States federal government support ASCII, stating: I have also approved recommendations of the Secretary of Commerce regarding standards for recording the Standard Code for Information Interchange on magnetic tapes and paper tapes when they are used in computer operations. All computers and related equipment configurations brought into the Federal Government inventory on and after July 1, 1969, must have the capability to use the Standard Code for Information Interchange and the formats prescribed by the magnetic tape and paper tape standards when these media are used. Script Files and Slide Shows 56 ASCII Other international standards bodies have ratified character encodings such as ISO/IEC 646 that are identical or nearly identical to ASCII, with extensions for characters outside the English alphabet and symbols used outside the United States, such as the symbol for the United Kingdom's pound sterling (£). Script Files and Slide Shows 57 ASCII Almost every country needed an adapted version of ASCII since ASCII only suited the needs of the USA and a few other countries. Canada had its own version that supported French characters. ISCII (India), VISCII (Vietnam), YUSCII (Yugoslavia). Although these encodings are sometimes referred to as ASCII, true ASCII is defined strictly only by ANSI standard. Script Files and Slide Shows 58 Command Aliases The ACAD.PGP File Script Files and Slide Shows 59 Command Aliases AutoCAD allows you to abbreviate commands. Feature introduced with AutoCAD 11. Abbreviating commands is called Command Aliasing. Script Files and Slide Shows 60 Command Aliases AutoCAD comes with predefined aliases. Aliases are listed in the acad.pgp file. Over 160 commands are aliased. Appendix F in the text gives a complete list. Script Files and Slide Shows 61 Command Aliases You can easily create your own aliases by editing the acad.pgp file. To enter an alias PP for PLOT, add the following line to the acad.pgp file. PP *PLOT The * means that this is an alias. Save the acad.pgp file. Script Files and Slide Shows 62 Command Aliases To cause the alias to be in effect: Restart AutoCAD OR Type REINIT and select the PGP file check box. Script Files and Slide Shows 63 Editing the ACAD.PGP File To edit the ACAD.PGP file Use a text editor: DOS EDIT Windows NOTEPAD Any other text editor The ACAD.PGP file is stored in \AUTOCAD\SUPPORT\ACAD.PGP Script Files and Slide Shows 64 The ACAD.PGP File Windows Notepad can be initiated directly from AutoCAD. Enter the following to open acad.pgp in Notepad: Command: File NOTEPAD to edit: Script Files and Slide Shows 65 Assignments Script Files and Slide Shows 66 Command Aliases Assignment Create 5 command aliases Modify ACAD.PGP file. Demonstrate to instructor that command aliases work. Each command alias MUST work correctly on the FIRST ATTEMPT to receive full credit ! Script Files and Slide Shows 67 Slide Show Assignment Create a 12 slide, repeating slide show. Use any of your drawings for the slides. Save all slides on USB Media ; local hard disk drive Save .scr file on USB media; local hard disk drive Demonstrate to instructor that slide show works correctly AND repeats! Slide show MUST run correctly on the FIRST ATTEMPT to receive full credit ! Script Files and Slide Shows 68