ionut Posted July 5, 2010 Share Posted July 5, 2010 Hello, I have written several scripts which are all using the same functions so I have decided to created a custom.au3 script with all the common functions and to include it in the scripts. In order for the functions to create a results I need to open the GUI of my application. The scripts now look like this: #include <custom.au3> ShellExecute("PathtoFiletoBeOpened") If I am starting the script like this nothing happens. If I invert the lines: ShellExecute("PathtoFiletoBeOpened") #include <custom.au3> the GUI opens up and the script starts to run as expected. It seems that the functions from the custom.au3 script are somehow called by the #include command and cannot execute because the GUI is not opened. Am I correct making this assumption? Any help in explaining this behavior is greatly appreciated. Thank you, Ionut Link to comment Share on other sites More sharing options...
KaFu Posted July 5, 2010 Share Posted July 5, 2010 Yep, sounds good. Seems like you've got a loop somewhere in your custom include. Check that out and ensure that the custom.au3 by itself runs through smoothly (exit without hanging). OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
ionut Posted July 5, 2010 Author Share Posted July 5, 2010 Yep, sounds good. Seems like you've got a loop somewhere in your custom include. Check that out and ensure that the custom.au3 by itself runs through smoothly (exit without hanging).Kafu, I don't think I have a loop in the custom script but I do have a bunch of WinWaitActive conditions which are not met unless my application's GUI is opened. If I keep the window opened the custom script will execute fine. If I close it the custom script will hang. My expectations were slightly different: I thought the functions from the custom script will be called and run only after the main script requires them, not when the #include <custom.au3> line is parsed and executed. Thanks,Ionut Link to comment Share on other sites More sharing options...
KaFu Posted July 5, 2010 Share Posted July 5, 2010 My expectations were slightly different: I thought the functions from the custom script will be called and run only after the main script requires them, not whenIncludes are just placeholders. The code inside the include is parsed to exactly that line in the script where the include is called. If you just have func / endfunc enclosed functions in your include you're fine. If you have code which is run on calling the include (not enclosed by func/endfunc), it will do exactly that. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
ionut Posted July 5, 2010 Author Share Posted July 5, 2010 OK, now I understand this behavior is as designed. Thanks a lot for your explanations, Kafu!!! Regards, Ionut Link to comment Share on other sites More sharing options...
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