 _______                ______   __       ___     _______
|   _   |-----.--------.   _  \ |  |-----.   |   |   _   |
|.  1___|  _  |        |.  |   \|  |  _  |.  |   |   1___|
|.  |___|_____|__|__|__|.  |    \__|___  |.  |___|____   |
|:  1   |              |:  1    /  |_____|:  1   |:  1   |
|::.. . |   v 0.7      |::.. . /         |::.. . |::.. . |
`-------'              `------'          `-------'-------'

Common Dialog support for LiteStep
by RabidCow (rabidcow@juno.com)

This provides bang commands to display and get results from:
 - File Open Dialog
 - Browse For Folder Dialog
 - Font Selection Dialog
 - Color Selection Dialog

There are no step.rc settings.

Bang commands:

!ComDlgFile [optional command]
!ComDlgFont [optional command]
!ComDlgFolder [optional command]
!ComDlgColor [optional command]

These display the requested dialog.  If the optional command is specified,
it is executed if the user clicks the OK button.  If the user cancels the
dialog, this command will not be executed.  (This is currently the only
way to tell if they clicked cancel.)

Example:  !ComDlgFile !alert "^@fp^"


!ComDlgExec [command]

This will execute a command with ^@var^ replacement using data from the
last dialog box.  The command is always executed, even if the data is
invalid.  This is probably most useful when you need to get a lot out
of the dialog (which you can't really do yet anyway) and call it from
within a script.

Example:
  !ComDlgFile
  !ComDlgExec !alert "^@fp^"

Also:
  *script bang !EditDaStuff
  *script exec !ComDlgExec notepad.exe "^@fp^"
  *script ~bang

  !ComDlgFile !EditDaStuff


!ComDlgSetTitle title

This will set the title string for File Open and Browse For Folder dialogs.
(Browse For Folder seems to have a strange idea of title...)


!ComDlgSetColor color

This will set the initial color for the color selection dialog.


!ComDlgSetName name

This will set the name for something.  Probably doesn't work right now.



Variables:

The names are roughly abbreviations,
  F = File
  D = folder/Directory
  C = color
  T = font (think Text/True type)

^@cc^ selected color
^@fd^ file directory
^@fn^ file name
^@fp^ file path (directory + name, same as ^@fd^^@fn^)
^@dn^ directory name
^@dp^ directory path
^@tn^ font name
^@ts^ font size (pts*10)

^@#a^ apostrophe '
^@#c^ caret ^ (for nested ^@var^ calls)
^@#d^ dollar $ (use for late $var$ evaluation and math)
^@#n^ newline
^@#q^ double quote "


More examples:

browse for and open a file:
   !ComDlgFile "^@fp^"


select a font and display it:
   !ComDlgFont !alert "Font: ^@tn^^@#n^Size: ^@#d^^@ts^/10^@#d^"
If you choose 12 point Verdana, this will bring up an alert box with:
  Font: Verdana
  Size: 12
If you do this instead:
   !ComDlgFont !alert "Font: ^@tn^^@#n^Size: ^@ts^"
You would get: (because ^@ts^ is point size * 10)
  Font: Verdana
  Size: 120


Make a skinbox display a chosen color:
   !ComDlgColor !SkinBoxColor test ^@cc^


Hm, I think most things you'd use this for will require textedit or
something, but I've never used it, so unfortunately I cannot give
examples of that.


To do:
- allow setting filters for file open
- allow file save (whatever the difference is)
- allow setting custom colors (maybe saving too)
- allow reading/setting font style
- allow other flags to be set (there's something like 50 of them)
- eat peach cobbler
- make the setname thing work right
- fix all the freak cases that Windows throws at us
  (shortcuts, pidls that don't have a string name...)


Source code:

If you want to finish/add something or just have a look, email me
and I'll send you the source.  It's nothing special, mostly just
patched-together bits from lsnothing and skinbox.


