Jump to content

Multiple Windows or multiple exe´s?


Recommended Posts

Hi and good day everyone. I have a more or less theoretical question on how to structure an application.

Let´s say, you have a main GUI ($MAINGUI) with a button labeled PLUS. By pressing this Button, another Gui($PLUSGUI) opens, where you can perform simple mathematical addition operations. This can be achieved by including PLUS.AU3 in MAIN.AU3. By running MAIN.AU3 BOTH windows will open. This can be managed by switching between the parent and the child window. So far everything works fine.

But what i am talking about, is not an application with 2 Windows, but maybe 50-70+ Windows. Something deep inside me tells me, that the way described above, not the way is that Yoda would prefer! Understanding my english, you must..:-)...

Is it a better idea, to compile every au3 as a separate exe and call these exe files from the MAINGUI, or even better, can the second exe be compiled INTO the first one, so, that i end up with ONE exe file including all other applications?

Every advice is welcome.

Cheers, Patrick

 

Link to comment
Share on other sites

Are the 50-70+ GUI windows hand-made?

You can always have multiple source files and have a single compiled file, this would be the ideal approach, but you will have to handle the design of the program so that no issue with include files arises.

Edited by TheDcoder

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

39 minutes ago, TheDcoder said:

Are the 50-70+ GUI windows hand-made?

You can always have multiple source files and have a single compiled file, this would be the ideal approach, but you will have to handle the design of the program so that no issue with include files arises.

All hand made. To make it clear what i mean, i have just created the 2 scripts in a hurry. In MainGui the Button1 should call the second gui. As i said, this works great, with including plus.au3 in main.au3. So these 2 au´s can be run seperately, but, as mentioned above i want to call plus.exe FROM main.exe. The first question wich arises is : What has the GuictrlsetonEvent for $Button1 in Main.au3 to be. Furthermore, what is the exact thing to do, to end up with one Exe file?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)


#Region ### START Koda GUI section ### Form=
$MAIN = GUICreate("Form1", 362, 270, 234, 137)
$Button1 = GUICtrlCreateButton("Button1", 80, 72, 201, 65)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUISetOnEvent($GUI_EVENT_CLOSE, "Close")


Func Close()
    Exit
EndFunc

While 1
    Sleep(100)
WEnd
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$PLUS = GUICreate("Form1", 615, 437, 192, 124)
$Input1 = GUICtrlCreateInput("", 128, 64, 313, 37)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 128, 112, 313, 37)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("", 128, 176, 313, 37)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Sum", 64, 176, 53, 33)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Button1", 128, 248, 313, 49)
GUICtrlSetOnEvent($Button1, sum)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



GUISetOnEvent($GUI_EVENT_CLOSE, "out")

While 1
    Sleep(100)
WEnd

Func out()
    Exit
EndFunc

Func sum()
    $term1 = GUICtrlRead($Input1)
    $term2 = GUICtrlRead($Input2)
    $result = $term1 + $term2
    GUICtrlSetData ($Input3, $result)
EndFunc

 

Link to comment
Share on other sites

Hey, 

Something like this?

 

Code to the Main

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("MainProgram", 615, 291, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 136, 72, 323, 105)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ShellExecute("plus.exe","","C:\Temp\")
    EndSwitch
WEnd

 

Code to plus.au3 below. 
Compile to an exe in order to call the plus.exe from Main.exe (or use Test Run on the Main.au3.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=..\..\Temp\plus.Exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$PLUS = GUICreate("Calculator", 615, 437, 192, 124)
$Input1 = GUICtrlCreateInput("", 128, 64, 313, 37)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 128, 112, 313, 37)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("", 128, 176, 313, 37)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Sum", 64, 176, 53, 33)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Calculate", 128, 248, 313, 49)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            sum()
    EndSwitch
WEnd


Func sum()
    $term1 = GUICtrlRead($Input1)
    $term2 = GUICtrlRead($Input2)
    $result = $term1 + $term2
    GUICtrlSetData ($Input3, $result)
EndFunc

 

Kind Regards
Skeletor

"Coffee: my defense against going postal."

Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI

Link to comment
Share on other sites

22 minutes ago, Skeletor said:

Hey, 

Something like this?

 

Code to the Main

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("MainProgram", 615, 291, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 136, 72, 323, 105)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ShellExecute("plus.exe","","C:\Temp\")
    EndSwitch
WEnd

 

Code to plus.au3 below. 
Compile to an exe in order to call the plus.exe from Main.exe (or use Test Run on the Main.au3.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=..\..\Temp\plus.Exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$PLUS = GUICreate("Calculator", 615, 437, 192, 124)
$Input1 = GUICtrlCreateInput("", 128, 64, 313, 37)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 128, 112, 313, 37)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("", 128, 176, 313, 37)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Sum", 64, 176, 53, 33)
GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Calculate", 128, 248, 313, 49)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            sum()
    EndSwitch
WEnd


Func sum()
    $term1 = GUICtrlRead($Input1)
    $term2 = GUICtrlRead($Input2)
    $result = $term1 + $term2
    GUICtrlSetData ($Input3, $result)
EndFunc

 

Hi and Thanks for your reply. Does AutoIt need to be installed on the target maschine?

Link to comment
Share on other sites

41 minutes ago, Skeletor said:

Will the target machine be hosting the *.au3 or the *.exe?

If *.au3 = $edit Then 

Yes,

Else

No

aaaaaand......$edit ist now what exactly? So, i want to create the program on my pc (autoit installed) and use it on pc´s where autoit is not installed..:-)

Link to comment
Share on other sites

Yes, you can do that... PC1 - Autoit installed. Complie programs.
PC2 - No autoit installed. Copy compile program to PC2....

Edited by Skeletor

Kind Regards
Skeletor

"Coffee: my defense against going postal."

Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI

Link to comment
Share on other sites

2 hours ago, Skeletor said:

Yes, you can do that... PC1 - Autoit installed. Complie programs.
PC2 - No autoit installed. Copy compile program to PC2....

Allright, so, if i got you right. i compile different exes into 1 exe file...on runtime, the exe "installs" the "subexes" in a location on hard disk. From there, they can be called within a function. What happens now, if i close the complete application. Are the exes in the install location removed, or do they remain there? And by talking about exiting an application. Is the function "Exit" enough to clear up the memory or do i have to kill certain handlers or whatever?

Link to comment
Share on other sites

How bout you provide me with a step by step process? 
Example:

Step 1. I need exe to do a, b and C

Step 2. need to do x,y,z

Or a visio diagram.. I'm in corporate

Kind Regards
Skeletor

"Coffee: my defense against going postal."

Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...