Jump to content

Recommended Posts

The Func Install_soft() is missing an Endfunc

The otherproblem can be that you are using absolute paths ...

see:  ""C:\Users\ssuk10g\Desktop\autoIT\teste\Envio_softwares_VWStore\"

The other machine should have the same user for this to work ... you can use @desktopdir to access the current user desktop folder 

3rd problem ... you are deleting the gui and then there is a loop where you check the buttons ...

You should hide the gui instead of deleting it.



 

Edited by Dan_555
Link to post
Share on other sites

Here is fixed GUI part of your code:

;#RequireAdmin

#AutoIt3Wrapper_UseX64=y
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <GuiStatusBar.au3>
#include <Array.au3>
#include <File.au3>
#include <Misc.au3>
#include <GUIConstants.au3>
#include <StaticConstants.au3>
#include <GIFAnimation.au3>

; Usar usuario ADM sistemico

;Variaveis ultilizadas
Global $sSoftware = "C:\Users\ssuk10g\Desktop\autoIT\teste\Envio_softwares_VWStore\Instalação"
Global $powerShell = @ScriptDir & '\Install_soft.ps1'
Global $program = "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell_ise.exe"
;Global $idProgres, $StatusBar1, $sLabel_Status
Global $Button3, $Button6, $Button1, $Button2, $Button4

#region ### START Koda GUI section ### Form=

$Main_GUI = GUICreate("Envio de softwares", 357, 300, 259, 217)
$Group1_app = GUICtrlCreateGroup("Aplicativo Itau", 10, 8, 129, 185)
$pic = GUICtrlCreatePic("IconItau.bmp", 37, 45, 70, 70)
GUICtrlSetBkColor(-1, 0xA0A0A4)
$check1 = GUICtrlCreateCheckbox("", 65, 130, 20, 20)
$instalar = GUICtrlCreateButton("Enviar", 100, 230, 97, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Itau", 280, 16, 67, 25)
$Button2 = GUICtrlCreateButton("Zoom", 280, 48, 67, 25)
$Group2_app = GUICtrlCreateGroup("Navegador Edge", 144, 8, 129, 185)
$pic2 = GUICtrlCreatePic("icon.bmp", 170, 45, 70, 70)
GUICtrlSetBkColor(-1, 0xA0A0A4)
$check2 = GUICtrlCreateCheckbox("", 200, 130, 20, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GUICtrlSetBkColor($Group1_app, 0x3A6EA5)
            GUICtrlSetBkColor($Group2_app, 0xA0A0A4)
        Case $Button2
            GUICtrlSetBkColor($Group1_app, 0xA0A0A4)
            GUICtrlSetBkColor($Group2_app, 0x3A6EA5)
        Case $instalar
            Install_soft()
    EndSwitch
WEnd

Func Install_soft()
    If IsChecked($check1) Then MsgBox(0,'test1', 'works')
    If IsChecked($check2) Then MsgBox(0,'test2', 'works')
;~  If IsChecked($check1) Then ShellExecute("C:\Users\ssuk10g\Desktop\autoIT\teste\Envio_softwares_VWStore\Banco de softwares\aplicativoitau.msi", "", @SW_MAXIMIZE)
;~  If IsChecked($check2) Then ShellExecute("C:\Users\ssuk10g\Desktop\autoIT\teste\Envio_softwares_VWStore\Banco de softwares\Chrome.msi", "", @SW_MAXIMIZE)
;~  ;If IsChecked($check3) THEN MsgBox(0,'test3', 'works');RunWait("calc.exe", "", @SW_MAXIMIZE)
    Exit
EndFunc   ;==>Install_soft

Func IsChecked($control)
    Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED
EndFunc

 

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...