michelb2 Posted 11 hours ago Posted 11 hours ago i use autoit to run the same script with all my pc but i don't use the same functions in all of them so i try do do something like that #include "function_for all_pc.au3" if $pc="pc1" then #include "function_for pc1.au3" elseif $pc="pc2" then #include "function_for pc2.au3" endif but it seem that #include can't be conditionnel could you help me ? (of course i can put all the functions in "function_for all_pc.au3" but it's not what i want (some functions in pc1 have the same name in pc2 but have not the same code )
Developers Jos Posted 10 hours ago Developers Posted 10 hours ago The #include is performed at the time the script is read into memory, before execution, so that will not work. Why did you need this anyways as you can do those ifs at execution performing only the required code? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Nine Posted 9 hours ago Posted 9 hours ago 1 hour ago, michelb2 said: of course i can put all the functions in "function_for all_pc.au3" but it's not what i want I believe you will need to rethink your design. You could add a suffix to your function name and use something like this to execute them : Call ("DoThis_" & $PC, $param1, $param2) Also in terms of maintainability, it should be easier to put all the functions into a single include as you do not have to open multiple files to make a modification... “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
michelb2 Posted 8 hours ago Author Posted 8 hours ago the call is a good idea. $pc="pc1" Call ("func1_" & $PC, "", "") func func1_pc1($p1,$p2) msgbox(0,"","pc1") EndFunc if $pc ="pc2" then there is no error and the script does not abort. great ! i'll try to integrate that in my scripts
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