ArcPad Scripting Object Model
ShowSave Method
See Also  Example  Send comments on this topic.
DefFileName
Optional. A String that represents the Default File Name.
DefExt
Optional. A String that represents the Default Extension.
Filter
Optional. A String that represents the Filter.
Title
Optional. A String that represents the Title.
Flags
Optional. A Long that represents the Flags.
CommonDialog Object : ShowSave Method

Glossary Item Box

Description

Displays the standard Save As dialog box.

Syntax

object.ShowSave ( [DefFileName] [,DefExt] [,Filter] [,Title] [,Flags] )

Parameters

DefFileName
Optional. A String that represents the Default File Name.
DefExt
Optional. A String that represents the Default Extension.
Filter
Optional. A String that represents the Filter.
Title
Optional. A String that represents the Title.
Flags
Optional. A Long that represents the Flags.

Return Type

Variant

Remarks

DefFileName is a string representing the default file name that is initially displayed in the File Name text box. [Optional].

DefExt is a string representing the file extension that is appended to the filename if the user fails to type an extension. This string can be any length, but only the first three characters are appended. The string should not contain a period (.). [Optional].

Filter is string representing the filter pattern(s) that are applied and displayed in the Files of type combo box. Each filter pattern consists of a pair of strings separated by a pipe (|) (for example, "Text Files | *.txt"). The first string describes the filter (for example, "Text Files") and the second string specifies the filter pattern (for example, "*.txt"). To specify multiple filter patterns for a single description string, use a semicolon to separate the patterns (for example, "*.txt;*.doc;*.wpd"). [Optional].

Title is a string representing the dialog caption. "Save As " is used if no title is specified. [Optional].

Flags is a long representing a set of bit flags that can be used to initialize the dialog box. Multiple Flags can be combined using the OR operator. [Optional].

The following Flags are supported:

Flag Description
2 Causes the dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file.
4 Hides the Read Only checkbox.
8 Forces the dialog box to set the current directory to what it was when the dialog box was opened
800 Specifies that the user can enter only valid paths in the File Name text box. If this flag is set and the user enters an invalid path, a warning message is displayed.
1000 Specifies that the user can enter only names of existing files in the File Name text box. If this flag is set and the user enters an invalid file name, a warning is displayed. This flag automatically sets the 8 flag.
2000 Specifies that the dialog box should prompt the user to create a file that does not currently exist.

Example

Imports an existing projection file and allows you to modify the Flattening property. The modified coordinate system is then exported to a new projection file
CoordSys Example (VBScript)Copy Code
Sub ModifyCoordSys
      'Create a CoordSys object
    Dim pCoordSys, strExistingPrjFile
      Set pCoordSys = Application.CreateAppObject ("CoordSys")
    
      'Get an existing projection file via an Open dialog box
    strExistingPrjFile = CommonDialog.ShowOpen ("prj", "Projection Files|*.prj", "Choose Original Projection")
      If Not IsEmpty (strExistingPrjFile) Then
          pCoordSys.Import (strExistingPrjFile)
      Else
          Set pCoordSys = Nothing
            Exit Sub
    End If
      
    'Display the parameters of the selected projection file in a message box
      Application.MessageBox "Projection Name: " & pCoordSys.ProjectionName & apNewLine &_
                "Datum: " & pCoordSys.DatumName & apNewLine &_
              "Geographic Name: " & pCoordSys.GeographicName & apNewLine &_
                "Flattening: " & CStr(pCoordSys.Flattening) & apNewLine &_
              "SemiMajor Axis: " & CStr(pCoordSys.SemiMajorAxis)   _
              , apInformation, pCoordSys.ProjectionName
              
    'Prompt the user for a new Flattening value
      Dim strResponse, blnValid, dblNewFlattening
    blnValid = False
      
    Do Until blnValid
            strResponse = InputBox ("The current Flattening is " & CStr(pCoordSys.Flattening) & Vbcr &_
                                    "Please enter the new Flattening.", "Enter New Flattening", "0")
                                      
              If IsEmpty (strResponse) Then
                    Set pCoordSys = Nothing
                Exit Sub
            End If
          
            If IsNumeric (strResponse) Then
                blnValid = True
            End If
    Loop
      
    dblNewFlattening = CDbl(strResponse)
      
    'Update the Flattening with the one entered by the user
      pCoordSys.Flattening = dblNewFlattening
    pCoordSys.Update
      
    'Let the user know the update was successful
      MsgBox "The coordinate system has been updated. The new projection string is:" & Vbcr &_
                pCoordSys.String, vbInformation, "Coordinate System Updated"
            
      'Export the modified coordinate system to a new projection file
    Dim strNewPrjFile
      strNewPrjFile = CommonDialog.ShowSave ("untitled", "prj", "Projection Files|*.prj", "Save Projection File")
    
      If Not IsEmpty (strNewPrjFile) Then
          pCoordSys.Export (strNewPrjFile)
      End If
    
      'Free resources
    Set pCoordSys = Nothing
End Sub

See Also

© 2012 All Rights Reserved.