AMSWCommonDialogs is an action plugin that have some common dialogs.
CommonDialogs.Color
CommonDialogs.File
CommonDialogs.Font
CommonDialogs.PickIcon
CommonDialogs.Close
Opens the standard requester to choose a color. The chosen color is returned under a 24 bit number containing the red, green and blue value, as usual.
(number) DefaultColor.
A table containing some field that stored some information of selected color. fields are ('R', 'G', 'B', 'Dec').If the user cancels the operation (presses the cancel button), nil will be returned instead of table.
result = CommonDialogs.Color(1024);
if result ~= nil then
Dialog.Message("Color", "Red: "..result.R.."\r\nGreen: "..result.G.."\r\nBlue: "..result.B.."\r\nDecimal: "..result.Dec);
end
Presents a file browse dialog to the user to collect the paths to one or more files.
(boolean) Whether to make the dialog a "file open" dialog.
(string) The text to be displayed on the dialog title bar.
(string) The default folder to browse.
(string) The file type filters that will be used in the browse. Defaults to "All Files (*.*)|*.*|".
(string) The file name that initially appears in the file name edit box.
(string) The default file extension. This will be appended to the filename in the file name edit box if the user does not supply an extension.
(boolean) Whether to allow multiple selection of files.
(strin) this function return a string containing file(s) with Delimiter ("|") for convert it into table you must use some function like "DelimitedStringToTable", if user presed cancel function return "CANCEL". for more perception See below example.
function DelimitedStringToTable(DelimitedString, Delimiter)
tbReturn = {};
local strWorking;
local nPos = nil;
local strData;
local nTableIndex = 1;
local nDelimiterLength = String.Length(Delimiter);
if(nDelimiterLength < 1)then
tbReturn[nTableIndex] = DelimitedString;
return tbReturn;
end
strWorking = DelimitedString;
nPos = String.Find(strWorking,Delimiter);
while(nPos ~= -1)do
strData = String.Left(strWorking,nPos-1);
tbReturn[nTableIndex] = strData;
nTableIndex = nTableIndex + 1;
local nLength = String.Length(strWorking);
strWorking = String.Right(strWorking,nLength - (nPos + (nDelimiterLength-1)));
nPos = String.Find(strWorking,Delimiter);
end
if(strWorking ~= "")then
tbReturn[nTableIndex] = strWorking;
end
return tbReturn;
end
files = CommonDialogs.File(true, "Open File", _ProgramFilesFolder, "Text File (*.txt)|*.txt|All Files(*.*)|*.*|", "", "txt", true);
if files ~= "CANCEL" then
files = DelimitedStringToTable(files, "|")
Debug.Clear()
Debug.ShowWindow(true)
for a, b in files do
Debug.Print(b.."\r\n")
end
end
files = CommonDialogs.File(false, "Save File", _ProgramFilesFolder, "Text File (*.txt)|*.txt|All Files(*.*)|*.*|", "", "", false); if files ~= "CANCEL" then Debug.Clear() Debug.ShowWindow(true) Debug.Print(files) end
Opens the standard requester to choose a font.
(string) DefaultName of Font.
(number) DefaultSize of font.
(boolean) if this parameter is true then color box is shown in font dialog.
A table containing some field that stored some information of selected Font. fields are ('Name', 'Size', 'Regular', 'Italic', 'Bold', 'StrikeOut', 'Underline', 'Color').If the user cancels the operation (presses the cancel button), nil will be returned instead of table.
result = CommonDialogs.Font("Arial", 12, true);
if result ~= nil then
Debug.Clear()
Debug.ShowWindow(true)
Debug.Print("Font Name is "..result.Name.."\r\n")
Debug.Print("Font Size is "..result.Size.."\r\n")
if result.Regular == true then
Debug.Print("Font is Regular\r\n")
end
if result.Italic == true and result.Bold == false then
Debug.Print("Font is Italic\r\n")
end
if result.Bold == true and result.Italic == false then
Debug.Print("Font is Bold\r\n")
end
if result.Bold == true and result.Italic == true then
Debug.Print("Font is Bold Italic\r\n")
end
if result.StrikeOut == true then
Debug.Print("Font is StrikeOut\r\n")
end
if result.Underline == true then
Debug.Print("Font is Underline\r\n")
end
if result.Color ~= nil then
Debug.Print("Font Color is "..result.Color.."\r\n")
end
end
Opens the standard requester to choose an icon in a moudle.(dll, exe, sys, ...)
(string) File That you want open it.
(number) index of .
(string) Address of Extracted icon(if you want icon not extracted just fill it blank "").
two variable one string for File Path and one number for index of icon that selected, if user select Cancel First Variable is CANCEL.(See Example)
-- two vaiable :
-- 1st return variable filen string : filen
-- 2st return variable filen number : index
filen, index = CommonDialogs.PickIcon("C:\\windows\\system32\\shell32.dll", 1, "");
if filen ~= "CANCEL" then
Dialog.Message("", filen.. "," .. index)
end
Close Application (On Windows Vista Required, use it on XP is optional but we recomonded it on all os).
Nothing.
use this function important on windows vista, Use this function in the end of your codes in 'On Close' of Page, use this function in the end of your codes this is important because codes after this function never executed.
-- On Close -- Some code -- Some code -- Some code CommonDialogs.Close()
AMSWaves Corporation
support@AMSWaves.com
Plugin is copyright © 2008-2009 AMSWaves Design Corporation.
Copyright © 2009 AMSWaves Design Corporation.
All Rights Reserved.