{"id":1740,"date":"2010-11-28T15:26:11","date_gmt":"2010-11-28T18:26:11","guid":{"rendered":"http:\/\/meiradarocha.jor.br\/news\/?p=1740"},"modified":"2019-02-13T09:38:27","modified_gmt":"2019-02-13T12:38:27","slug":"pagemaker-scripting-language-programming-statements","status":"publish","type":"post","link":"https:\/\/meiradarocha.jor.br\/news\/2010\/11\/28\/pagemaker-scripting-language-programming-statements\/","title":{"rendered":"PageMaker Scripting Language: programming statements"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"alignright\"><a href=\"http:\/\/meiradarocha.jor.br\/news\/wp-content\/uploads\/2010\/11\/pagemaker-splash1.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"212\" src=\"http:\/\/meiradarocha.jor.br\/news\/wp-content\/uploads\/2010\/11\/pagemaker-splash1-300x212.jpg\" alt=\"\" class=\"wp-image-1785\" srcset=\"https:\/\/meiradarocha.jor.br\/news\/wp-content\/uploads\/2010\/11\/pagemaker-splash1-300x212.jpg 300w, https:\/\/meiradarocha.jor.br\/news\/wp-content\/uploads\/2010\/11\/pagemaker-splash1-150x106.jpg 150w, https:\/\/meiradarocha.jor.br\/news\/wp-content\/uploads\/2010\/11\/pagemaker-splash1.jpg 493w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/figure><\/div>\n\n\n\n<address><strong>Dr. Vladimir Samarskiy<\/strong><br \/><small>Adobe System Corporation<\/small><\/address>\n\n\n\n<p style=\"font-size:-1px\"><a href=\"http:\/\/www.oz.net\/~vsamarsk\/KeyWords.html\">Page updated 1\/10\/98.<\/a> [Site no more available].<\/p>\n\n\n\n<p><a name=\"anchor1791065\"><\/a>Besides the standard API commands and queries, PM Scripting Language (PMSL) defines a number of programming statements (refered to as operators in this document or as controls in <a href=\"http:\/\/www.hhansen.com\/pmscripting.html\">Hans&#8217;s book<\/a>). Operators change the order of the execution of a script or the way variables are computed. Each PMSL operator begins (ignoring leading spaces and tabs) a separate line of the script. If PMSL recognizes an operator it processes the script line internally and then goes on to the next line of the script. Otherwise PMSL regards each line as a query (if first 3 chars are &#8216;get&#8217;) or as a command. All commands and queries are passed to PageMaker. In case of a query, PageMaker&#8217;s reply is retrieved.<\/p>\n\n\n\n<p>Warning: Scripting Language sends all non-operator commands to the PageMaker. Therefore any illegal or garbage string which may occur in the script will be passed to PageMaker as a script command which usually stops the script execution.<br \/>This is the list PMSL operators:<\/p>\n\n\n\n<ul class=\"wp-block-advgb-summary advgb-toc alignnone\"><li class=\"toc-level-4\" style=\"margin-left:80px\"><a href=\"#advgb-toc-2e380339-b6c2-4b2b-bb31-91c2ccdc5537\">Page updated 1\/10\/98.<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-9f49da79-f42a-4282-a04b-d8d5ab8f53ab\">New operators implemented in Script Engine v 3.5<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-4da794be-129f-4aa4-a653-bfa0f75693af\">Operator: @<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-016920da-6efd-438c-910e-74fa253bd4fb\">Operator: set<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-7d58d5d0-257c-43f5-993d-e4834d718924\">Operator: message<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-84d37a7a-6761-4dd1-8cdd-ce417b2a9670\">Operator: getyesno<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-d12659b8-e5f4-4716-8f49-de467cb3eba9\">Operators: readbegin, readend<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-f3f83bd7-d6ed-490b-b2e8-45bd3b1103c3\">Operator: read<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-b94b72ff-d787-4d2e-977e-d45ee8ac392a\">Operator:&nbsp; readadvance.<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-3ca77c7b-b164-4419-899f-ae2ad34b3f79\">Operators: logbegin , logend , logappend<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-3134defa-f5cb-49a1-8ad9-fcb9960c39aa\">Operator: log<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-baeceba0-0667-45b7-80f7-d6766d899ccb\">Operator: logremove<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-e3b6ba3c-ae4c-4d02-8376-d1508ce094f0\">Operators: if , endif<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-0f84d6c0-c280-4113-8881-df0662a4d3a5\">Operators: elseif , else<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-31b80b67-309c-4821-98e0-1134f08ecdaa\">Operators: goto , label<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-b404f3b4-c215-4b03-8f73-dee7fa34adb8\">Operators: repeat , until<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-33807f6f-9d02-407e-b13a-3ceecfb69bf1\">Operators: while , endwhile<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-53167632-5e91-44c1-9a93-14b3e4312a2b\">Operators: loop , endloop<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-4f2c245f-a6c6-4a38-ad28-c27967cedd3f\">Operators: switch , caseof , endswitch , default<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-00b02b99-d0d2-4089-91c5-29b97c18c2c1\">Operator: break<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-7adf6d4b-6393-4677-9625-5789cd873f94\">Operators: call ( or gosubfile) , return<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-a161fc98-8832-4c86-bf09-3adb59184ae3\">Operator: include<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-daf41b57-b600-4f7b-8038-557f51b1d343\">Operators : gosub , sub , endsub<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-555e4a5f-a018-4ec4-8539-a1ee91d016af\">Operator: getprocparam, getargs<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-aac85bdb-665f-453d-bfd0-7c79527128c2\">Operator: var<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-45dcfaa8-b69c-4097-bf40-f9ff70de1e2d\">Operator: kill<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-3009ed06-1570-40fc-b840-a6ffb1e2165f\">Operator: errorchecking<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-f6fa9649-17df-40fa-aa13-67365332d737\">Operator: try<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-3c591343-e742-444d-984f-08caa42c08dc\">Operator: breakpoint<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-d2adb8d4-6f6d-440f-af7f-6ba4d7fcffdb\">Operator: gettime<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-958ecf60-1ae0-43c1-8a6a-93d6e07f6103\">Operator: getplatform<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-4c0394f6-cbd9-47ce-8ccb-9837a80d6568\">Operator: rem<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-0f7848a0-d2fa-47b5-a19b-c98181ccd82e\">Operator: abort<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-f600b217-b861-4388-8c50-72ae50883911\">Operator: continue<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-8423683c-3ccf-4565-a680-b1ac331da545\">Operator: dir<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-17fb2a67-c3eb-4903-bd49-bcdefd3e13c0\">Operator: execute<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-61725cca-cd90-4ea8-a50b-e889e3fb85d3\">Operator: getnameof<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-1107168e-f534-421e-8b02-2fa99f3804e4\">Operators: getyesnocancel, getokcancel<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-b212bd3a-4843-4dc8-a83b-8763ba64f4c7\">Operator: getscriptver<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-802d83f1-1d7d-47a2-af43-9b15261b111f\">Operator: readline<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-538a8031-9083-4e41-95c6-518d499dfdfc\">Operator: system<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-8747be18-fbc7-4f7f-a90c-ec91f2936fb0\">Operator: callback<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-0676b72f-eea0-4292-b8d7-e76cc60ddba6\">Operator: getpanestate<\/a><\/li><li class=\"toc-level-3\" style=\"margin-left:60px\"><a href=\"#advgb-toc-a25addad-42dd-4a11-9e8a-c2542cfb6cdc\">Operator: setpanestate<\/a><\/li><\/ul>\n\n\n\n<ol class=\"wp-block-list\"><li><a href=\"#anchor434451\">@<\/a><\/li><li><a href=\"#anchor701198\">break<\/a><\/li><li><a href=\"#anchor583419\">breakpoint<\/a><\/li><li><a href=\"#anchor525668\">call<\/a><\/li><li><a href=\"#anchor513444\">caseof<\/a><\/li><li><a href=\"#anchor513444\">default<\/a><\/li><li><a href=\"#anchor471767\">else<\/a><\/li><li><a href=\"#anchor471767\">elseif<\/a><\/li><li><a href=\"#anchor463190\">endif<\/a><\/li><li><a href=\"#anchor703314\">endloop<\/a><\/li><li><a href=\"#anchor540376\">endsub<\/a><\/li><li><a href=\"#anchor513444\">endswitch<\/a><\/li><li><a href=\"#anchor504675\">endwhile<\/a><\/li><li><a href=\"#anchor574660\">errorchecking<\/a><\/li><li><a href=\"#anchor545852\">getargs<\/a><\/li><li><a href=\"#anchor845563\">getplatform<\/a><\/li><li><a href=\"#anchor545852\">getprocparam<\/a><\/li><li><a href=\"#anchor592132\">gettime<\/a><\/li><li><a href=\"#anchor452417\">getyesno<\/a><\/li><li><a href=\"#anchor540376\">gosub<\/a><\/li><li><a href=\"#anchor482379\">goto<\/a><\/li><li><a href=\"#anchor463190\">if<\/a><\/li><li><a href=\"#anchor534849\">include<\/a><\/li><li><a href=\"#anchor569685\">kill<\/a><\/li><li><a href=\"#anchor482379\">label<\/a><\/li><li><a href=\"#anchor419050\">log<\/a><\/li><li><a href=\"#anchor456193\">logappend<\/a><\/li><li><a href=\"#anchor456193\">logbegin<\/a><\/li><li><a href=\"#anchor456193\">logend<\/a><\/li><li><a href=\"#logremove\">logremove<\/a><\/li><li><a href=\"#anchor703314\">loop<\/a><\/li><li><a href=\"#anchor819251\">message<\/a><\/li><li><a href=\"#read\">read<\/a><\/li><li><a href=\"#readadvance\">readadvance<\/a><\/li><li><a href=\"#readbeginend\">readbegin<\/a><\/li><li><a href=\"#readbeginend\">readend<\/a><\/li><li><a href=\"#anchor931244\">rem<\/a><\/li><li><a href=\"#anchor496438\">repeat<\/a><\/li><li><a href=\"#anchor525668\">return<\/a><\/li><li><a href=\"#anchor449739\">set<\/a><\/li><li><a href=\"#anchor540376\">sub<\/a><\/li><li><a href=\"#anchor513444\">switch<\/a><\/li><li><a href=\"#anchor579927\">try<\/a><\/li><li><a href=\"#anchor496438\">until<\/a><\/li><li><a href=\"#anchor563925\">updateprocparam<\/a><\/li><li><a href=\"#anchor917601\">var<\/a><\/li><li><a href=\"#anchor504675\">while<\/a><\/li><\/ol>\n\n\n\n<amp -fit-text layout=\"fixed-height\" min-font-size=\"14\" max-font-size=\"48\" height=\"50\"><h4 class=\"wp-block-heading\" id=\"advgb-toc-9f49da79-f42a-4282-a04b-d8d5ab8f53ab\"><a name=\"NewOps\"><\/a>New operators implemented in <a href=\"http:\/\/meiradarocha.jor.br\/news\/wp-content\/uploads\/2010\/11\/New-PageMaker-scripter.zip\">Script Engine v 3.5<\/a><\/h4><\/amp>\n\n\n\n<ol class=\"wp-block-list\"><li><a href=\"#abort\">abort<\/a><\/li><li><a href=\"#continue\">continue<\/a><\/li><li><a href=\"#dir\">dir<\/a><\/li><li><a href=\"#execute\">execute<\/a><\/li><li><a href=\"#getnameof\">getnameof<\/a><\/li><li><a href=\"#get..cancel\">getokcancel<\/a><\/li><li><a href=\"#getscriptver\">getscriptver<\/a><\/li><li><a href=\"#get..cancel\">getyesnocancel<\/a><\/li><li><a href=\"#readline\">readline<\/a><\/li><li><a href=\"#system\">system<\/a><\/li><li><a href=\"#callback\">callback<\/a><\/li><li><a href=\"#getpanestate\">getpanestate<\/a><\/li><li><a href=\"#setpanestate\">setpanestate<\/a><\/li><\/ol>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-4da794be-129f-4aa4-a653-bfa0f75693af\"><a name=\"anchor434451\"><\/a>Operator: @<\/h4>\n\n\n\n<p>Syntax: @ &lt;script line&gt;<\/p>\n\n\n\n<p>The @ operator sends the &lt;script line&gt; directly to PageMaker with NO processing. The following example illustrates the issue:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">@ findattr \"Any\", \"Any\", -2, boldstyle+underlinestyle<\/pre>\n\n\n\n<p>This script line should set the Find attributes to search for both bold and underline typestyles. Normally PMSL would try add the boldstyle and underlinestyle arguments before sending the script line to the PageMaker. It would cause an error in calculations unless variables &#8216;boldstyle&#8217; and &#8216;underlinestyle&#8217; are properly defined in the script. The <em>@ <\/em>operator tells PMSL to send the line with no processing.<\/p>\n\n\n\n<p>Another possible reason for using @ could be a performance considerations, especially when command is used within loop. Be sure, that command listed after @-prefix does not contains variables and numeric computations so that PageMaker could handle it.<\/p>\n\n\n\n<p>At least one white space character is required between @ and the rest of the line.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-016920da-6efd-438c-910e-74fa253bd4fb\"><a name=\"anchor449739\"><\/a>Operator: set<\/h4>\n\n\n\n<p>Syntax: <em>set <\/em>&lt;expression&gt; &gt;&gt; &lt;list of variables&gt;<\/p>\n\n\n\n<p>Obsolete way of assignment. Supported for backward compatibility.<\/p>\n\n\n\n<p>For example, instead of<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>set<\/em> x + 1 , y + 1 &gt;&gt; xplus,yplus<\/pre>\n\n\n\n<p>one may consider using<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">xplus,yplus = x + 1 , y + 1<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-7d58d5d0-257c-43f5-993d-e4834d718924\"><a name=\"anchor819251\"><\/a>Operator: message<\/h4>\n\n\n\n<p>Syntax: <em>message<\/em> &lt;string&gt;<\/p>\n\n\n\n<p>Here &lt;string&gt; is any quoted string or any expression that evaluates into quoted string. Operator message halts execution of a script and displays text in a dialog box. An OK button allows the user to resume execution of the script.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>getpagenumber<\/em> &gt;&gt; N, ...<em>\nmessage<\/em> \"Document contains \"+quote(N)+\" pages.\"<\/pre>\n\n\n\n<p>When applied to a new default document script displays the following message:<\/p>\n\n\n\n<p>Document contains 1 pages.<\/p>\n\n\n\n<p>PMSL will display a single message box for consecutive message statements, for example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>message<\/em> \" ****************************************** \"<em>\nmessage<\/em> \" * Your script begins * \"<em>\nmessage<\/em> \" ****************************************** \"<\/pre>\n\n\n\n<p>displays just one message dialog .<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-84d37a7a-6761-4dd1-8cdd-ce417b2a9670\"><a name=\"anchor452417\"><\/a>Operator: getyesno<\/h4>\n\n\n\n<p>Syntax: <em>getyesno <\/em>&gt;&gt; &lt;variable&gt;<\/p>\n\n\n\n<p>The &#8216;OK&#8217; button normally displayed in a message box can be replaced with a pair of &#8216;YES&#8217; \/ &#8216;NO&#8217; buttons by using the <em>getyesno <\/em>operator following a <em>message <\/em>statement(s). The user&#8217;s choice (i.e. YES or NO) will be assigned to a variable indicated in the <em>getyesno <\/em>line.<br \/>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>message<\/em> \"Memory is extremely low.\"<em>\nmessage<\/em> \"Do you want to cancel this script?\"<em>\ngetyesno<\/em> &gt;&gt; yesno<em>\n<a href=\"#anchor463190\">if<\/a><\/em> yesno = YES<em>\n  <a href=\"#anchor525668\">return<\/a><\/em><em>\n<a href=\"#anchor463190\">endif<\/a><\/em><\/pre>\n\n\n\n<p>The variable &#8216;yesno&#8217; will be assigned a value of YES or NO depending on the user&#8217;s choice. The <em>if <\/em>statement tests the returned value and branches accordingly. (Note: Values YES and NO are in upper case and not enclosed in quotes.)<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-d12659b8-e5f4-4716-8f49-de467cb3eba9\"><a name=\"readbeginend\"><\/a>Operators: readbegin, readend<\/h4>\n\n\n\n<p>Syntax: <em>readbegin <\/em>&lt;filename&gt;<\/p>\n\n\n\n<p>Syntax: <em>readend<\/em><\/p>\n\n\n\n<p>Operator <em>readbegin <\/em>opens file for input and sets the file pointer at the beginning of the file. PMSL provides only sequential access to the file by operators <em>read <\/em>and <em>readadvance<\/em>. PMSL admits no more then one opened input file at a time. Parameter &lt;filename&gt; should be a quoted string. On Windows file name is relative to the location of the current script unless a parameter &lt;filename&gt; contains name of the drive. On Macintosh PMSL always tries first to consider parameter as absolute path which starts with a name of the volume. When fails to do so, PMSL tries to open file in the folder of currently executed script. If &lt;filename&gt; starts with &#8216;:&#8217; then char &#8216;:&#8217; is ignored, but everything after &#8216;:&#8217; is considered as relative to the location of the current script from the very beginning. Current implementation of PMSL on Windows platform does not recognize long file names.<\/p>\n\n\n\n<p>The file remains opened for input until operator <em>readend <\/em>closes it.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-f3f83bd7-d6ed-490b-b2e8-45bd3b1103c3\"><a name=\"read\"><\/a>Operator: read<\/h4>\n\n\n\n<p>Syntax: <em>read <\/em>&gt;&gt; var1,var2, . . . , varN<\/p>\n\n\n\n<p>Operator <em>read <\/em>presumes that the current line of the input file is a list of comma separated tokens. Operator reads tokens one by one and assigns them to variables var1,var2, . . . , varN. Every variable including the last one gets just one token. When executing operator <em>read, <\/em>file pointer can not go to the next line of the input file. If the line has not enough tokens, remaining variables get value of an empty string.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-b94b72ff-d787-4d2e-977e-d45ee8ac392a\"><a name=\"readadvance\"><\/a>Operator:&nbsp; readadvance.<\/h4>\n\n\n\n<p>Syntax: <em>readadvance <\/em>nLines,nTokens<\/p>\n\n\n\n<p>Moves file pointer nLines forward ( current line counted as the first one) and after that moves file pointer yet nTokens forward. When moving nTokens forward remains in the same line. If line is too short file pointer stops before carriage return.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-3ca77c7b-b164-4419-899f-ae2ad34b3f79\"><a name=\"anchor456193\"><\/a>Operators: logbegin , logend , logappend<\/h4>\n\n\n\n<p>Syntax: <em>logbegin <\/em>&lt;filename&gt;<\/p>\n\n\n\n<p>Syntax: <em>logappend <\/em>&lt;filename&gt;<\/p>\n\n\n\n<p>Syntax: <em>logend<\/em><\/p>\n\n\n\n<p><em>logbegin<\/em> opens for output a file specified as a parameter. All subsequent commands <em>log<\/em> will write there arguments into this file. The file is opened until command <em>logend<\/em> closes it. The name and path specified as a parameter of the <em>logbegin<\/em> operator should be quoted. On Windows path name is relative to the location of the current script unless parameter &lt;filename&gt; contains name of the drive . On Macintosh PMSL always tries first to interpret parameter as absolute path which starts with a name of the volume. When fails to do so, writes log file into the directory of the current script. Current implementation of PMSL on Windows platform does not recognize long file names.<\/p>\n\n\n\n<p><em>logend<\/em> closes the log opened by matching <em>logbegin<\/em> operator.<\/p>\n\n\n\n<p><em>logbegin &#8230; logend<\/em> segnents may be nested, in this case internal <em>logbegin &#8230; logend<\/em> is ignored, so that first opened log overrules other log files which happen to be opened inside the widest <em>logbegin&#8230;logend<\/em> range.<\/p>\n\n\n\n<p><em>Logappend<\/em> works similar to <em>logbegin<\/em>, except it wont delete the specified file but rather set it up for appending.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-3134defa-f5cb-49a1-8ad9-fcb9960c39aa\"><a name=\"anchor419050\"><\/a>Operator: log<\/h4>\n\n\n\n<p>Syntax: <em>log <\/em>&lt;expression&gt;<\/p>\n\n\n\n<p><em>log <\/em>calculates <em>&lt;<\/em>expression&gt; if necessary (quoted expression is expected) and writes it into the log which is currently opened by logbegin command. Outside of the l<em>ogbegin &#8230; logend <\/em>range operator <em>log<\/em> works exactly as operator <a href=\"#anchor819251\"><em>message<\/em> <\/a>does.<\/p>\n\n\n\n<p>Warning: On Windows platform an error in the <em>log<\/em> line ( if occured ) does not error out the script. Expected behaviour &#8211; script is interrupted. This is a bug to be fixed in future versions.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-baeceba0-0667-45b7-80f7-d6766d899ccb\"><a name=\"logremove\"><\/a>Operator: logremove<\/h4>\n\n\n\n<p>Syntax: <em>logremove <\/em>&lt;filename&gt;<br \/>Finds and delete specified file.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-e3b6ba3c-ae4c-4d02-8376-d1508ce094f0\"><a name=\"anchor463190\"><\/a>Operators: if , endif<\/h4>\n\n\n\n<p>Syntax: <em>if <\/em>&lt;expression&gt;<\/p>\n\n\n\n<p>Syntax: <em>endif<\/em><\/p>\n\n\n\n<p>The &lt;expression&gt; will be evaluated. If the result of calculation is 0 ( false) , all script lines between the <em>if<\/em> and <em>endif<\/em> operators will be skipped. Programming constructs <em>if .<\/em>&#8230; <em>endif<\/em> may be nested; PMSL will find right <em>endif<\/em>.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">getpagesize &gt;&gt; x,y<em>\nif<\/em> x &gt; y\n  z = x\n  x = y\n  z = y<em>\nendif\n<\/em>pagesize x, y<\/pre>\n\n\n\n<p>This script will convert a wide pagesize pub to a tall pub, but will have no effect on tall pagesize pubs.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-0f84d6c0-c280-4113-8881-df0662a4d3a5\"><a name=\"anchor471767\"><\/a>Operators: elseif , else<\/h4>\n\n\n\n<p>Syntax: <em>elseif<\/em> &lt;expression&gt;<\/p>\n\n\n\n<p>Syntax: <em>else<\/em><\/p>\n\n\n\n<p>Operators <em>elseif<\/em> or <em>else<\/em> may be placed between <em>if<\/em> and <em>endif<\/em> so that script performs some actions in case the <em>if<\/em><br \/>statement founds it&#8217;s condition to be false.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">getpagenumber &gt;&gt; n, ...<em>\nif <\/em>n = -3<em>\n  message <\/em>\" This is a left master page.\"<em>\nelseif <\/em>n = -4<em>\n  message <\/em>\" This is a right master page.\"<em>\nelse\n  message <\/em>\" This is a regular page.\"<em>\nendif<\/em><\/pre>\n\n\n\n<p>Note that <em>if<\/em>&#8216;s and <em>endif<\/em>&#8216;s in a script should match. Thus, <em>elseif <\/em>is not exactly the same as <em>else <\/em>and <em>if <\/em>on two consequtive lines of hr script.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">getpagenumber &gt;&gt; n, ...<em>\nif <\/em>n = -3<em>\n  message <\/em>\" This is left master page.\"<em>\nelse<\/em>\n <em> if <\/em>n = -4\n <em>   message <\/em>\" This is right master page.\"\n <em> else<\/em>\n <em>   message <\/em>\" This is regular page.\"\n <em> endif<\/em>\n<em>endif<\/em><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-31b80b67-309c-4821-98e0-1134f08ecdaa\"><a name=\"anchor482379\"><\/a>Operators: goto , label<\/h4>\n\n\n\n<p>Syntax: <em>goto <\/em>&lt;expression&gt;<\/p>\n\n\n\n<p>Syntax: <em>label <\/em>&lt;value&gt;<\/p>\n\n\n\n<p><em>goto <\/em>evaluates the &lt;expression&gt; and passes the control to the next label statement where &lt;value&gt; matches the evaluated &lt;expression&gt;.<br \/>Operator <em>goto <\/em>can not transfer control backwards. If a script contains several identical labels the first matching label will be founded.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">getfont &gt;&gt; fontname\ngetfontlist &gt;&gt; fontlist\n<em>if <\/em>\"Helvetica\" # fontlist\n  font \"Helvetica\"\n<em>  goto<\/em> done\n<em>endif<\/em>\n<em>if<\/em> \"Helvetica-Narrow\" # fontlist\n<em>  message<\/em> \"Font \\\"Helvetica-Narrow\\\" substituted instead of \\\"Helvetica\\\" \"\n  font \"Helvetica-Narrow\"\n<em>  goto<\/em> done\n<em>endif<\/em>\n<em>message<\/em> \" Default font\" + fontname + \"will be used instead of undiscovered \\\"Helvetica\\\" \"\n<em>label<\/em> done\nnewstory 1,1\ntextenter \"How do you like this font?\"\ndeselect\nfont fontname<\/pre>\n\n\n\n<p>This script tries to set the font &#8220;Helvetica&#8221; or a similar font and then uses the default font only if it fails to do so. The last line of the script restores the default font.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-b404f3b4-c215-4b03-8f73-dee7fa34adb8\"><a name=\"anchor496438\"><\/a>Operators: repeat , until<\/h4>\n\n\n\n<p>Syntax: <em>repeat<\/em><\/p>\n\n\n\n<p>Syntax: <em>until<\/em> &lt;expression&gt;<\/p>\n\n\n\n<p>All statements from <em>repeat <\/em>to <em>until <\/em>form a loop. The loop will be repeated at least once. While &lt;expression&gt; evaluates to 0 the loop will be repeated. Repetition of the loop stops as soon as &lt;expression&gt; evaluates to a non-zero value. Nested loops are also possible. Use operator <em><a href=\"#anchor701198\">break<\/a><\/em> for emergent exit from the loop.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">i = 0\n<em>repeat<\/em>\n  i = i+1\n  new i\n<em>until<\/em> i = 10<\/pre>\n\n\n\n<p>This script opens 10 new pubs with 1,2,&#8230;10 pages correspondingly.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">getcolornames &gt;&gt; colorlist\n<em>repeat<\/em>\n<em>  set <\/em>colorlist =&gt; somecolor,colorlist\n<em>  message<\/em> \"Color \" + somecolor + \" discovered.\"\n<em>until<\/em> empty(colorlist)<\/pre>\n\n\n\n<p>This script shows in its message box, the names of all colors defined in a pub. How this script works: Every iteration of<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">set colorlist &gt;&gt; somecolor,colorlist<\/pre>\n\n\n\n<p>sets &#8216;somecolor&#8217; to the first color in &#8216;colorlist&#8217; and then dumps the remainder of the list back into &#8216;colorlist&#8217;, which gets one term shorter each time. After the last color is displayed, &#8216;colorlist&#8217; is exhausted, (i.e. is equal to empty string). The empty() function, returns &#8216;1&#8217; at this point and operrator <em>until <\/em>interrupts the loop.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-33807f6f-9d02-407e-b13a-3ceecfb69bf1\"><a name=\"anchor504675\"><\/a>Operators: while , endwhile<\/h4>\n\n\n\n<p>Syntax: <em>while <\/em>&lt;expression&gt;<\/p>\n\n\n\n<p>Syntax: <em>endwhile<\/em><\/p>\n\n\n\n<p>All statements between these two statements form a loop. The loop will be executed until &lt;expression&gt; evaluates to 0. Unlike the <em>repeat<br \/><\/em>&#8230; <em>until <\/em>loop, this loop checks that &lt;expression&gt; is not 0 before entering the loop. If &lt;expression&gt;&#8217;s initial value is 0 the loop will be skipped altogether.<\/p>\n\n\n\n<p>Use operator <em><a href=\"#anchor701198\">break<\/a><\/em> for emergent exit from the loop.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-53167632-5e91-44c1-9a93-14b3e4312a2b\"><a name=\"anchor703314\"><\/a>Operators: loop , endloop<\/h4>\n\n\n\n<p>Syntax: <em>loop <\/em>&lt;variable&gt; = &lt;from&gt;,&lt;to&gt;<\/p>\n\n\n\n<p>Syntax: <em>endloop<\/em><\/p>\n\n\n\n<p>&lt;from&gt; and &lt;to&gt; stand for the beginning and ending value of the variable. All statements between loop and endloop will be repeated for every value of &lt;variable&gt; starting with &lt;from&gt;, and ending when &lt;variable&gt; is greater than &lt;to&gt;, incrementing by 1 with each iteration. Loop will be skipped if value of &lt;from&gt; is greater then value of &lt;to&gt;. The value of &lt;variable&gt; can be used inside and after the loop. (Note: loop is similar to the BASIC For statement.)<\/p>\n\n\n\n<p>Use operator <em><a href=\"#anchor701198\">break<\/a><\/em> for emergent exit from the loop.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">editstory\n<em>loop <\/em>i = 1 , 10\n  textenter \"\"(i)+\", \"\n<em>endloop<\/em><\/pre>\n\n\n\n<p>This example enters the numbers from 1 to 10 in a story in the story editor.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-4f2c245f-a6c6-4a38-ad28-c27967cedd3f\"><a name=\"anchor513444\"><\/a>Operators: switch , caseof , endswitch , default<\/h4>\n\n\n\n<p>Syntax: <em>switch<\/em> &lt; expression&gt;<\/p>\n\n\n\n<p>Syntax: <em>caseof<\/em> &lt; expression&gt;<\/p>\n\n\n\n<p>Syntax: <em>endswitch<\/em><\/p>\n\n\n\n<p>Syntax: <em>default<\/em><\/p>\n\n\n\n<p>Switch evaluates &lt;expression&gt; and looks for caseof staement which has the same value of the &lt;expression&gt;. If such a statement is found then the execution of a script resumes starting with the line immediately following the <em>caseof<\/em> statement. If matching <em>caseof<\/em> is not found then switch looks for <em>default<\/em> statement in the <em>switch<\/em><br \/>.. <em>endswitch<\/em> scope. Normally, script segment following the <em>caseof<\/em> statements should be completed by <em><a href=\"#anchor701198\">break<\/a><\/em> command to prevent falling thru another <em>caseof<\/em> statement.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">getpagenumber &gt;&gt; n,...\n<em>switch <\/em>n\n<em>  caseof<\/em> -3\n    <a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor819251\"><em>message<\/em> <\/a>\"Left master page\"\n<em>    break<\/em>\n<em>  caseof <\/em>-4\n    <em><a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor819251\">message <\/a><\/em>\"Right master page\"\n<em>    break<\/em>\n<em>  default<\/em>\n    <a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor819251\"><em>message<\/em> <\/a>\"Regular page\"\n<em>endswitch<\/em><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-00b02b99-d0d2-4089-91c5-29b97c18c2c1\"><a name=\"anchor701198\"><\/a>Operator: break<\/h4>\n\n\n\n<p>Syntax: <em>break <\/em>&lt;expression&gt;<br \/>This operator breaks a loop or <em><a href=\"#anchor513444\">switch<\/a><\/em> statement if &lt;expression&gt; evaluates to TRUE. Ignored if &lt;expression&gt; evaluates to 0 ( FALSE ). Note that when <em>break <\/em>is used without parameters &lt;expression&gt; evaluates to empty string which is considered as TRUE. Operator break may be used for premature exit from <em><a href=\"#anchor496438\">repeat<\/a><br \/>&#8230; <a href=\"#anchor496438\">until ,<\/a> <a href=\"#anchor504675\">while<\/a> &#8230; <a href=\"#anchor504675\">endwhile<\/a> <\/em>and <em><a href=\"#anchor703314\">loop<\/a> &#8230; <a href=\"#anchor703314\">endloop<\/a> <\/em>loops.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-7adf6d4b-6393-4677-9625-5789cd873f94\"><a name=\"anchor525668\"><\/a>Operators: call ( or gosubfile) , return<\/h4>\n\n\n\n<p>Syntax: <em>call<\/em> filename.ext , &lt;list of parameters&gt; &gt;&gt; &lt;list of vars&gt;<\/p>\n\n\n\n<p>or<\/p>\n\n\n\n<p><em>gosubfile <\/em>filename.ext,&lt;list of parameters&gt; &gt;&gt; &lt;list of vars&gt;<\/p>\n\n\n\n<p>Syntax: <em>return<\/em> &lt;expression&gt;<\/p>\n\n\n\n<p><em>call<\/em> evaluates the list of parameters and starts running the script from the file &#8220;filename.ext&#8221;. This new script runs as a subroutine of the parent script containing <em>call<\/em> operator. It can read the same variables that were defined at the moment subroutine was called and can add local variables for reading and writing. In case of attempt to change non-local variable PMSL will create local variable with the same name. All local variables are forfeited upon exit from a subroutine. When the<br \/><em>return <\/em>statement is encountered in the script, &#8220;filename.ext&#8221; evaluates &lt;expression&gt; in this statement, assigns the result to the variable(s) &lt;list of vars&gt; as posted in <em>call <\/em>statement and passes control to the statement following the <em>call <\/em>statement in the parent script. Recursive calls are also possible, (but can be dangerous.)<br \/>If <em>return <\/em>occurs in the script initially launched by user, then the script terminates. Using <em>return <\/em>is the only legal way to finish the script, (i.e. every script should contain a terminating <em>return<\/em>).<\/p>\n\n\n\n<p>Depending on the implementation &lt;expression&gt; may be used in a &#8220;good by&#8221; message box which indicates to a user that script has been completed.<\/p>\n\n\n\n<p>Depending on the implementation PMSL may or may not post an alert if user forgets to put &#8216;<em>return<\/em>&#8216; at the end of a script.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-a161fc98-8832-4c86-bf09-3adb59184ae3\"><a name=\"anchor534849\"><\/a>Operator: include<\/h4>\n\n\n\n<p>Syntax: <em>include <\/em>filename.ext,&lt;list of parameters&gt; &gt;&gt; &lt;list of vars&gt;<\/p>\n\n\n\n<p>Same as <em><a href=\"#anchor525668\">call<\/a><\/em>, but local variables are not destroyed upon exit from the subroutine.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-daf41b57-b600-4f7b-8038-557f51b1d343\"><a name=\"anchor540376\"><\/a>Operators : gosub , sub , endsub<\/h4>\n\n\n\n<p>Syntax: <em>gosub <\/em>&lt;name of subroutine&gt; ,&lt;list of parameters&gt; &gt;&gt; &lt;list of vars&gt;<\/p>\n\n\n\n<p>Syntax: <em>sub <\/em>&lt;name of subroutine&gt;<\/p>\n\n\n\n<p>Syntax: <em>endsub<\/em><\/p>\n\n\n\n<p>Unlike operator <em><a href=\"#anchor525668\">call<\/a> <\/em>the operator <em>gosub <\/em>looks for subroutine in the current file. Subroutine is defined as a script segment between <em>sub <\/em>and <em>endsub <\/em>operators. Subroutine may be defined in any place of the script ( usually at the beginning or at the end of the script.). When <em>sub <\/em>statement occurs during normal execution of the script the <em>sub <\/em>.. <em>endsub <\/em>segment of the script is skipped.<\/p>\n\n\n\n<p>The following script displays &#8220;1&#8221;,&#8221;2&#8243;,&#8221;3&#8243; in three consequtive message boxes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">n = 0\n<em>sub <\/em>test\n  <em><a href=\"#anchor819251\">message <\/a><\/em>quote(n)\n  <em><a href=\"#anchor525668\">return<\/a><\/em>\n<em>endsub<\/em>\n<em><a href=\"#anchor703314\">loop <\/a><\/em>n = 1,3\n<em>  gosub <\/em>test\n<em><a href=\"#anchor703314\">endloop<\/a><\/em>\n<em><a href=\"#anchor525668\">return<\/a><\/em><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-555e4a5f-a018-4ec4-8539-a1ee91d016af\"><a name=\"anchor545852\"><\/a>Operator: getprocparam, getargs<\/h4>\n\n\n\n<p>Syntax: <em>getprocparam <\/em>&gt;&gt; &lt;list of values&gt;<\/p>\n\n\n\n<p>Syntax: <em>getargs <\/em>&gt;&gt; &lt;list of values&gt;<\/p>\n\n\n\n<p><em>getprocparam <\/em>is used within a subroutine to acquire parameters passed to the subroutine in a <a href=\"#anchor525668\">call, gosubfile<\/a>, <a href=\"#anchor534849\">include <\/a>or <a href=\"#anchor540376\">gosub <\/a>operator. Operators <em>getprocparam <\/em>and <em>getargs <\/em>assign parameters to the variables posted to the right of arrow. Operator <em>getprocparam <\/em>produces the name of the file or subroutine on the first place and after that parameters passed to the subroutine. Operator <em>getargs <\/em>produces parameters only.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em><a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor540376\">sub <\/a><\/em>cube\n<em>  getprocparam <\/em>&gt;&gt; ...,arg \/\/ Script line ' <em>getargs <\/em>&gt;&gt; arg ' would have the same effect\n  <em><a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor525668\">return <\/a><\/em>arg*arg*arg\n<em><a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor540376\">endsub<\/a><\/em>\ns = 0\n<em><a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor703314\">loop <\/a><\/em>n = 1,10\n  <em><a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor540376\">gosub <\/a><\/em>cube,n &gt;&gt; n3\n  s = s + n3\n<em><a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor703314\">endloop<\/a><\/em>\n<em><a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor525668\">return <\/a><\/em>s<\/pre>\n\n\n\n<p>This script calculates the sum 1*1*1 + 2*2*2 + . . . + 10*10*10.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-aac85bdb-665f-453d-bfd0-7c79527128c2\"><a name=\"anchor563925\"><\/a><a name=\"anchor917601\"><\/a>Operator: var<\/h4>\n\n\n\n<p>Syntax: <em>var<\/em> &lt;list of variables.&gt;<\/p>\n\n\n\n<p>Similar to Dim statement in VB. Not required by PMSL, but useful for readability.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-45dcfaa8-b69c-4097-bf40-f9ff70de1e2d\"><a name=\"anchor569685\"><\/a>Operator: kill<\/h4>\n\n\n\n<p>Syntax <em>kill<\/em> &lt;list of variables&gt;<\/p>\n\n\n\n<p><em>kill <\/em>removes all variables posted in the list from memory. If list contains a name of a variable which does not currently exist, this name is ignored. <em>kill <\/em>is only implemented for memory management purposes.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a,b,c = 1,2,3\n<em><a href=\"post.php?post=1740&amp;action=edit#anchor819251\">message <\/a><\/em>quote(a ,b ,c)\n<em>kill <\/em>a,c,d\n<em><a href=\"post.php?post=1740&amp;action=edit#anchor819251\">message <\/a><\/em>quote(a,b,c)\n<em><a href=\"post.php?post=1740&amp;action=edit#anchor525668\">return<\/a><\/em><\/pre>\n\n\n\n<p>The first message in this example displays &#8216;1,2,3&#8217; while the second message displays &#8216;a,2,c&#8217;. The variables a and c are killed so that only b will be substituted.<br \/>In a subroutine, <em>kill <\/em>only effects local variables.<\/p>\n\n\n\n<p>Some implementations may ignore this command.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-3009ed06-1570-40fc-b840-a6ffb1e2165f\"><a name=\"anchor574660\"><\/a>Operator: errorchecking<\/h4>\n\n\n\n<p>Syntax: <em>errorchecking<\/em> on<\/p>\n\n\n\n<p>or<\/p>\n\n\n\n<p><em>errorchecking<\/em> off<\/p>\n\n\n\n<p>Depending on the state of this toggle, PMSL tests, following each command or query, to see if PageMaker returns an error. Checking is done using the query &#8220;getlasterrorstr&#8221;. The reply from this query is displayed if an error occurs and the script is aborted. The default state of errorchecking is on. If errorchecking is off Scripter ignores invalid commands and returns a void reply for invalid queries. (It is the users responsibility to test for errors explicitly, in this state.) Switching errorchecking off may slightly increase performance and allows the programmer to test for invalid commands and queries or arguments without aborting the script. (Note: It is advisable to leave errorchecking on for normal scripting. When disabling errorchecking to test for an error condition, remember to re-enable as soon as the test is complete.)<\/p>\n\n\n\n<p><a name=\"prevExample\"><\/a>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>errorchecking <\/em>off\nfont \"Arial\"\nfont \"Helvetica\"<em>\nerrorchecking <\/em>on<\/pre>\n\n\n\n<p>This script assigns to a selected text font &#8220;Helvetica&#8221; if this font installed, otherwise it assigns font &#8220;Arial&#8221; If neither &#8220;Helvetica&#8221; nor &#8220;Arial&#8221; is installed then script leaves text as is. Anyway, script is not aborted when Pagemaker command &#8216;font&#8217; fails.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-f6fa9649-17df-40fa-aa13-67365332d737\"><a name=\"anchor579927\"><\/a>Operator: try<\/h4>\n\n\n\n<p>Syntax<strong>: <\/strong><em>try <\/em>&lt;PageMaker command&gt;<\/p>\n\n\n\n<p>Operator <em>try<\/em> supresses errorchecking while executing just one command.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>try <\/em>font \"Arial\"<em>\ntry <\/em>font \"Helvetica\"<\/pre>\n\n\n\n<p>This script does the same as the script in <a href=\"#prevExample\">previous example.<\/a><\/p>\n\n\n\n<p>[<span style=\"color: #ff0000;\">Note from editor: PM 7.0.2 generate an error anyway at StyleEnd, if an error ocours in StyleBegin-StyleEnd definition, regard <strong>try <\/strong>or <strong>errorchecking off<\/strong><\/span>]<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-3c591343-e742-444d-984f-08caa42c08dc\"><a name=\"anchor583419\"><\/a>Operator: breakpoint<\/h4>\n\n\n\n<p>Syntax: <em>breakpoint <\/em>&lt;expression&gt;<\/p>\n\n\n\n<p>If a script is traced, then the breakpoint operator evaluates &lt;expression&gt; and if the result differs from 0 suspends the normal execution of a script switching Scripter to step mode. The operator is used for debugging of a script. A script can be run by &#8220;Trace script&#8221; command on the Script Palette with subsequent choice of the and &#8220;Run&#8221; option. In this case the script will run until the breakpoint operator is encountered. The programmer can then step thru the suspect lines and then re-initiate the run mode to complete the remainder of the script.<\/p>\n\n\n\n<p>Operator <em>breakpoint <\/em>is ignored if script is executed without tracing.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-d2adb8d4-6f6d-440f-af7f-6ba4d7fcffdb\"><a name=\"anchor592132\"><\/a>Operator: gettime<\/h4>\n\n\n\n<p>no parameters required<\/p>\n\n\n\n<p>replies: year, month (1 .. 12), date ( 1.. 31), hour, min, sec, miliseconds , tickcount<br \/>Value of tickcount depends on platform: on WIN it is milisecs since system started; on MAC it is sixties of seconds since system started. Miliseconds are returned only for Windows, for Mac this value is always 0.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-958ecf60-1ae0-43c1-8a6a-93d6e07f6103\"><a name=\"anchor598888\"><\/a><a name=\"anchor603276\"><\/a><a name=\"anchor845563\"><\/a>Operator: getplatform<\/h4>\n\n\n\n<p>Replies: MACINTOSH or WINDOWS<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>getplatform <\/em>&gt;&gt; def<em>\n<a href=\"#anchor463190\">if <\/a><\/em>def = WINDOWS\n &nbsp;<em><a href=\"#anchor419050\">log<\/a> <\/em>\"Executing Windows script.\"<em>\n<a href=\"#anchor471767\">elseif <\/a><\/em>def = MACINTOSH<em>\n  <a href=\"#anchor419050\">log<\/a> <\/em>\"Executing Macintosh script\"<em>\n<a href=\"#anchor463190\">endif<\/a><\/em><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-4c0394f6-cbd9-47ce-8ccb-9837a80d6568\"><a name=\"anchor931244\"><\/a>Operator: rem<\/h4>\n\n\n\n<p>If the first word in a line is rem , then the line is ignored. Such a line may be used for comments.<\/p>\n\n\n\n<p>One may also use &#8212; or \/\/ for commenting the script. Unlike <em>rem , &#8212; <\/em>or \/\/ can comment part of the line, following these symbols.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-0f7848a0-d2fa-47b5-a19b-c98181ccd82e\"><a name=\"abort\"><\/a>Operator: abort<\/h4>\n\n\n\n<p>Cancels execution of the current script and all parent scripts. When using &#8216;Execute Script&#8217; command in Script Palette &#8216;abort&#8217; forces PMSCRIPT to quit, when using &#8216;Trace Script&#8217; menu item in the Script Palette &#8216;abort&#8217; leaves only two choices: &#8220;Reset&#8221; ( to start again from the very beginning ) and &#8220;Close&#8221;. ( to close the tracing application )<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-f600b217-b861-4388-8c50-72ae50883911\"><a name=\"continue\"><\/a>Operator: continue<\/h4>\n\n\n\n<p>Operator &#8216;continue&#8217; may be used inside loops defined by any of the folowing construct pairs: loop .. endloop, repeat .. until, while .. endwhile. Operator &#8216;continue&#8217; forces to skip all lines of the script between &#8216;continue&#8217; and &#8216;endloop&#8217; or &#8216;endwhile&#8217; or &#8216;until&#8217;, whichever comes first. If &#8216;continue&#8217; is used with a parameter, then parameter is evaluated first and if the result is 0 then command &#8216;continue&#8217; is ignored.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>editstory<\/em>\n<em><a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor703314\">loop<\/a><\/em> i = 1,Len(FontList)\n  <em><a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor579927\">try<\/a><\/em> font FontList(i)\n  <em>getlasterror<\/em> &gt;&gt; err\n  <em>continue<\/em> err \/\/ do nothing since font does not exist in a document\n<em>  textenter<\/em> FontList(i)\n<em>  textenter<\/em> \"\n  \"\n<em><a href=\"http:\/\/www.oz.net\/%7Evsamarsk\/KeyWords.html#anchor703314\">endloop<\/a><\/em><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-8423683c-3ccf-4565-a680-b1ac331da545\"><a name=\"dir\"><\/a>Operator: dir<\/h4>\n\n\n\n<p>Operator &#8216;dir&#8217; returns list of the files in a directory which satisfy search pattern specified in the parameter. Files are retrieved as a comma separated list of the quoted file names.<\/p>\n\n\n\n<p>Example 1:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">dir \"c:\\adobe\\pm65\\rsrc\\usenglsh\\plugins\\scripts\\<a href=\"ScriptingTools.htm#Dialog Builder\" target=\"NEW\">Dialog Builder<\/a>\\*.spt\" &gt;&gt; List\n <em>message<\/em> str(List)\n return<\/pre>\n\n\n\n<p>The following list is prompted:<\/p>\n\n\n\n<p>&#8220;Open Dialog Template.spt&#8221;, &#8220;Align Controls.spt&#8221;,&#8221;Adjust Dialog Box.spt&#8221;,&#8221;Test Dialog.spt&#8221;,&#8221;Save Dialog.spt&#8221;<\/p>\n\n\n\n<p>If quoted string used as a parameter ends with &#8216;+&#8217; sign then operator dir searches only subdirectories.<\/p>\n\n\n\n<p>Example 2:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">dir \"c:\\adobe\\pm65\\rsrc\\usenglsh\\plugins\\scripts\\*.*+\" &gt;&gt; List<em>\n<a href=\"#anchor819251\">message<\/a><\/em> Str(List)<em>\n<a href=\"#anchor525668\">return<\/a><\/em><\/pre>\n\n\n\n<p>The following list is prompted:<\/p>\n\n\n\n<p>&#8220;Document Layout&#8221;,&#8221;Online&#8221;,&#8221;Template&#8221;,&#8221;Run Plug-ins&#8221;,&#8221;Element&#8221;,&#8221;Images&#8221;,&#8221;Printing&#8221;,&#8221;Text&#8221;,&#8221;Color&#8221;,&#8221;<a href=\"ScriptingTools.htm#Dialog Builder\" target=\"NEW\">Dialog Builder<\/a>&#8220;<\/p>\n\n\n\n<p>Example 3:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">dir \"c:\\adobe\\pm65\\rsrc\\usenglsh\\plugins\\scripts\\D*.*+\" &gt;&gt; List\n<em><a href=\"#anchor819251\">message<\/a><\/em> Str(List)\n<em><a href=\"#anchor525668\">return<\/a><\/em><\/pre>\n\n\n\n<p>The following list is prompted:<\/p>\n\n\n\n<p>&#8220;Document Layout&#8221;,&#8221;<a href=\"ScriptingTools.htm#Dialog Builder\" target=\"NEW\">Dialog Builder<\/a>&#8220;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-17fb2a67-c3eb-4903-bd49-bcdefd3e13c0\"><a name=\"execute\"><\/a>Operator: execute<\/h4>\n\n\n\n<p>Operator &#8216;execute&#8217; expectes as a parameter quoted line of the script. Quotes will be removed and script line executed.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">execute \"x = 3\"\nmessage Str(x)\nreturn<\/pre>\n\n\n\n<p>Prompted: 3<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-61725cca-cd90-4ea8-a50b-e889e3fb85d3\"><a name=\"getnameof\"><\/a>Operator: getnameof<\/h4>\n\n\n\n<p>Syntax: getnameof currentscript<\/p>\n\n\n\n<p>getnameof currentscriptdir<\/p>\n\n\n\n<p>Operator returns name ( including path ) of the curent script or path to the directory in which curently executed script resides.<\/p>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\"><span style=\"font-size: xx-small;\">Unlike in previous version, names returned by the operator are always quoted. <\/span><\/span><\/strong><\/p>\n\n\n\n<p>&#8211; paying a tribute to Win32 file system.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">getnameof currentscript &gt;&gt; x\ngetnameof currentscriptdir &gt;&gt; y\nmessage x\nmessage y\nreturn<\/pre>\n\n\n\n<p>Prompted:<\/p>\n\n\n\n<p>c:\\adobe\\pm65\\rsrc\\usenglsh\\plugins\\scripts\\example.spt<br \/>c:\\adobe\\pm65\\rsrc\\usenglsh\\plugins\\scripts<\/p>\n\n\n\n<p>Use variable watch functionality of the PMTRACE to see that x = &#8220;c:\\adobe\\pm65\\rsrc\\usenglsh\\plugins\\scripts\\example.spt&#8221; and y = &#8220;c:\\adobe\\pm65\\rsrc\\usenglsh\\plugins\\scripts&#8221;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-1107168e-f534-421e-8b02-2fa99f3804e4\"><a name=\"get..cancel\"><\/a>Operators: getyesnocancel, getokcancel<\/h4>\n\n\n\n<p>These operators work and should be used similar to the operator&nbsp; &#8216;getyesno&#8217;.<\/p>\n\n\n\n<p>Operator getyesnocancel puts 3 buttons into a message box: &#8220;Yes&#8221;,&#8221;No&#8221;,&#8221;Cancel&#8221;. It returns eiher YES or NO or CANCEL accordingly to user&#8217;s input.<br \/>Operator getokcancel puts 2 buttons into a message box: &#8220;OK&#8221; and &#8220;Cancel&#8221;. It returns either OK or CANCEL accordingly to user&#8217;s input.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-b212bd3a-4843-4dc8-a83b-8763ba64f4c7\"><a name=\"getscriptver\"><\/a>Operator: getscriptver<\/h4>\n\n\n\n<p>In new version of PMSCRIPT\/PMTRACE this operator returns 3.5<\/p>\n\n\n\n<p>It returns empty string in earlier released PMSCRIPT\/PMTRACE.<\/p>\n\n\n\n<p>Reply can be used to prevent scripts with new functionality from running on earlier versions of the script engine. For example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">getscriptver &gt;&gt; ver\nif empty(ver)\n  message \"Sorry, the script can not run on this version of the script engine.\"\nendif\nif ver &lt; 3.5\n  message \"Sorry, the script can not run on this version of the script engine.\"\nendif\nreturn<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-802d83f1-1d7d-47a2-af43-9b15261b111f\"><a name=\"readline\"><\/a>Operator: readline<\/h4>\n\n\n\n<p>This operator complements read operators in eralier versions of the script engine. It reads contents of the text file opened for reading from the current position of the file pointer to the end of the line. The result is presented as a quoted string. After string is read, the file pointer is moved to the beginning of the next line.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-538a8031-9083-4e41-95c6-518d499dfdfc\"><a name=\"system\"><\/a>Operator: system<\/h4>\n\n\n\n<p>The operator requires quoted string as a parameter. This parameter is considered and executed as a MSDOS command.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>system &#8220;copy c:\\temp\\file1.ext c:\\temp\\file2.ext&#8221;<\/p>\n\n\n\n<p>Note that in Script Engine 3.5 every system command is executed in its own DOS shell i.e. script<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">system \"c:\"\nsystem \"cd\\ \"\nsystem \"copy config.sys config.bat\"<\/pre>\n\n\n\n<p>will not work as a batch file.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-8747be18-fbc7-4f7f-a90c-ec91f2936fb0\"><a name=\"callback\"><\/a>Operator: callback<\/h4>\n\n\n\n<p>Syntax: callback &lt;Name of a subroutine&gt;<\/p>\n\n\n\n<p>Operator callback is applicable only within dialogbegin .. dialogend construct immediately after a script line specifying a control. When callback operator follows the control it modifies the default behaviour of the control. When user hits the control Scripter searches and launches a subroutine with the name specified in a callback statement. This subroutine can use operators getpanestate and setpanestate to modify other dialog controls. The dialog persists while callback subroutine is executed. After subroutine is done, user regains the control over the dialog. Note that callback subroutine may deploy its own dialogs thus implementing nested dialogs ( up to 12 nesting ones ). See an example in the script ImportStyles.spt.<\/p>\n\n\n\n<p>( dialogbegin .. dialogend construct not yet addressed in this document, see the book &#8220;Adobe PageMaker Scripting&#8221; by Hans Hansen, pp 115 &#8211; 124 )<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-0676b72f-eea0-4292-b8d7-e76cc60ddba6\"><a name=\"getpanestate\"><\/a>Operator: getpanestate<\/h4>\n\n\n\n<p>Syntax: getpanestate &lt;N&gt;<\/p>\n\n\n\n<p>where N is a number of the control when counting controls between dialogbegin and dialogend statement. Count starts with 1.<\/p>\n\n\n\n<p>This operators replies state of the control. State of the control is a string, but the content of the string depends on the type of the control.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"advgb-toc-a25addad-42dd-4a11-9e8a-c2542cfb6cdc\"><a name=\"setpanestate\"><\/a>Operator: setpanestate<\/h4>\n\n\n\n<p>Syntax: setpanestate &lt;N&gt;,&lt;state of the control&gt;<\/p>\n\n\n\n<p>where N is a number of the control when counting controls between dialogbegin and dialogend statement. Count starts with 1.<\/p>\n\n\n\n<p>This operators sets the control into the specified state. Format of the parameters should match the format of the reply obtained by getpanestate, however certain fields may be altered.<\/p>\n\n\n\n<p>State of the pane is not just short, one token per control information returned by dialogend command. It contains caption of the control, check\/unchecked and enabled\/disabled flags. To learn more about control states, run the script pasted below. Feel free to alternate dialogbegin &#8230; dialogend construct in the main script first, but do not alternate a subroutine &#8220;Tutorial&#8221;<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<pre class=\"wp-block-preformatted\">dialogbegin -100,-100,100,100,\"Test new operators\"\n listbox 5,5,95,65,\"item1\",\"item2\",\"item3\"\n listboxmulti 105,5,195,65,\"item1\",\"item2\",\"item3\"\n static 5,70,195,90,\"This is a static text. \"\n radiobutton 5,105,95,115,\"radiobutton 1\",1\n radiobutton 5,120,95,130,\"radiobutton 2\",0\n checkbox 5,135,95,145,\"Checkbox\",1\n radiobutton 105,105,195,115,\"disabled radiobutton 1\",1,0\n radiobutton 105,120,195,130,\"disabled radiobutton 2\",0,0\n checkbox 105,135,195,145,\"Disabled Checkbox\",1,0\n pushbutton 5,150,95,170,\"Enabled pushbutton\",dontcare,1\n pushbutton 105,150,195,170,\"Disabled pushbutton\",dontcare,0\n pushbutton 20,175,180,195,\"Tutorial: Invoke callback script\"\n callback Tutorial\ndialogend\nreturn\n\nsub Tutorial\n dialogbegin -80,-30,120,10,\"\"\n static 3,3,120,30,\"To see the state of a control enter the number of the control and hit the button\"\n edit 125,3,155,20,\"1\"\n pushbutton 160,3,195,20,\"OK\"\n dialogend &gt;&gt; bHit,...,N,...\n if not(bHit=\"OK\") + (N=\"\")\n return\n endif\n N = unquote(N)\n if not(isnumber(N))\n return\n endif\n getpanestate N &gt;&gt; state\n message \"\"(state)\nendsub<\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n","protected":false},"excerpt":{"rendered":"<p>Dr. Vladimir SamarskiyAdobe System Corporation Page updated 1\/10\/98. [Site no more available]. Besides the standard API commands and queries, PM Scripting Language (PMSL) defines a number of programming statements (refered [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-1740","post","type-post","status-publish","format-standard","hentry","category-pagemaker"],"_links":{"self":[{"href":"https:\/\/meiradarocha.jor.br\/news\/wp-json\/wp\/v2\/posts\/1740","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meiradarocha.jor.br\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meiradarocha.jor.br\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meiradarocha.jor.br\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/meiradarocha.jor.br\/news\/wp-json\/wp\/v2\/comments?post=1740"}],"version-history":[{"count":3,"href":"https:\/\/meiradarocha.jor.br\/news\/wp-json\/wp\/v2\/posts\/1740\/revisions"}],"predecessor-version":[{"id":5641,"href":"https:\/\/meiradarocha.jor.br\/news\/wp-json\/wp\/v2\/posts\/1740\/revisions\/5641"}],"wp:attachment":[{"href":"https:\/\/meiradarocha.jor.br\/news\/wp-json\/wp\/v2\/media?parent=1740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meiradarocha.jor.br\/news\/wp-json\/wp\/v2\/categories?post=1740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meiradarocha.jor.br\/news\/wp-json\/wp\/v2\/tags?post=1740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}