Macro Language Reference > Macros > Application > edit
  
edit
Description
Opens a document for editing. Files can also be opened when you start PTC ALD, by including their name after typing in PTC ALD to start the program from a command line.
 
This macro is an alias of the ted and open macros.
 
Example 4. Open .3d files for edit
The macro shown below lists any files with the extension .3d in the current directory, showing their names, file sizes, and the number of pages they contain.
ted "* * * *
 
Note that a file extension is not necessary - ted defaults to looking for files with the extension .3d.
Syntax
edit start page:n? file:s? ( bookmark:t? run autoexec:n? ( load pfi:n ) )
edit
[no parameter]
Invoke the Open Document(s) dialog box.
start page
Ø|0
The document will be opened either at page 1 or, if its page position has been saved using the tdspref macro, at the page it was at when last saved.
n
The page of the document to display when the document is opened. If you are using the first form of this macro and do not specify a file to edit, the edit document dialog box will be invoked with the page number entry box filled in with this start page.
file
The name of the file you want to open for editing. If the file parameter contains wildcard characters the edit document dialog box will be invoked containing a list of matching files from which you can make a multiple selection. The wildcard can take one of three forms, i.e.
*.3d
File names only
**.3d
File names + file size
***.3d
File names + number of pages
****.3d
File names + file size + number of pages
bookmark
Optional - specifies a bookmark at which to open the document. No warning is given if the bookmark does not exist in the opened document.
run autoexec
0
Ignore any autoexec script when the document is opened
Ø or 1
If the document contains an autoexec script, it will be started after the document is fully loaded
load pfi
PTC ALD stores page formatting information (pfi) relating to the beginning of each page if the Save page formatting information check box is enabled in the Preferences for Saving Documents dialog box (see tdspref). This assists faster navigation of documents, especially after they are first opened. Some versions of PTC ALD have (unintentionally) saved pfi which is incompatible with other versions, rendering the document un-openable. This setting can be used to overcome this problem:
0
Any pfi in the file is ignored
Ø or 1
Any pfi in the file is loaded and used to speed navigation of the document
Additional Information
 
The function for retrieving file size and page numbers within the Open Document(s) dialog box is only available from this dialog and not from any other means in a standard PTC ALD function. Retrieving this information is, however, possible by interrogating the 3D file itself using a Perl script. The relevant parts are the number of fdd sections (one per page in the document, except in looseleaf/frozen page work) and the value of the numbers keyword in the fdpref section, this being the start page number.
Running files instead of opening
You can also 'run' given filenames instead of 'editing' them using the command line -r.
A possible requirement is the ability to start PTC ALD with a list of macros to be performed on a one-off basis. One method is to add the macros to startupw.3ad before starting PTC ALD but restoring the original content after PTC ALD closes can be cumbersome. Another method is to simply put the filename containing macros on the command line. PTC ALD automatically starts any filenames on the command line with the edit macro. This processes the macros nicely but always opens a blank document as a side-effect of edit.
The solution is very simple: the new -r command-line option specifies that PTC ALD starts all filenames with "run" instead of edit. for example:
3b2win -r my_macros1.3m my_macros2.3m.
Related Links