emendelson Posted February 6, 2020 Author Posted February 6, 2020 Thank you yet again. I should have found that for myself, but it never occurred to me look for it...!
emendelson Posted February 6, 2020 Author Posted February 6, 2020 @Nine - May I ask if you can confirm one thing? There are a lot of quotation marks in that Run line. This version of the line seems to work when run from the script editor, but the child doesn't load when I run it as compiled. I'm obviously missing something, but after a lot of experimenting, I can't see what it is: Run(@AutoItExe & " /AutoIt3ExecuteScript " & $sTempFile & " " & @AutoItPID & ' "' & $watchPath & '"', @TempDir, @SW_HIDE) Apologies for bothering you yet again, after you've been so helpful and patient already!
Nine Posted February 6, 2020 Posted February 6, 2020 Looks good. Does it work uncompiled ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
emendelson Posted February 6, 2020 Author Posted February 6, 2020 It works perfectly when I run the parent script by pressing F5 in the editor, but when I compile the parent and launch the executable, the child doesn't seem to get launched. Is it possible that this happens because my default file-association setting when clicking on a script is to open it in the editor instead of running it? I'm just guessing, because that presumably should happen when I run it from the editor. I can't test this until three hours from now, because I'm away from my work machine.
Nine Posted February 6, 2020 Posted February 6, 2020 Congrats. You just found a bug. I tested myself, both on Win7 and Win10, and it doesn't work. I tried with a simple "Hello" MsgBox with .au3 extension, and if compiled it is not launching the child script. I will report it as a bug. Meanwhile, you could copy the file AutoIt3.exe somewhere and use the full path to start the child script. Tested and working. Or you could use @Tekk solution (untested). “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
AdamUL Posted February 6, 2020 Posted February 6, 2020 This is not a bug, but a feature. https://www.autoitscript.com/autoit3/docs/intro/running.htm#CommandLine Quote Important Notes However, the executable must have been compiled with the #pragma compile(AutoItExecuteAllowed, True) directive as the default setting does not permit use of the /AutoItExecuteScript or /AutoItExecuteLine parameters. Moreover, since the interpreter stub searches for any required standard #include files in its current folder, UDF functions and various constants may not be available as those files are normally only found in the full AutoIt install. It is therefore recommended that any scripts intended to be run in this manner are compiled to the .a3x format rather then being left as plain .au3 text files Correct usage of single and double quotation marks is important when using the command line - even for double single quotation marks. Adam Nine 1
emendelson Posted February 6, 2020 Author Posted February 6, 2020 @AdamUL - This tells me that we should always read the whole page of the Help file, instead of only the parts of the page we need. Yes, by putting the lline #pragma compile(AutoItExecuteAllowed, True) near the top of the file, the child got launched. Many thanks for that alert response. @Nine - Thank you again for this. I'm going to experiment with Tekk's method because it will be simpler to have a simple function for the Tray icon instead of building a script (I want to add about twenty more lines to my "information" message box, and I'm going to have to pass another command-line parameter to the script that you devised). But meanwhile, thanks to your help, I have a working script and I didn't have one before.
emendelson Posted February 6, 2020 Author Posted February 6, 2020 @Tekk - I was able to find a few minutes to check your file watcher, and it turned to be very easy to plug it into my original script. As far as I can see, it works perfectly. Thank you again.
Mbee Posted September 5, 2020 Posted September 5, 2020 (edited) On 2/4/2020 at 12:19 PM, Nine said: Or you may want to take a look at this : ... Global $g_sPath = "C:\Apps\Temp\", $nBufferLen = 1048576 If Not FileExists($g_sPath) Then Exit MsgBox($MB_SYSTEMMODAL, 'Error', 'Unable to access folder') Local $hDirectory = _WinAPI_CreateFileEx($g_sPath, $OPEN_EXISTING, $GENERIC_READ+$GENERIC_WRITE, $FILE_SHARE_READ+$FILE_SHARE_WRITE, $FILE_FLAG_BACKUP_SEMANTICS) If @error Then Exit MsgBox($MB_SYSTEMMODAL, 'Error', 'Unable to get handle') Local $pBuffer = _WinAPI_CreateBuffer($nBufferLen), $aData ... I have been using it successfully for quite some times now. Downside, it is a blocking function. Hello, @Nine ! I was just wondering how you chose the buffer size (1048576, or 1 MB) for your example. I'm hoping to monitor a subset of change types (just creations, deletions, and renames) for half a dozen entire multi-TB drives, if that's feasible (these changes will not happen very often, and virtually never to multiple drives at once). But surely that will require a very large buffer for each drive. Can you or anyone else suggest how I should go about choosing appropriate buffer sizes? Thanks! Edited September 5, 2020 by Mbee
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now