Share this page 

Generate a unique filenameTag(s): Powerscript


[function declaration]
FUNCTION integer GetTempFileNameA  &
   (ref string tempdir, ref string prefix, & 
    integer seed, ref string tempfile )&
    LIBRARY "kernel32"

[powerscript]
integer li_rc 
string ls_tempdir = "c:\temp"
string ls_prefixe = "app"
integer li_seed = 0
string ls_filename

ls_filename = space(256)
li_rc = GetTempFileNameA(ls_tempdir, ls_prefixe, li_seed, ls_filename)
IF li_rc = 0 THEN
   MessageBox("Oups", "Error")
ELSE
   MessageBox("Unique filename", ls_tempfile)
END IF