Jump to content

Open file in current directory using lua script

Recommended Posts

Win32 API GetOpenFileName using the function with lua.

Can I open a file dialog box in the folder I am in with lua. FileOpenDialog ('Open a Text File', @ScriptDir ...
and such.

$FileOpenDialog = FileOpenDialog('Open a Text File', @ScriptDir, 'Text Files (*.txt)')

I'm looking for a command like this
FileOpenDialog = GetOpenFileName("Open a Text File", "txt\n*.txt", @ScriptDir)

Edited by youtuber
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Ascer
      I've read a article about lua functions here: https://debian-administration.org/article/264/Embedding_a_scripting_language_inside_your_C/C_code
      There are two ways of include lua scripts to your AutoIt code.
      1. Run lua functions by Autoit.
      2. Register Autoit function and run as lua.
      It's even possible to apply second way to AutoIt?
      As we can see on example there a few functions to make it possible.
      It's a lua file save as average.lua
      avg, sum = average(10, 20, 30, 40, 50) print("The average is ", avg) print("The sum is ", sum) This is a C functions to run lua. Can be convert to AutoIt ofc.
      There is a problem with func lua_register(L, "average", average)
      this function is not even detected in Lua51.dll
      We can use lua_pushcclosure instead.
      #include <stdio.h> #include "lua.h" #include "lualib.h" #include "lauxlib.h" /* the Lua interpreter */ lua_State* L; /* The function we'll call from the lua script */ static int average(lua_State *L) { /* get number of arguments */ int n = lua_gettop(L); double sum = 0; int i; /* loop through each argument */ for (i = 1; i <= n; i++) { if (!lua_isnumber(L, i)) { lua_pushstring(L, "Incorrect argument to 'average'"); lua_error(L); } /* total the arguments */ sum += lua_tonumber(L, i); } /* push the average */ lua_pushnumber(L, sum / n); /* push the sum */ lua_pushnumber(L, sum); /* return the number of results */ return 2; } int main ( int argc, char *argv[] ) { /* initialize Lua */ L = lua_open(); /* load Lua base libraries */ lua_baselibopen(L); /* register our function */ lua_register(L, "average", average); /* run the script */ lua_dofile(L, "average.lua"); /* cleanup Lua */ lua_close(L); return 0; }  
  • Create New...