Jump to content

GUI keeps running


sbrady
 Share

Recommended Posts

I have created a GUI that has 7 buttons. Click any button and a message box pops up and says "you pushed button x". If you go to the Tools menu, everything is fine.

I added some code to 1 of the buttons. The code works perfectly fine when running it just as a scipt. When you push the button, which runs the code, the script does run perfectly fine.........my question is........why when you go to the TOOLS menu, everything is grayed out EXCEPT the STOP EXECUTING menu option. I can click on any of the other buttons and they all bring up a message box as it is programmed. So it looks like this GUI is functioning fine I guess.

what is causing only the STOP EXECUTING to be active, is it a problem, can I do something to stop it.

thanks for any help.

Link to comment
Share on other sites

Without seeing your code it is impossible to help :(

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

here is all the code, button 2 is where I added all the long code, it works, it just leaves the menu grayed out except the STOP EXECUTING item.  Thanks to both for trying to help me.

; GUI create

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

#include <File.au3>     ;apace
#include <Array.au3>   ;apace


Example()

Func Example()
    Local $Button_1, $Button_2, $Button_3, $Button_4,$Button_5,$Button_6,$Button_7, $msg
    GUICreate("DAW1 Scripts", 220,320) ; will create a dialog box that when displayed is centered
   
   

    Opt("GUICoordMode", 2)
    $Button_1 = GUICtrlCreateButton(" 1. Full Promo Prep",  20, 30, 180,30, $BS_LEFT)
    $Button_2 = GUICtrlCreateButton(" 2. Open NPR  Promo  folder", -180, 10, 180,30, $BS_LEFT)
    $Button_3 = GUICtrlCreateButton(" 3. Open Promo AM Folder",  -180, 10, 180,30, $BS_LEFT)
    $Button_4 = GUICtrlCreateButton(" 4. Open 1030View",  -180, 10, 180,30, $BS_LEFT)
    $Button_5 = GUICtrlCreateButton(" 5. Make NPR Promo folder",  -180, 10, 180,30, $BS_LEFT)
    $Button_6 = GUICtrlCreateButton(" 6. NEXTDAY  to  DMG",  -180, 10, 180,30, $BS_LEFT)
    $Button_7 = GUICtrlCreateButton(" 7. close windows",  -180, 10, 180,30, $BS_LEFT)
    
   
    GUISetState() ; will display an  dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
             
             
             
             
             
             ;BUTTON 1  Promo Prep
          Case $msg = $Button_1
             ;open each promo window
             MsgBox(8192, "Test", "you pushed button 1", 5)
            
      
            ; end button 1
            





             
             







             ;BUTTON 2  Open  NPR  Promo  folder
             Case $msg = $Button_2 
              ; MsgBox(8192, "Test", "you pushed button 2", 5)
;===============================
; find the apace server
; iAA22     interactive
; AR101     featAD
; ASIA221   teleAD
; KW110     featEK 
; ISR5      teleEK
; OB1548    featLO
; OP589     teleLO
; RR72      featPZ
; PP387     telePZ
;===============================
Local $project_code = InputBox("Question", "Enter just the Project Code", "AK98", "", 400, 200, 1200, 100);OP589
Local $char1 = StringLeft($project_code, 1) ; O
;MsgBox(0, "character 1 is:", $char1)  ; O


local $apace2_7Ci = "\\Apacefeatures2\active_projects_e-k\7Ci\"
local $apace2_7Ci_array = _FileListToArray("\\Apacefeatures2\active_projects_e-k\7Ci\")

local $apace1_featAD = "\\Apacefeatures1\active_projects_a-d\ Features\"
local $apace1_teleAD = "\\Apacefeatures1\active_projects_a-d\ TELETHON\"
local $apace1_feat_arrayAD = _FileListToArray("\\Apacefeatures1\active_projects_a-d\ Features\")
local $apace1_tele_arrayAD = _FileListToArray("\\Apacefeatures1\active_projects_a-d\ TELETHON\")

local $apace2_featEK = "\\Apacefeatures2\active_projects_e-k\ Features\"
local $apace2_teleEK = "\\Apacefeatures2\active_projects_e-k\ TELETHON\"
local $apace2_feat_arrayEK = _FileListToArray("\\Apacefeatures2\active_projects_e-k\ Features\")
local $apace2_tele_arrayEK = _FileListToArray("\\Apacefeatures2\active_projects_e-k\ TELETHON\")

local $apace2_featLO = "\\Apacefeatures2\active_projects_l-o\ Features\"
local $apace2_teleLO = "\\Apacefeatures2\active_projects_l-o\ TELETHON\"
local $apace2_feat_arrayLO = _FileListToArray("\\Apacefeatures2\active_projects_l-o\ Features\")
local $apace2_tele_arrayLO = _FileListToArray("\\Apacefeatures2\active_projects_l-o\ TELETHON\")

local $apace1_featPZ = "\\Apacefeatures1\active_projects_p-z\ Features\"
local $apace1_telePZ = "\\Apacefeatures1\active_projects_p-z\ TELETHON\"
local $apace1_feat_arrayPZ = _FileListToArray("\\Apacefeatures1\active_projects_p-z\ Features\")
local $apace1_tele_arrayPZ = _FileListToArray("\\Apacefeatures1\active_projects_p-z\ TELETHON\")



Local $avArray1[4]; apaceAD
$avArray1[0] = "A"
$avArray1[1] = "B"
$avArray1[2] = "C"
$avArray1[3] = "D"
_ArraySort($avArray1)

Local $avArray2[7];apace EK
$avArray2[0] = "E"
$avArray2[1] = "F"
$avArray2[2] = "G"
$avArray2[3] = "H"
$avArray2[4] = "I"
$avArray2[5] = "J"
$avArray2[6] = "K"
_ArraySort($avArray2)


Local $avArray3[4];apace LO
$avArray3[0] = "L"
$avArray3[1] = "M"
$avArray3[2] = "N"
$avArray3[3] = "O"
_ArraySort($avArray3)


Local $avArray4[11];apace PZ
$avArray4[0] = "P"
$avArray4[1] = "Q"
$avArray4[2] = "R"
$avArray4[3] = "S"
$avArray4[4] = "T"
$avArray4[5] = "U"
$avArray4[6] = "V"
$avArray4[7] = "W"
$avArray4[8] = "X"
$avArray4[9] = "Y"
$avArray4[10] = "Z"
_ArraySort($avArray4)






Local $iKeyIndex1 =  _ArrayBinarySearch ($avArray1, $char1)
Local $iKeyIndex2 =  _ArrayBinarySearch ($avArray2, $char1)
Local $iKeyIndex3 =  _ArrayBinarySearch ($avArray3, $char1)
Local $iKeyIndex4 =  _ArrayBinarySearch ($avArray4, $char1)




 

;=================
;INTERACTIVE   iAA22
;=================
If $char1 = "i" Then
   LOCAL $project_exists = 0
   For $i = 1 To $apace2_7Ci_array[0]
   If StringInStr($apace2_7Ci_array[$i], $project_code) Then
   $project_exists = $project_exists + 1
   ;MsgBox(4096,"name",$apace2_7Ci_array[$i]);"iAA22 Marguerites Promo"
   ClipPut($apace2_7Ci_array[$i]) ;put project name on clipboard
   ShellExecute($apace2_7Ci & $apace2_7Ci_array[$i] & "\EXPORTS")
   $hHandle1 = WinWait("", $apace2_7Ci & $apace2_7Ci_array[$i] & "\EXPORTS")
   WinMove($hHandle1, "", 50, 100, 400, 400)  ; use the handle here
   ShellExecute($apace2_7Ci & $apace2_7Ci_array[$i] & "\NUENDO PROJECT")
   $hHandle2 = WinWait("", $apace2_7Ci & $apace2_7Ci_array[$i] & "\NUENDO PROJECT")
   WinMove($hHandle2, "", 50, 520, 400, 400)  ; use the handle here
   EndIf
Next
If $project_exists = 0 Then
   MsgBox(4096,"ERROR",$project_code & " DOES NOT EXIST")
EndIf
EndIf






;=================
; FEAT AD
;=================
If $iKeyIndex1 > -1 Then
   For $i = 1 To $apace1_feat_arrayAD[0]
   If StringInStr($apace1_feat_arrayAD[$i], $project_code) Then
   If FileExists($apace1_featAD & $apace1_feat_arrayAD[$i]) Then
   ;MsgBox(4096,"name",$apace2_7Ci_array[$i]);"iAA22 Marguerites Promo"
   ClipPut($apace1_feat_arrayAD[$i]) ;put project name on clipboard
   If FileExists($apace1_featAD & $apace1_feat_arrayAD[$i] & "\EXPORTS") Then
   ShellExecute($apace1_featAD & $apace1_feat_arrayAD[$i] & "\EXPORTS")
   $hHandle1 = WinWait("", $apace1_featAD & $apace1_feat_arrayAD[$i] & "\EXPORTS");
   WinMove($hHandle1, "", 50, 100, 700, 400)  ; use the handle here
Else
   MsgBox(4096,"name","No EXPORTS Folder")
EndIf
EndIf
 If FileExists($apace1_featAD & $apace1_feat_arrayAD[$i] & "\NUENDO PROJECT") Then
   ShellExecute($apace1_featAD & $apace1_feat_arrayAD[$i] & "\NUENDO PROJECT")
   $hHandle2 = WinWait("", $apace1_featAD & $apace1_feat_arrayAD[$i] & "\NUENDO PROJECT");
   WinMove($hHandle2, "", 50, 520, 700, 400)  ; use the handle here
Else
   MsgBox(4096,"name","No NUENDO Folder")
   EndIf
EndIf
Next
EndIf




;=================
;TELETHON AD
;=================
If $iKeyIndex1 > -1 Then
   LOCAL $project_exists = 0
   For $i = 1 To $apace1_tele_arrayAD[0]
   If StringInStr($apace1_tele_arrayAD[$i], $project_code) Then
   If FileExists($apace1_teleAD & $apace1_tele_arrayAD[$i]) Then
   ;MsgBox(4096,"name",$apace2_7Ci_array[$i]);"iAA22 Marguerites Promo"
   ClipPut($apace1_tele_arrayAD[$i]) ;put project name on clipboard
   If FileExists($apace1_teleAD & $apace1_tele_arrayAD[$i] & "\EXPORTS") Then
   ShellExecute($apace1_teleAD & $apace1_tele_arrayAD[$i] & "\EXPORTS")
   $hHandle1 = WinWait("", $apace1_teleAD & $apace1_tele_arrayAD[$i] & "\EXPORTS");
   WinMove($hHandle1, "", 50, 100, 700, 400)  ; use the handle here
Else
   MsgBox(4096,"name","No EXPORTS Folder")
EndIf
EndIf
 If FileExists($apace1_teleAD & $apace1_tele_arrayAD[$i] & "\NUENDO PROJECT") Then
   ShellExecute($apace1_teleAD & $apace1_tele_arrayAD[$i] & "\NUENDO PROJECT")
   $hHandle2 = WinWait("", $apace1_teleAD & $apace1_tele_arrayAD[$i] & "\NUENDO PROJECT");
   WinMove($hHandle2, "", 50, 520, 700, 400)  ; use the handle here
Else
   MsgBox(4096,"name","No NUENDO Folder")
   EndIf
EndIf
Next
EndIf

    
    
    
    
    
    
;ElseIf $iKeyIndex2 > -1 Then
;=================
; FEAT EK
;=================
If $iKeyIndex2 > -1 Then
   LOCAL $project_exists = 0
   For $i = 1 To $apace2_feat_arrayEK[0]
   If StringInStr($apace2_feat_arrayEK[$i], $project_code) Then
   If FileExists($apace2_featEK & $apace2_feat_arrayEK[$i]) Then
   ;MsgBox(4096,"name",$apace2_7Ci_array[$i]);"iAA22 Marguerites Promo"
   ClipPut($apace2_feat_arrayEK[$i]) ;put project name on clipboard
   If FileExists($apace2_featEK & $apace2_feat_arrayEK[$i] & "\EXPORTS") Then
   ShellExecute($apace2_featEK & $apace2_feat_arrayEK[$i] & "\EXPORTS")
   $hHandle1 = WinWait("", $apace2_featEK & $apace2_feat_arrayEK[$i] & "\EXPORTS");
   WinMove($hHandle1, "", 50, 100, 700, 400)  ; use the handle here
Else
   MsgBox(4096,"name","No EXPORTS Folder")
EndIf
EndIf
 If FileExists($apace2_featEK & $apace2_feat_arrayEK[$i] & "\NUENDO PROJECT") Then
   ShellExecute($apace2_featEK & $apace2_feat_arrayEK[$i] & "\NUENDO PROJECT")
   $hHandle2 = WinWait("", $apace2_featEK & $apace2_feat_arrayEK[$i] & "\NUENDO PROJECT");
   WinMove($hHandle2, "", 50, 520, 700, 400)  ; use the handle here
Else
   MsgBox(4096,"name","No NUENDO Folder")
   EndIf
EndIf
Next
EndIf




;=================
;TELETHON EK
;=================
 If $iKeyIndex2 > -1 Then
   LOCAL $project_exists = 0
   For $i = 1 To $apace2_tele_arrayEK[0]
   If StringInStr($apace2_tele_arrayEK[$i], $project_code) Then
   If FileExists($apace2_teleEK & $apace2_tele_arrayEK[$i]) Then
   ClipPut($apace2_tele_arrayEK[$i]) ;put project name on clipboard
   If FileExists($apace2_teleEK & $apace2_tele_arrayEK[$i] & "\EXPORTS") Then
   ShellExecute($apace2_teleEK & $apace2_tele_arrayEK[$i] & "\EXPORTS")
   $hHandle1 = WinWait("", $apace2_teleEK & $apace2_tele_arrayEK[$i] & "\EXPORTS");
   WinMove($hHandle1, "", 50, 100, 700, 400)
Else
   MsgBox(4096,"name","No EXPORTS Folder")
EndIf
EndIf
 If FileExists($apace2_teleEK & $apace2_tele_arrayEK[$i] & "\NUENDO PROJECT") Then
   ShellExecute($apace2_teleEK & $apace2_tele_arrayEK[$i] & "\NUENDO PROJECT")
   $hHandle2 = WinWait("", $apace2_teleEK & $apace2_tele_arrayEK[$i] & "\NUENDO PROJECT");
   WinMove($hHandle2, "", 50, 520, 700, 400)  ; use the handle here
Else
   MsgBox(4096,"name","No NUENDO Folder")
   EndIf
EndIf
Next
EndIf





    
    
    

;=================
; FEAT LO
;=================
If $iKeyIndex3 > -1 Then
   LOCAL $project_exists = 0
   For $i = 1 To $apace2_feat_arrayLO[0]
   If StringInStr($apace2_feat_arrayLO[$i], $project_code) Then
   If FileExists($apace2_featLO & $apace2_feat_arrayLO[$i]) Then
   ClipPut($apace2_feat_arrayLO[$i]) ;put project name on clipboard
   If FileExists($apace2_featLO & $apace2_feat_arrayLO[$i] & "\EXPORTS") Then
   ShellExecute($apace2_featLO & $apace2_feat_arrayLO[$i] & "\EXPORTS")
   $hHandle4 = WinWait("", $apace2_featLO & $apace2_feat_arrayLO[$i] & "\EXPORTS");
   WinMove($hHandle4, "", 50, 100, 700, 400)
Else
   MsgBox(4096,"name","No EXPORTS Folder")
EndIf
EndIf
If FileExists($apace2_featLO & $apace2_feat_arrayLO[$i] & "\NUENDO PROJECT") Then
   ShellExecute($apace2_featLO & $apace2_feat_arrayLO[$i] & "\NUENDO PROJECT")
   $hHandle5 = WinWait("", $apace2_featLO & $apace2_feat_arrayLO[$i] & "\NUENDO PROJECT")
   WinMove($hHandle5, "", 50, 520, 700, 400)
Else
   MsgBox(4096,"name","No NUENDO Folder")
   EndIf
EndIf
Next
EndIf






;=================
;TELETHON LO
;=================
If $iKeyIndex3 > -1 Then
   LOCAL $project_exists = 0
   For $i = 1 To $apace2_tele_arrayLO[0]
   If StringInStr($apace2_tele_arrayLO[$i], $project_code) Then
   If FileExists($apace2_teleLO & $apace2_tele_arrayLO[$i]) Then
   ClipPut($apace2_tele_arrayLO[$i]) ;put project name on clipboard
   If FileExists($apace2_teleLO & $apace2_tele_arrayLO[$i] & "\EXPORTS") Then
   ShellExecute($apace2_teleLO & $apace2_tele_arrayLO[$i] & "\EXPORTS")
   $hHandle4 = WinWait("", $apace2_teleLO & $apace2_tele_arrayLO[$i] & "\EXPORTS");
   WinMove($hHandle4, "", 50, 100, 700, 400)
Else
   MsgBox(4096,"name","No EXPORTS Folder")
EndIf
EndIf
If FileExists($apace2_teleLO & $apace2_tele_arrayLO[$i] & "\NUENDO PROJECT") Then
   ShellExecute($apace2_teleLO & $apace2_tele_arrayLO[$i] & "\NUENDO PROJECT")
   $hHandle5 = WinWait("", $apace2_teleLO & $apace2_tele_arrayLO[$i] & "\NUENDO PROJECT")
   WinMove($hHandle5, "", 50, 520, 700, 400)
Else
   MsgBox(4096,"name","No NUENDO Folder")
   EndIf
EndIf
Next
EndIf




    
    
    
    
    

;=================
; FEAT PZ
;=================
If $iKeyIndex4 > -1 Then
   LOCAL $project_exists = 0
   For $i = 1 To $apace2_tele_arrayLO[0]
   If StringInStr($apace1_feat_arrayPZ[$i], $project_code) Then
   If FileExists($apace1_featPZ & $apace1_feat_arrayPZ[$i]) Then
   ClipPut($apace1_feat_arrayPZ[$i]) ;put project name on clipboard
   If FileExists($apace1_featPZ & $apace1_feat_arrayPZ[$i] & "\EXPORTS") Then
   ShellExecute($apace1_featPZ & $apace1_feat_arrayPZ[$i] & "\EXPORTS")
   $hHandle4 = WinWait("", $apace1_featPZ & $apace1_feat_arrayPZ[$i] & "\EXPORTS");
   WinMove($hHandle4, "", 50, 100, 700, 400)
Else
   MsgBox(4096,"name","No EXPORTS Folder")
EndIf
EndIf
If FileExists($apace1_featPZ & $apace1_feat_arrayPZ[$i] & "\NUENDO PROJECT") Then
   ShellExecute($apace1_featPZ & $apace1_feat_arrayPZ[$i] & "\NUENDO PROJECT")
   $hHandle5 = WinWait("", $apace1_featPZ & $apace1_feat_arrayPZ[$i] & "\NUENDO PROJECT")
   WinMove($hHandle5, "", 50, 520, 700, 400)
Else
   MsgBox(4096,"name","No NUENDO Folder")
   EndIf
EndIf
Next
EndIf




;=================
;TELETHON PZ
;=================
If $iKeyIndex4 > -1 Then
   LOCAL $project_exists = 0
   For $i = 1 To $apace1_tele_arrayPZ[0]
   If StringInStr($apace1_tele_arrayPZ[$i], $project_code) Then
   If FileExists($apace1_telePZ & $apace1_tele_arrayPZ[$i]) Then
   ClipPut($apace1_tele_arrayPZ[$i]) ;put project name on clipboard
   If FileExists($apace1_telePZ & $apace1_tele_arrayPZ[$i] & "\EXPORTS") Then
   ShellExecute($apace1_telePZ & $apace1_tele_arrayPZ[$i] & "\EXPORTS")
   $hHandle4 = WinWait("", $apace1_telePZ & $apace1_tele_arrayPZ[$i] & "\EXPORTS");
   WinMove($hHandle4, "", 50, 100, 700, 400)
Else
   MsgBox(4096,"name","No EXPORTS Folder")
EndIf
EndIf
If FileExists($apace1_telePZ & $apace1_tele_arrayPZ[$i] & "\NUENDO PROJECT") Then
   ShellExecute($apace1_telePZ & $apace1_tele_arrayPZ[$i] & "\NUENDO PROJECT")
   $hHandle5 = WinWait("", $apace1_telePZ & $apace1_tele_arrayPZ[$i] & "\NUENDO PROJECT")
   WinMove($hHandle5, "", 50, 520, 700, 400)
Else
   MsgBox(4096,"name","No NUENDO Folder")
   EndIf
EndIf
Next
EndIf

;end button 2
               
               
               
               
               
               
               
               
               
               
               
               
               
               
               
               
               
             
             
             ;Button 3 Open Promo AM Folder
             Case $msg = $Button_3
             MsgBox(8192, "Test", "you pushed button 3", 5)
             ;end button 3
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             ; BUTTON 4 Open 1030view Folder
             Case $msg = $Button_4
             MsgBox(8192, "Test", "you pushed button 4", 5)
            ; end button 4
            
               
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
               
            ; BUTTON 5 Make NPR Promo folder
             Case $msg = $Button_5
            MsgBox(8192, "Test", "you pushed button 5", 5)
            ; end button 5
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
               ; BUTTON 6 NEXTDAY to DMG
               Case $msg = $Button_6
               MsgBox(8192, "Test", "you pushed button 6", 5)
                ; END BUTTON 6 NEXTDAY to DMG 
                 
















                 
                 
               ; BUTTON 7  Rename  Mixes
               Case $msg = $Button_7
               MsgBox(8192, "Test", "you pushed button 7")
    
               ; end button 7
               
             
          EndSelect
    WEnd
 EndFunc
Edited by sbrady
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...