Bcc.GetActiveDocumentName()

Bcc.GetActiveDocumentName(Option)

Description

This function is utilized to get the current document name and/or file path

Parameters

The primary input of this function can be either a string or an integer which both have the same meanings.


String Option

  • FullPath
  • NoPathHasExt
  • NoPathNoExt
  • HasPathNoExt
  • ExtOnly


Integer Option

  • 1 - "Full Path"
  • 2 - "NoPathHasExt"
  • 3 - "NoPathNoExt"
  • 4 - "HasPathNoExt"
  • 5 - "ExtOnly"

Return

With no input parameters this function will return the string containing the full path with file extension


Based on the input option parameter the return will give all cases of either the full file path, just the file name with extension, just the name, etc.

Examples

String Input Parameter

For these examples let's assume your document is saved to the C: drive and is named BobCAD1.bbcd


-- Get the full file path with document name and extension

-- OUTPUT: C:\BobCAD1.bbcd

Bcc.ShowMessageBox(Bcc.GetActiveDocumentName())


-- Get the full file path with document name and extension

-- OUTPUT: C:\BobCAD1.bbcd

Bcc.ShowMessageBox(Bcc.GetActiveDocumentName("FullPath"))


-- Get just the document name and extension

-- OUTPUT: BobCAD1.bbcd        

Bcc.ShowMessageBox(Bcc.GetActiveDocumentName("NoPathHasExt"))


-- Get the document name with no extension

-- OUTPUT: BobCAD1        

Bcc.ShowMessageBox(Bcc.GetActiveDocumentName("NoPathNoExt"))


-- Get the full file path with document name and extension

-- OUTPUT: C:\BobCAD1        

Bcc.ShowMessageBox(Bcc.GetActiveDocumentName("HasPathNoExt" ))


-- Get the extension of the file

-- OUTPUT: .bbcd        

Bcc.ShowMessageBox(Bcc.GetActiveDocumentName("ExtOnly"))        

       

Integer Input Parameter

The following examples will generate the same output as above but instead you can use the integer values


-- Get the full file path with document name and extension

-- OUTPUT: C:\BobCAD1.bbcd

Bcc.ShowMessageBox(Bcc.GetActiveDocumentName(1))


-- Get just the document name and extension

-- OUTPUT: BobCAD1.bbcd                

Bcc.ShowMessageBox(Bcc.GetActiveDocumentName(2))


-- Get the document name with no extension

-- OUTPUT: BobCAD1        

Bcc.ShowMessageBox(Bcc.GetActiveDocumentName(3))


-- Get the full file path with document name and extension

-- OUTPUT: C:\BobCAD1        

Bcc.ShowMessageBox(Bcc.GetActiveDocumentName(4))


-- Get the extension of the file

-- OUTPUT: .bbcd                

Bcc.ShowMessageBox(Bcc.GetActiveDocumentName(5))