I want to search for a folder on the driver for example C to copy the file on that folder AppData
any suggestions, please
any suggestions, please
Code:
-- Set the callback function (used by action Folder.Find) function FindCallBack(CurrentFolder) -- Show the cancel button StatusDlg.ShowCancelButton(true, "Cancel"); -- Set the status dialog title, message, and status text StatusDlg.SetTitle("بحث عن البرنامج . . . "); StatusDlg.SetMessage("الرجاء الإنتظار. جارى البحث."); StatusDlg.SetStatusText("Current Folder: " .. CurrentFolder); -- Check if the user pressed cancel cancel = StatusDlg.IsCancelled(); if cancel then -- Cancel was pressed, stop the current operation return false; else -- Cancel was not pressed, continue return true; end end -- Set the drive to search drive = "C:\\Users"; -- Set the folder to search for folder = "Movavi Screen Recorder 21"; -- Search the specified drive for folders named "Offline Commander" -- Display the status dialog StatusDlg.Show(0, false); search_results = Folder.Find(drive, folder, true, FindCallBack); --Check to see if an error occurred during the search. If it did, display the error message. error = Application.GetLastError(); StatusDlg.Hide(); if error ~= 0 then Dialog.Message("Error",_tblErrorMessages[error]); else -- If no directories were found, inform the user if (search_results == nil) then Dialog.Message("ملاحظة", "البرنامج غير منصب على الجهاز '" .. folder .. "' on drive '" .. drive .. "'."); -- Check if the user pressed cancel cancel = StatusDlg.IsCancelled(); if cancel then -- Cancel was pressed, stop the current operation return false; else -- Cancel was not pressed, continue return true; end -- If folders were found, display a dialog containing a list of their locations. else message = " ويمكنك نسخ الملف'" .. folder .. "'البرنامج منصب على الجهاز(s):\r\n\r\n"; for index, path in pairs(search_results) do message = String.Concat(message, path.."\r\n"); end message = " ويمكنك ويمكنك نسخ الملف'" .. folder .. "'البرنامج منصب على الجهاز(s):\r\n\r\n"; end end result = Dialog.Message("تأكيد أن البرنامج الملف", "طريقة إستخدام الملف\r\n1- نصب البرنامج أولا\r\n2- إغلق البرنامج\r\n3- إستخدم الملف", MB_OKCANCEL, MB_ICONQUESTION, MB_DEFBUTTON2); if result == IDOK then File.Copy("AutoPlay\\Docs\\MOVAVI SCREEN RECORDER\\fix\\ScreenRecorder.exe", "C:\\Users\SALEM\\AppData\Roaming\\Movavi Screen Recorder 21", true, true, false, true, nil); Dialog.Message("إستبدال الملف", "تم نسخ الملف", MB_OK, MB_ICONINFORMATION); end
Comment