protected Object formatObject(Object object)
    {
        Object formattedObject=object;
        if(object==null)
        {
            formattedObject="";
        }
        else if(object instanceof String)
        {
            //get string
            String string=(String)object;
            
            //remove characters
            string=string.replaceAll("\n","");
            string=string.replaceAll("\r","");
            string=string.replaceAll("\t","");
            string=string.replaceAll("\f","");
            string=string.replaceAll("\b","");
            string=string.replaceAll("'","");
            string=string.replaceAll("\"","");
            
            //get reference
            formattedObject=string;
        }
        else if(object instanceof File)
        {
            //get file
            File file=(File)object;

            String filePath=null;
            try
            {
                filePath=file.getCanonicalPath();
            }
            catch(IOException exception)
            {
                throw new FaxException("Unable to get file path.",exception);
            }
            filePath=filePath.replaceAll("\\\\","\\\\\\\\");
            
            //get reference
            formattedObject=filePath;
        }
        
        return formattedObject;
    }
protected Object formatObject ( Object object ) { Object formattedObject = object ; if ( object == null ) { formattedObject = "" ; } else if ( object instanceof String ) { String string = ( String ) object ; string = string . replaceAll ( "\n" , "" ) ; string = string . replaceAll ( "\r" , "" ) ; string = string . replaceAll ( "\t" , "" ) ; string = string . replaceAll ( "\f" , "" ) ; string = string . replaceAll ( "\b" , "" ) ; string = string . replaceAll ( "'" , "" ) ; string = string . replaceAll ( "\"" , "" ) ; formattedObject = string ; } else if ( object instanceof File ) { File file = ( File ) object ; String filePath = null ; try { filePath = file . getCanonicalPath ( ) ; } catch ( IOException exception ) { throw new FaxException ( "Unable to get file path." , exception ) ; } filePath = filePath . replaceAll ( "\\\\" , "\\\\\\\\" ) ; formattedObject = filePath ; } return formattedObject ; }
This function formats the provided object to enable embedding
in VBS code.

@param   object
The object to format
@return  The formatted object