iAmNewbe Posted August 13, 2022 Posted August 13, 2022 (edited) AutoIT 3.3.14.5 / 3.3.15 ------------------------------------- I need to open a chain of applications where one application opens the next one without these becoming child processes. I have looked in the manual but can't find a ready solution. None of these are console applications. The applications open fine but the ability to control or access controls does not seem to work correctly for some 3rd party applications I use. app 1 |-> executable ; Works app 1 | - > app 2 | - > executable ; No access to window controls I have tried running app 2 from app 1 using ShellExecute($app2) ShellExecute($app2) ShellExecute($app2, '', '', 'open') Run($app2) Run(@ComSpec & " /c " & $app2, "", @SW_HIDE) ; Command Prompt All of these open app2 into a child process of app1 and then the final executable is a grand child of app 1. I guess this is what is going on. I just want to open app2 from app1 and have it be it's own thing running in it's own process exactly if it were run by clicking directly on the application exectuable file or shortcut. This chaining of opening applications seems to some how lock or prevent access to controls, via 3rd party applications. I do not know why or how. I just know NOT chaining like this it works and chaining the opening of these executables when one opens another that opens another, access to application controls stop working. It is specific to what I am doing and does not seem to prevent any normal operation. Ideas how to start an application from within an AutoIT application as it's own process without being a child of the parent? -- Due to possible rules violation with description of the exact situation I find things not working I have rewrote this post to be generic. Edited August 13, 2022 by iAmNewbe Possible rules violation with certain details
iAmNewbe Posted August 13, 2022 Author Posted August 13, 2022 (edited) These are NOT console applications so the Run option of "$RUN_CREATE_NEW_CONSOLE (0x10000)" will not work. Just to be clear I am asking about how to open an executable in it's own process from within AutoIT app. Edited August 13, 2022 by iAmNewbe be more clear
Developers Jos Posted August 13, 2022 Developers Posted August 13, 2022 2 hours ago, iAmNewbe said: This chaining of opening applications seems to some how lock or prevent access to controls, via 3rd party applications. Doubt that .... post an runnable replicator script that demonstrates you issue, much simple than all the words you use which don't make much sense to me yet. 2 hours ago, iAmNewbe said: Ideas how to start an application from within an AutoIT application as it's own process without being a child of the parent? Doubt that is possible as you will find that all new processes shelled by a program by definition have that program as its parent as far as I know. Just look at all your processes with a process explorer and you will see what I mean. 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.
iAmNewbe Posted August 13, 2022 Author Posted August 13, 2022 (edited) I was able to get it to work by creating a scheduled task and then running that task Run(@ComSpec & " /c " & 'C:\Windows\System32\schtasks.exe /run /tn "runApp2"', "", @SW_HIDE) Hope to find an alternative to this method. Edited August 13, 2022 by iAmNewbe
iAmNewbe Posted August 13, 2022 Author Posted August 13, 2022 (edited) 1 hour ago, Jos said: Doubt that .... post an runnable replicator script that demonstrates you issue App1 runApp2() Func runApp2() ShellExecute('app2.exe') EndFunc While 1 Sleep(30000) Exit WEnd App2 runExe() Func runExe() ShellExecute('chrome.exe', 'https://www.autoitscript.com/forum/topic/208655-is-it-possible-to-start-an-application-in-own-process') EndFunc Exit I don't have an AutoIT script for accessing a text editor or manipulating html, javascript for web development. I use something else. The forum rules from my understanding prevent sharing those things in code, manipulating web pages, forms, drop down options etc... The examples above just duplicate the chaining opening of applications. On my end this application runs until I exit the application but the samples above I just timed App1 to close after 30 seconds. App2 runs then closes. My problem is with access of applications opened by App2 when chain opened by App1 App1 runs App2 App2 runs browser or ide or image editor etc... 3rd Party program fails to access in example above chrome but can also be notepad++ or any other application If I just run App2 by itself this works The "fix" in this situation is to run App2 via a sheduled task set to manual run only Then App1 runs the task task runs App2 I don't know why I have to do this... it shouldn't matter but one way works, one way doesn't. Edited August 13, 2022 by iAmNewbe clarity
iAmNewbe Posted August 13, 2022 Author Posted August 13, 2022 In same situation but NOT web browser I open NotePad++ and try to inject log data into window control with same 3rd party application. Same issue, it won't paste into the text window. When chain loading. I don't know... I wanted to have everything accessible via ONE location, if i run them manually it all works. I just have to click three to four shortcut links. I wanted to click one via my development helper app.
Gianni Posted August 13, 2022 Posted August 13, 2022 what if you try this command? Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $app2 & '"') Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
iAmNewbe Posted August 14, 2022 Author Posted August 14, 2022 Thank you for the suggestion. I tried it and it does not work, I am not able to get control of any application that is launched via a chain as described previously. The applications run and operate normally I just can't gain control of them when launched deeper than a first child process. The only solution I have come up with that does work is using a scheduled task to run manually that launches app2.exe. Instead of linking the executable directly from App1, I run the task. It's a work around until some magic happens that I don't have to do that. If these were console applications I would like to try the Run option to start the console app in it's own process but these are not currently. If the parent process MUST also be a console application then it won't work for me anyway.
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