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

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

  
/* *****************************************************************
 * SHORTCUT.REX
 *
 * Tests MAKESHORTCUT(). Also uses Reginald's Proprietary SEARCHPATH().
 * If using another interpreter, you can use the FILE REXX add-on DLL
 * for FileSearchPath() instead.
 ****************************************************************** */

/*
 * This program demonstrates how to create a Desktop Folder and Shortcut.
 * We'll create a Shortcut to Notepad.exe and put it in a newly created
 * Desktop Folder called 'Text Editors'.
 */

/* Get the DESKTOP location */
desktop = SEARCHPATH('%DESKTOP%') || 'Text Editors'

/* Create a folder on the Desktop called 'Text Editors' */
err = DIR(desktop, 'C')
IF err == "" THEN DO

   /* Get the Windows directory */
   win = SEARCHPATH('%WIN%')

   /* Create a shortcut to Notepad.exe (assumed to be in the Windows directory)
    * and put it in that 'Text Editors' folder
    */
   err = RXMAKESHORTCUT(win || 'Notepad.exe', desktop || '\Notepad.lnk', 'A simple text editor', SEARCHPATH('%DOCS%'))

   IF err \== "" THEN DO
      RXSAY('Error creating the shortcut: ' || err || '0D0A'x || "Press ENTER to end")
   END
   ELSE DO
      RXSAY('There is now a Shortcut to Notepad on your Desktop in the Text Editors folder.' || ,
	   '0D0A'x || 'Check it out,  then click OK to remove that Shortcut/Folder.', 'OK|INFO')

      /* Delete the Shortcut */
      err = DELETEFILE(desktop || '\Notepad.lnk')

      /* Delete the Folder (which will fail if its not empty) */
      err = DIR(desktop, 'D')
   END
END
ELSE DO
   RXSAY('Error creating Text Editors folder: ' || err || '0D0A'x || "Press ENTER to end")
END
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2017-6-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-08-27 06:46:25