Jump to content

Network Based EXE


Lucid
 Share

Recommended Posts

My Google-fu is failing me, and I was hoping someone can give me some info/direction on the following:

I've compiled a GUI utility as a .EXE, and would like to save it to a network folder here at work; allowing multiple people (on different PCs) to run it at the same time. Is there any way to do this other than to have it copy down to the individual machine and execute from there?

Thanks!

Edited by Lucid
Link to comment
Share on other sites

If the users access the network folder they can simply run the Exe from there.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Yeah, but that's not the issue. The issue is that if UserA fires it off, and then UserB fires it off, and then UserC fires it off, the GUIs act weird. The output from UserA is sent to the GUI on the screens of UserB and UserC. So it doesn't act like 3 different scripts, but one single one that is displaying the same output on three different monitors.

Does that make sense?

Link to comment
Share on other sites

  • Developers

Are you saving information in the Workdir which is likely the Script directory?

Maybe you could share the basics of your script or the script itself?

Jos

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.
  :)

Link to comment
Share on other sites

Sorry I'm not being clear enough. Let me try again...

The .EXE works just fine from a network folder and runs without a hitch. The problem is that if multiple users run it, the info shown within the GUI is shown on ALL the running GUIs. So even though UserA is the one that clicked the NEXT button, UserB and UserC have their GUIs go to the next screen - without having clicked on anything.

For example, if UserA turns something in the GUI from black to red, the GUIs for UserB and UserC both turn that same item red without them doing anything.

Link to comment
Share on other sites

  • Developers

Understood that the first time, but you're not giving any answers to my questions. ;)

So how are these settings saved?

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.
  :)

Link to comment
Share on other sites

Sorry, I'm not understanding the questions.

There is no information being saved. The .EXE fires up, the user clicks the Next button, and then it displays some new text (updates an existing label) in the GUI window and PINGs some machines, then when it's done it lists the results within the GUI. No data output - besides what is shown in the GUI.

Link to comment
Share on other sites

  • Developers

Not sure what you are expecting from this forum unless you show the code and details how to produce the issue.

Loading a EXE from local disk or a fileshare should not matter as the file is copied into memory and than ran.

So when one user running the script is able to update others running scripts, there has to be some sort of transfer of information happening.

That about all my crystal ball reveals for the moment. ;)

Jos

Edited by Jos

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.
  :)

Link to comment
Share on other sites

Thanks! Knowing for sure that it's supposed to reside in memory and work just fine helps! I'll put together some small test code and see if I replicate my problem - and if so, then post my test code here for you guys to look at.

Link to comment
Share on other sites

Well, I kicked some things around and I'm stumped. I chopped my utility down to some bare minimums and am still seeing it where UserA clicks the button, and the screen on UserB changes.

