OpenFileDialog box

I I work on a project consisting in copying whatever their names all the files found in a Windows folder and placing them in another folder by reversing them File1, File2, etc.
It seems to me that I can’t do that with the simulator. But with the os.execute code I only manage to copy a single known file while reversing it. It seems that plugin_tinyfiledialogs can do that but it is not up to date and the simulator does not find it.
Any ideas ?

This is possible in C, C#, C ++ but I don’t know how to call a module written in C ++ or C# in LUA.

Not sure what you mean by “reversing”, but I do copy files from folder in pathA to folder in pathB using xcopy via os.execute.

You can also do it with Lua’s io lib in combination with lfs lib. I just chose the OS to handle it as it’s faster that way.

What does your build.settings look like? And are you doing local tinyfiledialogs = require("plugin.tinyfiledialogs")?

here is what I do

os.execute(" move c:\\Users\\Admin\\Desktop\\CCE\\video3.mp4 c:\\CCE_class\\ns1_data\\file3.mp4 ")

I can’t copy all file in CCE folder at same time by renaming them to file1.mp4, file2.mp4 and file3.mp4

I try the sample project found in the documentation:
Documentation (ggcrunchy.github.io)

Hmm, I was able to run the sample just now on both Windows and Mac.

Is it possible you just copied main.lua and tried to run that on its own? You will need the line in build.settings; in particular, what you need is:

settings =
{
  plugins = {
    ["plugin.tinyfiledialogs"] = { publisherId = "com.xibalbastudios" }
  }
}

(The docs omit the settings table, which could be misleading, I suppose.)

could you give me an example ?

16:00:50.413 Solar2D Simulator 2021.3657 (Sep 30 2021 23:21:08)
16:00:50.413
16:00:50.413
16:00:50.413 Copyright (C) 2009-2021 C o r o n a L a b s I n c .
16:00:50.413 Version: 3.0.0
16:00:50.413 Build: 2021.3657
16:00:50.413 Platform: SM-G900S / x64 / 10.0 / Intel(R) Iris(R) Xe Graphics / 4.6.0 - Build 30.0.101.1692 / 2021.3657 / en_US | US | en_US | en
16:00:50.413 Loading project from: C:\Users\Steeve\Documents\Corona Projects\tinyfile_dialogs
16:00:50.413 Project sandbox folder: C:\Users\Steeve\AppData\Local\Corona Labs\Corona Simulator\Sandbox\tinyfile_dialogs-F53EB61CF9C5DA1F741B31C6FE626F56\Documents
16:00:50.429 Collecting plugins {“continueOnError”:true,“extractLocation”:“C:\Users\Steeve\AppData\Roaming\Corona Labs\Corona Simulator\Plugins”,“customCollectorsDir”:“C:\Users\Steeve\AppData\Roaming\Solar2DPlugins\Collectors”,“ignoreMissingMarker”:“IgnoreMissing”,“pluginLocators”:[<Collector: Custom URL Locator>,<Collector: Local File System Versionized>,<Collector: Local File System Per Platform>,<Collector: Local File System Per Platform Versionized>,<Collector: Solar2d Marketplace Directory>,<Collector: Solar2D Free Directory>,<Collector: Missing Marker>],“destinationDirectory”:“C:\Users\Steeve\AppData\Roaming\Corona Labs\Corona Simulator\Plugins”,“plugins”:{“plugin.tinyfiledialogs”:{“publisherId”:“com.xibalbastudios”}},“pluginStorage”:“C:\Users\Steeve\AppData\Roaming\Solar2DPlugins”,“pluginPlatform”:“win32-sim”,“build”:“3657”}
16:00:57.579 Solar2D Directory: cache hit plugin.tinyfiledialogs
16:00:57.579 Running command copy “C:\Users\Steeve\AppData\Roaming\Solar2DPlugins\Caches\Solar2Directory\solar2d\com.xibalbastudios\plugin.tinyfiledialogs\win32-sim\data.tgz” “C:\Users\Steeve\AppData\Roaming\Corona Labs\Corona Simulator\Plugins\plugin.tinyfiledialogs”
16:00:57.611 Located plugin.tinyfiledialogs with locator Solar2D Free Directory
16:00:57.611 Collecting plugin dependencies
16:00:57.611 Running command “”%CORONA_PATH%\7za.exe" x “C:\Users\Steeve\AppData\Roaming\Corona Labs\Corona Simulator\Plugins\plugin.tinyfiledialogs\data.tgz” -so 2> nul | “%CORONA_PATH%\7za.exe” x -aoa -si -ttar -o"C:\Users\Steeve\AppData\Roaming\Corona Labs\Corona Simulator\Plugins" 2> nul "
16:00:57.698 ERROR: Runtime error
16:00:57.698 error loading module ‘plugin_tinyfiledialogs’ from file ‘C:\Users\Steeve\AppData\Roaming\Corona Labs\Corona Simulator\Plugins\plugin_tinyfiledialogs.dll’:
16:00:57.698 The specified module could not be found.
16:00:57.698
16:00:57.698 stack traceback:
16:00:57.698 [C]: ?
16:00:57.698 [C]: in function ‘require’
16:00:57.698 D:\a\corona\corona\platform\resources\init.lua:931: in function ‘require’
16:00:57.698 C:\Users\Steeve\Documents\Corona Projects\tinyfile_dialogs\main.lua:40: in main chunk

