4D v16.3

CREATE ALIAS

Home

 
4D v16.3
CREATE ALIAS

CREATE ALIAS 


 

CREATE ALIAS ( targetPath ; aliasPath ) 
Parameter Type   Description
targetPath  String in Name or access path of the alias/shortcut target
aliasPath  String in Name or full pathname for the alias or shortcut

The CREATE ALIAS command creates an alias (named “shortcut” under Windows) for the target file or folder passed in targetPath. The name and location are defined by the targetPath parameter.

An alias can be made for any kind of document or folder. The alias icon will be the same as the target item. The icon contains a small arrow at the bottom left side. Under Mac OS, the icon name is also displayed in italics characters.

This command does not assign a name by default, the name has to be passed in the aliasPath parameter. If just a name is passed in this parameter, the alias is created in the current working folder (usually the folder containing the structure file).

Note: Under Windows, the shortcuts are designated by a “.LNK” extension (invisible). If this extension is not passed, it is automatically added by the command.

If an empty string is passed in the targetPath, the command does nothing.

Example  

Your database generates text files called “Report Number” sorted in the database folder. The user would like to create shortcuts to these reports and to store them at a convenient location:

  `Method CREATE_REPORT
 C_TEXT($vtRport)
 C_STRING(250;$vtpath)
 C_STRING(80;$vaname)
 C_TIME(vDoc)
 C_INTEGER($ReportNber)
 
 $vTReport:=... `Create report
 $ReportNber:=... `Compute the report number
 $vaName:="Report"+String($ReportNber)+".txt" `File name
 vDoc:=Create document($vaName)
 If(OK=1)
    SEND PACKET(vDoc;$vTReport)
    CLOSE DOCUMENT(vDoc)
  `Add the alias
    CONFIRM("Create an alias for this report?")
    If(OK=1)
       $vtPath:=Select folder("Where do you want the alias to be created?")
       If(OK=1)
          CREATE ALIAS($vaName;$vtPath+$vaName)
          If(OK=1)
             SHOW ON DISK($vtPath+$vaName)
  `Show the alias location
          End if
       End if
    End if
 End if

The OK system variable is set to 1 if the command execution was successful; otherwise it is set to 0.



See also 

RESOLVE ALIAS

 
PROPERTIES 

Product: 4D
Theme: System Documents
Number: 694

The OK variable is changed by the commandThis command can be run in preemptive processes

 
HISTORY 

Created: 4D v6.7

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)