Here's my test code to show what I'm running (yes, I kind of hacked it out of my full utility, but hopefully it still makes sense as to what it's doing):

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=test.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_File_Add=background.png, rt_rcdata, BACKGROUND
#AutoIt3Wrapper_Res_File_Add=button.png, rt_rcdata, BUTTON
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;Built using AutoIT SciTE version 3.3.6 (running AutoIT 3.3.10.0)

#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <Misc.au3>
#include <File.au3>
#include <GDIPlus.au3>


#include "resources.au3" ;http://www.autoitscript.com/forum/topic/51103-resources-udf/
    ;Need to adjust Line 132 to this:
        ;Local $ResData, $nSize, $hData, $pData, $pStream, $hImage, $pBitmap, $hBitmap
    ;Need to add the following as Line 289:
        ;Local $hInstance


AutoItSetOption("MustDeclareVars", 1)
Global Const $AC_SRC_ALPHA = 1
Global $hBackgroundImage, $hButtonImage

If StringRight(@ScriptName, 4) = ".au3" Then
    ;Running in test mode, so we want to use the standalone files
    $hBackgroundImage = _GDIPlus_ImageLoadFromFile("background.png")
    $hButtonImage = _GDIPlus_ImageLoadFromFile("button.png")
Else
    ;Running as a compiled .EXE, so we want to use the included resources
    $hBackgroundImage = _ResourceGetAsImage("BACKGROUND")
    $hButtonImage = _ResourceGetAsImage("BUTTON")
EndIf

_GDIPlus_Startup()
Main()
_GDIPlus_Shutdown()
Exit


Func Main()
    Local $hGUI, $iBackgroundImageWidth, $iBackgroundImageHeight
    Local $hControlGUI, $sTransparencyColor
    Local $hText, $boolProceed
    Local $iButtonImageWidth, $iButtonImageHeight
    Local $iButtonX, $iButtonY
    Local $hGUI_Button, $hButton, $aCursorInfo_Button
    $boolProceed = False
    $sTransparencyColor = $COLOR_BLACK ;The color designated to be transparent (adjust this in conjunction with the coloring of the background image)

    $iBackgroundImageWidth = _GDIPlus_ImageGetWidth($hBackgroundImage)
    $iBackgroundImageHeight = _GDIPlus_ImageGetHeight($hBackgroundImage)
    $hGUI = GUICreate("ParentGUI", $iBackgroundImageWidth, $iBackgroundImageHeight, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
    SetBitmap($hGUI, $hBackgroundImage, 255)
    GUISetState(@SW_SHOW, $hGUI)

    $hControlGUI = GUICreate("ControlGUI", $iBackgroundImageWidth, $iBackgroundImageHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI)
    GUISetBkColor($sTransparencyColor);

    $hText = GUICtrlCreateLabel("Do XYZ actions now...", 75, 50, 300, 30)
    GUICtrlSetFont($hText, 16, 400, 0)
    GUICtrlSetColor($hText, $COLOR_WHITE)
    GUICtrlSetBkColor($hText, $GUI_BKCOLOR_TRANSPARENT)

    GUISetState(@SW_SHOW, $hControlGUI)
    _WinAPI_SetLayeredWindowAttributes($hControlGUI, $sTransparencyColor, 255)

    $iButtonImageWidth = _GDIPlus_ImageGetWidth($hButtonImage)
    $iButtonImageHeight = _GDIPlus_ImageGetHeight($hButtonImage)
    $iButtonX = ($iBackgroundImageWidth - $iButtonImageWidth) - 130
    $iButtonY = ($iBackgroundImageHeight - $iButtonImageHeight) - 33
    $hGUI_Button = GUICreate("ButtonGUI", $iButtonImageWidth, $iButtonImageHeight, $iButtonX, $iButtonY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI)
    $hButton = GUICtrlCreateLabel("", 0, 0, $iButtonImageWidth, $iButtonImageHeight)
    SetBitmap($hGUI_Button, $hButtonImage, 255)
    GUISetState(@SW_SHOW, $hGUI_Button)

    Do
        $aCursorInfo_Button = GUIGetCursorInfo($hGUI_Button)
        If IsArray($aCursorInfo_Button) Then
            If $aCursorInfo_Button[4] = $hButton Then
                ;The cursor is over the button
                If $aCursorInfo_Button[2] = 1 Then
                    ;The button has been pressed
                    $boolProceed = True
                EndIf
            EndIf

        EndIf
        Sleep(10)
    Until $boolProceed = True

    MsgBox(0, "", "We should only see this message box on one of the running GUIs. The other computers should NOT show this unless that user has clicked the Next button.")

EndFunc ;==>Main

Func SetBitmap($hGUI, $hImage, $iOpacity)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc ;==>SetBitmap

And I attached 2 sample .PNG files you can use for the background and button images.

post-83881-0-68109200-1395345582_thumb.p

post-83881-0-39503800-1395345587_thumb.p

Link to comment
Share on other sites

Ran your code on two different workstations, and the message box is only shown on the workstation where the mouse was positioned over the black rectangle and clicked. Nothing occurred on the other workstation.

Now, if you run it twice on the *same* workstation, the the message box is triggered twice. This makes sense because your the black areas are directly over one another, so if the mouse is over one it is also over the other.

Still not sure where you are going with this...

Link to comment
Share on other sites

Did you compile the EXE and put it on a network folder, and then run it from there on both machines? When I log into one machine via Remote Desktop, and launch the EXE from the network folder, if I then launch it from the network folder from my own PC, as soon as I click the OK button in the Remote Desktop session, the message box shows up on both screens.

I hope that makes sense...

Link to comment
Share on other sites

Danp2 - Thanks for verifying! Maybe I have something out of whack with my code checking for mouse clicks. Since my Remote Desktop session was sitting over the top of my local GUI, maybe it captured the mouse locally as well as in the RDP session. Assuming I'll have time, I'll chew through the code next week. Thanks for the help guys! Still learning the Ins and Outs of AutoIT :)

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...