View Full Version : Help status dialog
mustafa06
02-04-2008, 04:13 PM
Code :
File.Copy("C:\\1.zip", "D:\\", true, true, false, true, ZipCallBackFunction);
I want :
İf 1.zip copying D:\ ı want the show status dialog 1.zip copying D:\ and ı want show progress bar on status dialog
Ty ;)
mustafa06
02-05-2008, 04:05 AM
why anybody dont help me :huh
mustafa06
02-05-2008, 09:39 AM
:huh :huh :huh
RizlaUK
02-05-2008, 09:41 AM
sorry mus, i got tied up with things yesterday
useing the status dialog is as simple as:
StatusDlg.Show(MB_ICONINFORMATION, false);
File.Copy(strSource, strDest, true, true, false, true, nil);
StatusDlg.Hide();
but heres my revamp of the file copy function that uses the status dialog
-- CopyFile(string SourceFilePath,string DestFolderPath)
function CopyFile(strSource,strDest)
-- check for source file, if none passed then show file dialog
if strSource == "" then
tbSource = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Files (*.*)|*.*|", "", "dat", false, false);
if tbSource[1] ~= "CANCEL" then
strSource = tbSource[1]
else
-- the user cancled so do nothing
Application.ExitScript();
end
end
-- check for dest folder, if none passed then show folder dialog
if strDest == "" then
strDest = Dialog.FolderBrowse("Please select a folder:", _DesktopFolder);
if strDest == "CANCEL" then
-- the user cancled so do nothing
Application.ExitScript();
end
end
-- now make sure we have our source and dest
if strSource ~= "" and strDest ~= "" then
StatusDlg.ShowCancelButton(true, "Cancel");
StatusDlg.Show(MB_ICONINFORMATION, false);
File.Copy(strSource, strDest, true, true, false, true, nil);
-- Test for error
error = Application.GetLastError();
StatusDlg.Hide();
if (error ~= 0) then
if error == 1027 then-- dont inform of a "user cancel" error
File.Delete(strDest.."\\"..String.SplitPath(strSource).Filename..String.Spl itPath(strSource).Extension, false, false, false, nil);
else
Dialog.Message("Error: "..error, _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
end
end
end
end
-- Call with empty strings ("") to show dialogs else pass file/folder paths
-- Example Call 1, will show file browse dialog and folder browse dialog
CopyFile("","")
-- Example Call 2, will show a folder browse dialog and copy "Myfile.exe" to the selected folder
CopyFile("AutoPlay\\Docs\\Myfile.exe","")
-- Example Call 3, will show a folder browse dialog and copy "Myfile.exe" to the the users desktop folder
CopyFile("AutoPlay\\Docs\\Myfile.exe",_DesktopFolder)
hope that helps
mustafa06
02-05-2008, 11:01 AM
sorry mus, i got tied up with things yesterday
useing the status dialog is as simple as:
StatusDlg.Show(MB_ICONINFORMATION, false);
File.Copy(strSource, strDest, true, true, false, true, nil);
StatusDlg.Hide();
but heres my revamp of the file copy function that uses the status dialog
-- CopyFile(string SourceFilePath,string DestFolderPath)
function CopyFile(strSource,strDest)
-- check for source file, if none passed then show file dialog
if strSource == "" then
tbSource = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Files (*.*)|*.*|", "", "dat", false, false);
if tbSource[1] ~= "CANCEL" then
strSource = tbSource[1]
else
-- the user cancled so do nothing
Application.ExitScript();
end
end
-- check for dest folder, if none passed then show folder dialog
if strDest == "" then
strDest = Dialog.FolderBrowse("Please select a folder:", _DesktopFolder);
if strDest == "CANCEL" then
-- the user cancled so do nothing
Application.ExitScript();
end
end
-- now make sure we have our source and dest
if strSource ~= "" and strDest ~= "" then
StatusDlg.ShowCancelButton(true, "Cancel");
StatusDlg.Show(MB_ICONINFORMATION, false);
File.Copy(strSource, strDest, true, true, false, true, nil);
-- Test for error
error = Application.GetLastError();
StatusDlg.Hide();
if (error ~= 0) then
if error == 1027 then-- dont inform of a "user cancel" error
File.Delete(strDest.."\\"..String.SplitPath(strSource).Filename..String.Spl itPath(strSource).Extension, false, false, false, nil);
else
Dialog.Message("Error: "..error, _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
end
end
end
end
-- Call with empty strings ("") to show dialogs else pass file/folder paths
-- Example Call 1, will show file browse dialog and folder browse dialog
CopyFile("","")
-- Example Call 2, will show a folder browse dialog and copy "Myfile.exe" to the selected folder
CopyFile("AutoPlay\\Docs\\Myfile.exe","")
-- Example Call 3, will show a folder browse dialog and copy "Myfile.exe" to the the users desktop folder
CopyFile("AutoPlay\\Docs\\Myfile.exe",_DesktopFolder)
hope that helps
ty too :yes you are very crazy man ;) :lol
mustafa06
02-05-2008, 12:34 PM
Code :
StatusDlg.Show(MB_ICONINFORMATION, false);
function CopyFile(strSource,strDest)
-- check for source file, if none passed then show file dialog
if strSource == "" then
tbSource = Input.GetText("b");
if tbSource ~= "CANCEL" then
strSource = tbSource
else
-- the user cancled so do nothing
Application.ExitScript();
end
end
-- check for dest folder, if none passed then show folder dialog
if strDest == "" then
strDest = Input.GetText("a");
if strDest == "CANCEL" then
-- the user cancled so do nothing
Application.ExitScript();
end
end
-- now make sure we have our source and dest
if strSource ~= "" and strDest ~= "" then
StatusDlg.ShowCancelButton(true, "Cancel");
StatusDlg.Show(MB_ICONINFORMATION, false);
File.Copy(strSource, strDest, true, true, false, true, nil);
-- Test for error
end
end
-- Call with empty strings ("") to show dialogs else pass file/folder paths
-- Example Call 1, will show file browse dialog and folder browse dialog
CopyFile("","")
-- Example Call 2, will show a folder browse dialog and copy "Myfile.exe" to the selected folder
CopyFile("","")
-- Example Call 3, will show a folder browse dialog and copy "Myfile.exe" to the the users desktop folder
CopyFile("","")
End
Red Text : ı change orjinal code
Im write input ( obj : a ) = _DesktopFolder
Im write input ( obj : b ) = C:\\1.rar
But doesnt copy why ? I dont want FileBrowse :huh
Orjinal Code :
StatusDlg.Show(MB_ICONINFORMATION, false);
function CopyFile(strSource,strDest)
-- check for source file, if none passed then show file dialog
if strSource == "" then
tbSource = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Files (*.*)|*.*|", "", "dat", false, false);
if tbSource[1] ~= "CANCEL" then
strSource = tbSource[1]
else
-- the user cancled so do nothing
Application.ExitScript();
end
end
-- check for dest folder, if none passed then show folder dialog
if strDest == "" then
strDest = Dialog.FolderBrowse("Please select a folder:", _DesktopFolder);
if strDest == "CANCEL" then
-- the user cancled so do nothing
Application.ExitScript();
end
end
-- now make sure we have our source and dest
if strSource ~= "" and strDest ~= "" then
StatusDlg.ShowCancelButton(true, "Cancel");
StatusDlg.Show(MB_ICONINFORMATION, false);
File.Copy(strSource, strDest, true, true, false, true, nil);
-- Test for error
end
end
-- Call with empty strings ("") to show dialogs else pass file/folder paths
-- Example Call 1, will show file browse dialog and folder browse dialog
CopyFile("","")
-- Example Call 2, will show a folder browse dialog and copy "Myfile.exe" to the selected folder
CopyFile("","")
-- Example Call 3, will show a folder browse dialog and copy "Myfile.exe" to the the users desktop folder
CopyFile("","")
File.Copy(strSource, strDest, true, true, false, true, nil);
End
RizlaUK
02-05-2008, 01:29 PM
mus, its all in the explanation
CopyFile("Path to your file here","path to dest folder here")
if you pass empty strings it will show dialogs.
RizlaUK
02-05-2008, 01:35 PM
Im write input ( obj : a ) = _DesktopFolder
you cannot write "_DesktopFolder" in a input and expect AMS to use is as a variable, it returns a string, so to AMS it looks like "\"_DesktopFolder\""
you need to enter the full path !!
mustafa06
02-05-2008, 01:54 PM
you cannot write "_DesktopFolder" in a input and expect AMS to use is as a variable, it returns a string, so to AMS it looks like "\"_DesktopFolder\""
you need to enter the full path !!
Ok finished now work my options.. ty too for help me :yes ;)
RizlaUK
02-05-2008, 04:22 PM
Ok finished now work my options.. ty too for help me :yes ;)
anytime mus, glad you got it sorted
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.