As you can see the plugin has been downloaded, I don’t know why the module is not found

os.execute('start xcopy /E "D:\\abc\\123" "D:\\xyz\\123\\"')

To my understanding, you cannot move and rename multiple files at the same time in a single call. The move command moves a single file or all files from source to destination. If renaming then it only moves 1 file; the one being renamed.

There are multiple ways to go about it, but either way will require multiple calls. Either rename all and move all, or move all and rename all, or loop to rename and move each file at a time.

Does this build give you the same issues? tinyfiledialogs_sample.Win32.zip (2.6 MB)

If not, something funny is up with the download; if so… not sure. :slightly_smiling_face: Anything notable about your Windows setup?

I get the same thing

thank you my friend.
now I do not know how to rename the files in the growing order, that is to say: file1, file2, file3

@StarCrunch , there’s a reference to msvcr120.dll, and confirmed it’s being loaded. This is the same issue we came across about 2 weeks ago with the OpenSSL plugin, it requires VS2013 x86 distro.

@steevemoore , batch renaming can be as simple as ren "video*.mp4" "file*.mp4"; however, the problem here is (if your sample code was literal) that you’re renaming a 5 letter string to 4 letters, and I don’t see ren be flexible enough to remove a character in the middle, otherwise ren "video*.mp4" "file_*.mp4" would be more appropriate.

In this case, what do you recommend?

Okay, looks like the Windows build was indeed built against an earlier version. I rebuilt (with author updates too) and the new version should be live now.

Will you find the update?

If that was meant for me, give the sample another try now.

Thank you very much for the update it works

1 Like

thanks for your work !

based on your code I consider the following scripts for my project :

`
local tfd = require( "plugin.tinyfiledialogs" )
local widget = require( "widget" )
widget.setTheme("widget_theme_android_holo_dark")

for _, button in ipairs{ 

		{ 	    label = "Open File",
		        action = function()
			local file = tfd.openFileDialog{  }

-----------I don't know what code I have to insert here to transfer the chosen file to Documents
------ os.execute is an outside code and does not work		
		end
    	},

}


 do
    if button then
        local action = button.action

        widget.newButton{
             label = button.label,
            onEvent = function(event)
                if event.phase == "ended" then   action()  end
            end 
             }

   end
end`

I don’t know what code I have to insert and where to pass my code to transfer the chosen file to Documents.

I guess this action reside in the plugin module