Help and Support

How to Use the Backslash Character in AppleScript Script

Article ID:115815
Last Review:November 17, 2003
Revision:2.0
This article was previously published under Q115815

SUMMARY

The backslash (\) character has a special meaning when it is part of a string in an AppleScript script. The backslash is used to indicate the start of an escape sequence. To use a backslash in an AppleScript string, use two backslashes (\\).

Back to the top

MORE INFORMATION

For example, the following AppleScript script is meant to change the default folder from the main FoxPro folder to the TUTORIAL subfolder.
   tell application "Microsoft FoxPro"
      Do Script "SET DEFAULT TO .\tutorial "
   end tell
				
The \t will be interpreted as a horizontal TAB character that will cause the command to fail without an error message. To correct this problem, the syntax of the AppleScript script should be:
   tell application "Microsoft FoxPro"
      Do Script "SET DEFAULT TO .\\tutorial"
   end tell
				
Depending on what character follows the backslash, three results could occur:
The command will fail without an error message.
The command will fail, causing an error message such as "Unrecognized phrase/keyword in command" in Microsoft FoxPro.
The command will cause an error message such as "Expected "" but found unknown token" in the AppleScript Editor.

Back to the top

REFERENCES

"AppleScript Language Reference," Developer Technical Publications, Apple Computer, 1993

Back to the top


APPLIES TO
Microsoft FoxPro 2.5b for Macintosh
Microsoft Visual FoxPro 2.5c for Macintosh
Microsoft Visual FoxPro 3.0b for Macintosh

Back to the top

Keywords: 
KB115815

Back to the top

Article Translations

 

Other Support Options

  • Contact Microsoft
    Phone Numbers, Support Options and Pricing, Online Help, and more.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.