TomF Posted November 3, 2020 Posted November 3, 2020 Hallo, I have problem with run files with asterix - in this forum I did not find some result. I need to run some PDF files - their names will changed I will not know them. This is OK: ShellExecute (@ScriptDir & "\Dir-1\file-1.pdf") but this is bad: ShellExecute (@ScriptDir & "\Dir-1\*.pdf"). Is there any way to run files with asterix? Thanks for your advice.
GokAy Posted November 4, 2020 Posted November 4, 2020 (edited) Hey, Unless there would be a better way, I would approach this like: Use "_FileListToArray" or "_FileListToArrayRec" functions according to folder structure, which you can use wildcards. https://www.autoitscript.com/autoit3/docs/libfunctions/_FileListToArray.htm https://www.autoitscript.com/autoit3/docs/libfunctions/_FileListToArrayRec.htm #include <File.au3> #include <FileConstants.au3> #include <Array.au3> ; Non-recursive Local $aFileList = _FileListToArray(@ScriptDir & "\Dir-1\","*.pdf",$FLTA_FILES) if $aFileList = "" then exit ; or some error handling For $i = 1 to $aFileList[0] ShellExecute(@ScriptDir & "\Dir-1\" & $aFileList[$i]) Next ; Recursive Local $aFileList = _FileListToArrayRec(@ScriptDir & "\Dir-1\","*.pdf",$FLTAR_FILES) if $aFileList = "" then exit ; or some error handling For $i = 1 to $aFileList[0] ShellExecute(@ScriptDir & "\Dir-1\" & $aFileList[$i]) Next Edited November 4, 2020 by GokAy Corrected typo in ShellExecute
TomF Posted November 4, 2020 Author Posted November 4, 2020 Hallo GojAy, thanks for your quickl reply. But Local $aFileList = _FileListToArray(@ScriptDir & "\Dir-1\","*.pdf",$FLTA_FILES) if $aFileList = "" then exit ; or some error handling For $i = 1 to $aFileList[0] SheelExecute(@ScriptDir & "\Dir-1\" & $aFileList[$i]) Next - unfortunately - it will not allow it: D:\Autoit\Pokusy\2\Run-asterix-2.au3"(12,57) : error: SheelExecute(): undefined function.
TheXman Posted November 4, 2020 Posted November 4, 2020 (edited) 37 minutes ago, TomF said: - unfortunately - it will not allow it: D:\Autoit\Pokusy\2\Run-asterix-2.au3"(12,57) : error: SheelExecute(): undefined function. Look closely. You don't see the problem? I guess the error message saying "undefined function" wasn't a big enough hint. Edited November 4, 2020 by TheXman Musashi 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Musashi Posted November 4, 2020 Posted November 4, 2020 57 minutes ago, TomF said: unfortunately - it will not allow it: D:\Autoit\Pokusy\2\Run-asterix-2.au3"(12,57) : error: SheelExecute(): undefined function. Just in case you have mislaid your spectacles : ShellExecute() - SheelExecute() "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
TomF Posted November 4, 2020 Author Posted November 4, 2020 TheXman, Musashi - thank you very much. I'm sorry, English and programming are not my native languages... GokAy - great, now everything works 👍
GokAy Posted November 4, 2020 Posted November 4, 2020 Hey, Yeah, sorry for the typo Fixed first post. Enjoy!
caramen Posted November 5, 2020 Posted November 5, 2020 (edited) When I was born my dad learned me the C++. 11 hours ago, TomF said: English and programming are not my native languages... Just joking but I don't seen already someone with native programming language 😇 Edited November 5, 2020 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
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