Indigo Rose Software

Go Back   Indigo Rose Software Forums > Setup Factory 8.0 > Setup Factory 8.0 FAQ

Reply
 
Thread Tools Display Modes
  #1  
Old 04-28-2008
Adam's Avatar
Adam Adam is offline
Indigo Rose Staff Member
 
Join Date: May 2000
Location: Indigo Rose Software
Posts: 2,154
Why do I have to use double backslashes in code?

Question
Why do I have to use double backslashes in code?

Answer
In windows, specifically when working with files, backslashes ("\\") are used repeatedly. Whether separating folders, filenames, or drives, there is no way to reference files without making use of backslashes, in one form or another.

Backslashes are equally important in Setup Factory. But in order to use backslashes correctly, the difference between the single backslash ("\") and double backslash ("\\") must be understood. In Windows paths, the various parts are separated by a single backslash. This is true 100% of the time when dealing with local paths. In setup factory, paths are treated the exact same way.

However, in setup factory, whenever a path is referenced WITHIN A STRING, a double backslash must be used. This is because in setup factory, the backslash has two purposes. The first is the same as windows, to separate the various parts of a path. The second purpose is to act as an 'escape character' from within strings, to perform various functions that cannot be accomplished within a string using regular letters and numbers, such as a line break.

With that in mind, the following string within setup factory:
"C:\New_Files"
In reality translates into the following:
c:ew_files

This is because "\n" translates into a 'new line' command within a string. To insert the path 'c:\New_Files' into a string, the format is as follows:
"C:\\New_Files"

The double backslash within a string translates into a single backslash outside of a string.

It is important to keep in mind, however, that when you are not using a backslash in script, you only need to use a single backslash. This applies to, for example, using backslashes in screen controls and session variables. You only have to use a double backslash when entering backslashes INTO SCRIPT, where the backslashes are stored in STRINGS.

For more information please see the following topics in the Setup Factory help file:

Windows Basics | Files, Folders and Paths | Paths

Last edited by Adam; 04-29-2008 at 01:15 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP script for coupon code downloading Tek Developer's Den 17 07-02-2009 02:26 PM
Article: Using Authenticode Code Signing Certificates Ted Sullivan Setup Factory 8.0 Examples 4 10-31-2007 10:03 AM
Progress Bars screen, On Start code is skipped AxemanMK Setup Factory 7.0 Discussion 7 09-21-2006 03:15 PM
which is better for date code check? tcoulson Developer's Den 9 03-07-2006 09:07 AM
Looking for those interested in Machine Code Protocol General Chat 13 05-17-2004 06:56 PM


All times are GMT -6. The time now is 06:20 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software