dieterhatn Posted September 12, 2014 Share Posted September 12, 2014 Hi there, Is there a way to run an external program inside my Autoit GUI? Or even two programs in one GUI? thanks Link to comment Share on other sites More sharing options...
MikahS Posted September 12, 2014 Share Posted September 12, 2014 You mean like creating a button and on pressing it, it will run another program? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
dieterhatn Posted September 12, 2014 Author Share Posted September 12, 2014 You mean like creating a button and on pressing it, it will run another program? I meant if you run a program within your script, the window will be attached to your gui. Link to comment Share on other sites More sharing options...
MikahS Posted September 12, 2014 Share Posted September 12, 2014 (edited) It would have to be attached manually by you through parent - child settings. I'm positive though if you just ran a random program from inside the GUI like notepad, it will not be attached to the GUI automatically, but using something like this: $Form1 = GUICreate("Attached window!", 629, 437, 314, 132, default,default, WinGetHandle("AutoIt Help")) ; as you can see we get the handle and attach it as the parent to the created GUI window -- essentially making our GUI created a child GUI Edited September 12, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
dieterhatn Posted September 12, 2014 Author Share Posted September 12, 2014 It would have to be attached manually by you through parent - child settings. I'm positive though if you just ran a random program from inside the GUI like notepad, it will not be attached to the GUI automatically, but using something like this:$Form1 = GUICreate("Attached window!", 629, 437, 314, 132, default,default, WinGetHandle("AutoIt Help")) ; as you can see we get the handle and attach it as the parent to the created GUI window -- essentially making our GUI created a child GUI Isn't it exactly vice-versa? The doc says that if you define a Window Handle, the autoit GUI will become a child of the window you define. Link to comment Share on other sites More sharing options...
MikahS Posted September 12, 2014 Share Posted September 12, 2014 (edited) Yes, it is somewhat the other way around, my apologies. Here is something that can the right way round: #include <WinAPI.au3> _WinAPI_SetParent(WinGetHandle("whatever window you want to make a child here", $hWnd) ; first param is the child window or the window we want to make a child and the second param is our created GUI Edited September 12, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
dieterhatn Posted September 12, 2014 Author Share Posted September 12, 2014 That somewhat does what i want, but im experiencing some problems. Im trying arround with a simple GUI and a notepad window i want to attach, but whenever I set the parent the notepad window just disappears. The process is still running but its not visible anymore. Link to comment Share on other sites More sharing options...
MikahS Posted September 12, 2014 Share Posted September 12, 2014 (edited) works for me with this script: #include <WinAPI.au3> #include <GUIConstants.au3> Local $msg, $hwnd, $Nhandle $hwnd = GUICreate("hello") GUISetState() Run("notepad") $Nhandle = WinGetHandle("Notepad") _WinAPI_SetParent($Nhandle, $hwnd) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited September 12, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
dieterhatn Posted September 14, 2014 Author Share Posted September 14, 2014 works for me with this script:#include <WinAPI.au3>#include <GUIConstants.au3>Local $msg, $hwnd, $Nhandle$hwnd = GUICreate("hello")GUISetState()Run("notepad")$Nhandle = WinGetHandle("Notepad")_WinAPI_SetParent($Nhandle, $hwnd)While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitchWEnd What exactly happens when you run this code? for me nothing happens :/ Link to comment Share on other sites More sharing options...
JohnOne Posted September 14, 2014 Share Posted September 14, 2014 (edited) #include <WinAPI.au3> #include <GUIConstants.au3> Local $msg, $hwnd, $Nhandle $hwnd = GUICreate("hello") GUISetState() $pid = Run("notepad", "", @SW_HIDE) ProcessWait($pid) $Nhandle = WinGetHandle("Untitled - Notepad") _WinAPI_SetParent($Nhandle, $hwnd) _WinAPI_SetWindowLong($Nhandle, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE) WinMove($Nhandle, "", 0, 0) While ProcessExists($pid) $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ProcessClose($pid) EndSwitch WEnd Edited September 14, 2014 by JohnOne spudw2k 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
MikahS Posted September 15, 2014 Share Posted September 15, 2014 What exactly happens when you run this code? for me nothing happens :/ You have not formatted it.. #include <WinAPI.au3> #include <GUIConstants.au3> Local $msg, $hwnd, $Nhandle $hwnd = GUICreate("hello") GUISetState() $pid = Run("notepad", "", @SW_HIDE) ProcessWait($pid) $Nhandle = WinGetHandle("Untitled - Notepad") _WinAPI_SetParent($Nhandle, $hwnd) _WinAPI_SetWindowLong($Nhandle, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE) WinMove($Nhandle, "", 0, 0) While ProcessExists($pid) $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ProcessClose($pid) EndSwitch WEnd Very cool. Just to understand you made the notepad window a pop-up and put it inside the GUI created? I like this. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
JohnOne Posted September 15, 2014 Share Posted September 15, 2014 Yes, I think that is what the OP was after. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
MikahS Posted September 15, 2014 Share Posted September 15, 2014 I think it's better than what OP wanted Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Alwaysconfused Posted November 20, 2018 Share Posted November 20, 2018 Currently trying to do something similar. I'm looking to attach a blank GUI around the notepad. Instead of the script running the notepad, I'm trying to make it attach a GUI around a notepad i have opened manually. Played about with the script above and this is what i have came up with, it runs, works but then comes up an error. Would it be possible to advise on my mistake, thanks in advance. test.au3 Link to comment Share on other sites More sharing options...
careca Posted November 20, 2018 Share Posted November 20, 2018 I'd say instead of reviving a 4yo thread, create a new one for your issue. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Alwaysconfused Posted November 20, 2018 Share Posted November 20, 2018 Most probably a better idea. Thanks 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