Guidance
指路人
g.yi.org
Software / Reginald / Examples / open_script.rex

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
/* Takes the name of a script that the user has marked in
   RPC and loads the script into RPC. To use, perform
   the following steps (the first 2 are one-time only steps) 
   
   Select Macro -> Add a macro.
   Choose this script name (open_script.rex) to add.
   Mark a script name in the current script you're editing.
   Select Macro -> open_script.
*/
OPTIONS "C_CALL NOSOURCE"

/* Raise ERROR for any problems with RPC macro functions */
rexxederr = "ERROR"

DO
	/* You need to first call EditGetDoc() at the beginning of your
	 * macro. This does some bookkeeping to determine what document 
	 * (ie, editor window) the rest of the functions operate upon
	 */
	PATH = editgetdoc()

	/* Get current selection */
	editgettext("temp_name")

	/* Parse out the filename */
	PARSE VAR temp_name.1 temp_name.1 '(' . 
	IF temp_name.1 = "" THEN 
		RAISE ERROR 1 DESCRIPTION "Mark a script name for loading first"

	/* Assume same path as the current document */
	script_name = FILESPEC('D', path) || FILESPEC('P', path) || TRANSLATE(STRIP(temp_name.1))

	/* If no extension, assume a .REX extension */
	IF FILESPEC('E', script_name) == "" THEN script_name = script_name || '.rex'

	/* Open the script in an editor window */
	editopendoc(script_name)
END

CATCH ERROR
	CONDITION("M")
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2017-6-23  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-21 16:44:23