Diana (Cda) Posted June 1 Posted June 1 Good morning and happy Sunday! For the last week I've been trying to figure out how to get AI to open all files in my startup folder beginning with "0", with some AI code I found, but it doesn't work. I also tried the way I would figure out with my own code, but, like d'uh, no go either . Here's what I found that supposedly should work, as far as I can tell from the original message (though I forgot to reference the URL so can't cite it here), but I've probably bungled it somewhere as it doesn't work: #include <file.au3> Local $array = _FileListToArray(@ScriptDir & "\Startup\", "0*.*", 1) For $i = 1 To $array[0] ShellExecute($array[$i]) Next The funny thing is that it references every file that has that starts with a "0" that Windows couldn't find the file it lists in each error box and to try again <lol>, which I find funny. It can't find each file, but it lists each file by name <lol>. I'm wondering if it's because I'm using ShellExecute but without referencing the app to open each file, as the files are all different types - run 2 or 3 apps, open some images (a PNG and JPG, or two), and URLs ... (?) Anyway, any help appreciated!
ioa747 Posted June 1 Posted June 1 I believe that if you put an _ArrayDisplay($array) you will understand why. #include <file.au3> #include <Array.au3> Local $array = _FileListToArray(@ScriptDir & "\Startup\", "0*.*", 1) _ArrayDisplay($array) For $i = 1 To $array[0] ShellExecute($array[$i]) Next I know that I know nothing
Diana (Cda) Posted Thursday at 03:13 AM Author Posted Thursday at 03:13 AM On 6/1/2025 at 8:26 AM, ioa747 said: I believe that if you put an _ArrayDisplay($array) you will understand why. #include <file.au3> #include <Array.au3> Local $array = _FileListToArray(@ScriptDir & "\Startup\", "0*.*", 1) _ArrayDisplay($array) For $i = 1 To $array[0] ShellExecute($array[$i]) Next I'm sorry, but I'm lost as I don't understand your remark that I will "understand why " ... (because I don't ... lol. Sorry!). Basically the same thing happened with this script. I'm guessing, since I'm not very good at all this even though I've been using AutoIt for a long time (I'm just not a natural programmer, or whatever), there is probably something that's needed that I just don't know. But it's just so funny to me that each and every single file is listed exactly by name in an individual error for each file it won't open ... Funny it lists them each and every one, but then can't open ... What am I missing, please? Thank you! And thanks for everyone's patience!
argumentum Posted Thursday at 03:36 AM Posted Thursday at 03:36 AM On 6/1/2025 at 7:45 AM, Diana (Cda) said: For the last week I've been trying to figure out how to get AI to open all files in my startup folder beginning with "0" It all makes little sense or whatever. ..you're missing the path, hence, nothing. In any case, why would anyone would like to run/shellExecute a bunch of files ? pixelsearch 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
ioa747 Posted Thursday at 03:47 AM Posted Thursday at 03:47 AM _FileListToArray ( $sFilePath [, $sFilter = "*" [, $iFlag = $FLTA_FILESFOLDERS [, $bReturnPath = False]]] ) If $bReturnPath is set to True: The function will return the full path for each file and folder in the list. This means that the output will include the complete directory structure leading to each file or folder, making it easier to access them directly without needing to concatenate the folder path manually. like: ShellExecute($array[$i]) If $bReturnPath is set to False (default): The function will return only the names of the files and folders, relative to the specified $sFilePath. This means that the output will not include the full path, and you would need to prepend the $sFilePath to access the files or folders. like: ShellExecute(@ScriptDir & "\Startup\" & $array[$i]) pixelsearch 1 I know that I know nothing
Diana (Cda) Posted Thursday at 12:56 PM Author Posted Thursday at 12:56 PM (edited) On 6/1/2025 at 8:26 AM, ioa747 said: I believe that if you put an _ArrayDisplay($array) you will understand why. #include <file.au3> #include <Array.au3> Local $array = _FileListToArray(@ScriptDir & "\Startup\", "0*.*", 1) _ArrayDisplay($array) For $i = 1 To $array[0] ShellExecute($array[$i]) Next 9 hours ago, argumentum said: It all makes little sense or whatever. ..you're missing the path, hence, nothing. In any case, why would anyone would like to run/shellExecute a bunch of files ? (?) The path is in the @scriptdir and \startup\ part of this script, so not sure about the "you're missing the path" ... It may be that that's not enough, but since it gives me an error and lists each and every single file exactly, so it's still understanding the path which is in a subfolder ... (?) Second part ... because we need to? I would like to, with respect, point out that if someone comes to a forum and takes the time to post a question, it's because something is required, whether or not a respondent can understand the reason why . But I'll explain, though not sure the need that is very real will be understood ... I have several file and app shortcuts in my Startup folder for things I need to very much not forget. I walk away when I start up my PC and close up a lot of those files and apps when I get back, as needed, but I'm reminded of the tasks/etc., and try to get to those items. The files in question I prefaced with "0- " so that they're at the top of the file/app hierarchy. It's just easier if AI can just open them all, which so far is not happening. So I'll come back to the PC to work on things, and would find it easier to just click an AI script and have the remaining items just all open up again. I'll understand if this actually can't be done, for whatever reason, but won't close this issue until I know for sure that's the case since, granted, the apps associated with the files being open are different, and the executables (i.e., 2 birthday/event reminder/files/images/apps, etc.) might not be "executable" with this code in particular. [Again, I may be a "power user" in other respects but am just a very, very basic "programmer", if I can even use that term, as for a couple of decades I've been able to work in AI and VB code, etc., once I've somehow either found working code or kindly been given the code as in the case of some of the AI script I work with, but I don't always understand it all <g>.] Thank you! Edited Thursday at 12:58 PM by Diana (Cda)
pixelsearch Posted Thursday at 01:24 PM Posted Thursday at 01:24 PM Hello @Diana (Cda) Could you please try the same script with the True parameter, as suggested by ioa747 & argumentum ? #include <file.au3> #include <Array.au3> Local $array = _FileListToArray(@ScriptDir & "\Startup\", "0*.*", 1, TRUE) _ArrayDisplay($array) For $i = 1 To $array[0] ShellExecute($array[$i]) Next Tested on my computer : * It works fine with the True parameter * It doesn't work without it (Windows throws an error for each file) Fingers crossed "I think you are searching a bug where there is no bug... don't listen to bad advice."
argumentum Posted Thursday at 07:07 PM Posted Thursday at 07:07 PM 6 hours ago, Diana (Cda) said: Second part ... because we need to? I would like to, with respect, point out ... But I'll explain, though not sure the need that is very real will be understood ... I have several ... for things I need to very much not forget. I walk away when I start up my PC and close up a lot of those files and apps when I get back, as needed, but I'm reminded of the tasks/etc., and try to get to those items. The files in question I prefaced with "0- " so that they're at the top of the file/app hierarchy. It's just easier if AI can just open them all, which so far is not happening. So I'll come back to the PC to work on things, and would find it easier to just click an AI script and have the remaining items just all open up again. Cool. I need to organize my ... everything, myself too. What is this AI you refer to ?, an agentic thing, RAG ... or just a script ? Side note: I have a plan, that is to learn linux and python and react because, that seem to be what these LLMs understand best. I gave my self some 2 years to understand it all. I hope to then, start building a "mini-me", J.A.R.V.I.S. like thing Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Diana (Cda) Posted 20 hours ago Author Posted 20 hours ago (edited) On 6/19/2025 at 9:24 AM, pixelsearch said: Hello @Diana (Cda) Could you please try the same script with the True parameter, as suggested by ioa747 & argumentum ? #include <file.au3> #include <Array.au3> Local $array = _FileListToArray(@ScriptDir & "\Startup\", "0*.*", 1, TRUE) _ArrayDisplay($array) For $i = 1 To $array[0] ShellExecute($array[$i]) Next Tested on my computer : * It works fine with the True parameter * It doesn't work without it (Windows throws an error for each file) Fingers crossed Yes. Tested. But in my case, no positive result. No files/apps were opened/launched. Only difference from this script and the original I posted that needed fixing is that I got a list beforehand of every single file/app starting with "0" to open, but then the same bunch of error boxes popped up, as in the original script. So nothing changed. In other words, result from this second script = 0. HTH. Edited 20 hours ago by Diana (Cda)
Diana (Cda) Posted 20 hours ago Author Posted 20 hours ago On 6/19/2025 at 3:07 PM, argumentum said: What is this AI you refer to ?, an agentic thing, RAG ... or just a script ? AI = AutoIt.
Diana (Cda) Posted 20 hours ago Author Posted 20 hours ago (edited) On 6/19/2025 at 9:24 AM, pixelsearch said: Hello @Diana (Cda) Could you please try the same script with the True parameter, as suggested by ioa747 & argumentum ? #include <file.au3> #include <Array.au3> Local $array = _FileListToArray(@ScriptDir & "\Startup\", "0*.*", 1, TRUE) _ArrayDisplay($array) For $i = 1 To $array[0] ShellExecute($array[$i]) Next Tested on my computer : * It works fine with the True parameter * It doesn't work without it (Windows throws an error for each file) Fingers crossed Oh, sorry, you were quoting a slightly different script that I didn't try. Please forgive my earlier message of just now into not taking that into account, as I was talking about the original response where the list happened, but then the script still tries to launch _something_ but where I still just get an error message box for each and every one of the shortcuts (files/apps) to be launched. Which is all the original script netted, too. The difference is this script doesn't try to do anything, it just gives a list of the shortcuts with their complete filepath. Then nothing. So not sure what this script is trying to accomplish. Something is still missing that I'm not getting, I guess. I just must not be explaining properly somehow, is my conclusion. My folder contains many files/apps as shortcuts to launch. When I click manually on them, no problem, they all get launched. But doing it manually is a pain. I was trying to automate this process. Is there a way to do this, esp. since I labelled those with a "0- " in front. Thank you! Edited 19 hours ago by Diana (Cda)
argumentum Posted 14 hours ago Posted 14 hours ago (edited) 7 hours ago, Diana (Cda) said: My folder contains many files/apps as shortcuts to launch. When I click manually on them, no problem, they all get launched. #include <file.au3> #include <Array.au3> ConsoleWrite( OpemEmAllZero(@ScriptDir & "\Startup") & @CRLF) Func OpemEmAllZero($sPath) Local $iPID, $i, $aArray = _FileListToArray($sPath, "0*.*", 1, TRUE) If UBound($aArray) < 2 Then Return SetError(1, 0, "Ain't nothing there") For $i = 1 To $aArray[0] $iPID = ShellExecute($aArray[$i]) ConsoleWrite(($iPID ? "-" : "!") & ' ' & $iPID & @TAB & '>' & $aArray[$i] & '<' & @CRLF) Next EndFunc Tested and working with the latest AutoIt version. This is what @pixelsearch gave you but as a function with some feedback for debugging. If this don't work, share the console. Like: >"D:\Utilities\AutoIt3\SciTE\..\AutoIt3.exe" "D:\Utilities\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "V:\]ROG9900\Tester\Downloads\TIDY_issue_with_comment_after_include\TIDY_issue_with_comment_after_include\main.au3" /UserParams +>12:58:27 Starting AutoIt3Wrapper (pid=3540) 25.205.1420.10 from:SciTE.exe (4.4.6.0) Keyboard:00000409 OS:WIN_11/2009 CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => D:\Utilities\AutoIt3\SciTE UserDir => C:\Users\Tester\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Tester\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.17.2) from:D:\Utilities\AutoIt3 input:V:\]ROG9900\Tester\Downloads\TIDY_issue_with_comment_after_include\TIDY_issue_with_comment_after_include\main.au3 +>12:58:28 AU3Check ended. rc:0 >Running:(3.3.16.1):D:\Utilities\AutoIt3\autoit3.exe "V:\]ROG9900\Tester\Downloads\TIDY_issue_with_comment_after_include\TIDY_issue_with_comment_after_include\main.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart. --> Press Ctrl+BREAK to Stop. - 9516 >V:\]ROG9900\Tester\Downloads\TIDY_issue_with_comment_after_include\TIDY_issue_with_comment_after_include\Startup\0-New Text Document.txt< - 12936 >V:\]ROG9900\Tester\Downloads\TIDY_issue_with_comment_after_include\TIDY_issue_with_comment_after_include\Startup\0-vlcsnap-2025-04-20-03h50m45s754.png< 0 > +>12:58:28 AutoIt3 ended. rc:0 +>12:58:28 AutoIt3Wrapper Finished. >Exit code: 0 Time: 1.61 that way we can get a hint of what may be the problem. Edited 12 hours ago by argumentum more Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
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