SelectedFilePattern()

Syntax

Result = SelectedFilePattern()
Description
Returns the selected pattern index chosen with OpenFileRequester() or SaveFileRequester().

Parameters

None.

Return value

The selected pattern index chosen with OpenFileRequester() or SaveFileRequester(). The first pattern is at position 0.

Example

  StandardFile$ = "C:\autoexec.bat"        ; initial path + file
  Pattern$ = "Text (*.txt)|*.txt;*.bat|"   ; set first pattern  (index = 0)
  Pattern$ + "PureBasic (*.pb)|*.pb|"      ; set second pattern (index = 1)
  Pattern$ + "Bmp (*.bmp)|*.bmp|"          ; set third pattern  (index = 2)
  Pattern$ + "Jpeg (*.jpg)|*.jpg|"         ; set fourth pattern (index = 3)
  Pattern$ + "All files (*.*)|*.*"         ; set fifth pattern  (index = 4)
  Pattern = 1    ; use the second of the five possible patterns as standard

  ; Now we open a filerequester, you can change the pattern and will get the index after closing
  File$ = OpenFileRequester("Please choose file to load", StandardFile$, Pattern$, Pattern)
  Index = SelectedFilePattern()
  If Index > -1
    MessageRequester("Information", "Following pattern index was selected: "+Str(Index), 0)
  Else
    MessageRequester("Information", "The requester was canceled.", 0)
  EndIf

Supported OS

All

<- SaveFileRequester() - Requester Index - SelectedFontColor() ->