Sign in to follow this  
Followers 0
sbrady

exe seems to freeze

8 posts in this topic

I have converted a script to an exe.

I click on button 1, and things work as expected

I click on button 7 and nothing happens.

do I have to put in an "exit" somewhere

what is causing this to freeze......

thanks for any help.

; GUI create
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
;#include <Array.au3>
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
  
    ;$textbox_input = GUICtrlCreateInput("AR123 Smith, Bob", 10, 35, 350, 20) ; will not accept drag&drop files
    ;$new_project_name = GUICtrlRead($textbox_input)
    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)
   
   ; format the date
   $the_month = @MON   ; get the month 11
   $the_day = @mday  ;get the day 09
   $the_year = @YEAR ;get the year 12
   $the_year2 = StringTrimLeft ($the_year,2)
   $todays_promo1 = $the_month & "-" & $the_day & "-" & $the_year2 & " Promos NPR" ;10-15-12 Promos NPR
   $todays_promo2 = $the_month & "-" & $the_day & "-" & $the_year2 & " Promos" ;10-15-12 Promos
     
   ; set the path for the NPR Promo folder
   $NPR_PROMO_FOLDER = "C:\Documents and Settings\sebrad\Desktop\shawn\Nuendo Projects\NPR Promo\" & $todays_promo1
     
   ; make the NPR folder at the usual location
   DirCreate($NPR_PROMO_FOLDER) ; 10-15-12 Promo NPR
  
  
   
    ; open Promo AM folder
    ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\Promo AM2")
   $thepath1 = "C:\Documents and Settings\sebrad\Desktop\shawn\Promo AM2"
   $hHandle1 = WinWait("", $thepath1)
   WinMove($hHandle1, "", 100, 100, 400, 400)
   
   
   
   ; open 1030View folder
    ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\1030Viewfolder")
   $thepath2 = "C:\Documents and Settings\sebrad\Desktop\shawn\1030Viewfolder"
   $hHandle2 = WinWait("", $thepath2)
   WinMove($hHandle2, "", 200, 200, 400, 400)
   
   
   
   
    ;open todays NPR promo folder
   ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\Nuendo Projects\NPR Promo\" & $todays_promo1)
   $thepath3 = "C:\Documents and Settings\sebrad\Desktop\shawn\Nuendo Projects\NPR Promo\" & $todays_promo1
   $hHandle3 = WinWait("", $thepath3)
   WinMove($hHandle3, "", 300, 300, 400, 400)
  
  
  
  
   ;open DMG promo folder
   ShellExecute("\\10.100.20.40\DMG Drop off\Streaming\Promos\")
   $thepath4 = ("\\10.100.20.40\DMG Drop off\Streaming\Promos\")
   $hHandle4 = WinWait("", $thepath4)
   WinMove($hHandle4, "", 500, 500, 400, 400)
   ; end button 1
   
   
   
   
   
   
   
   
   
   
   
   



    ;BUTTON 2  Open  NPR  Promo  folder
    Case $msg = $Button_2
      MsgBox(8192, "Test", "you pushed button 2", 5)
     
      ; get the month 11
      $the_month = @MON
      ;get the day 09
      $the_day = @mday
      ;get the year 12
      $the_year = @YEAR
      $the_year2 = StringTrimLeft ($the_year,2)
      $todays_promo1 = $the_month & "-" & $the_day & "-" & $the_year2 & " Promos NPR" ;10-15-12 Promos NPR
      $todays_promo2 = $the_month & "-" & $the_day & "-" & $the_year2 & " Promos" ;10-15-12 Promos
     
      ; set the path for the NPR Promo folder
      $NPR_PROMO_FOLDER = "C:\Documents and Settings\sebrad\Desktop\shawn\" & $todays_promo1
     
      ; make the folder at the usual location
      DirCreate($NPR_PROMO_FOLDER) ; 10-15-12 Promo NPR
     
     
     
   ; put the Promo title on the clipboard
   ;ClipPut($todays_promo2) ; 10-15-12 Promo
   ; end button 2
   
    ;open todays NPR promo folder
    ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\Nuendo Projects\NPR Promo")
    $iCurrentMode = Opt("WinTitleMatchMode", 2)
    WinMove("C:\Documents and Settings\sebrad\Desktop\shawn\Nuendo Projects\NPR Promo","",400,120,800,700)
    Opt("WinTitleMatchMode", $iCurrentMode)
   
   
   
   
   
   
   
   
   
   
   
    ;Button 3 Open Promo AM Folder
    Case $msg = $Button_3
    ;MsgBox(8192, "Test", "you pushed button 3", 5)
   $thepath = "C:\Documents and Settings\sebrad\Desktop\shawn\Promo AM2"
   ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\Promo AM2\")
   $hHandle = WinWait("", $thepath)
   WinMove($hHandle, "", 200, 300, 400, 400)
    ;end button 3
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
    ; BUTTON 4 Open 1030view Folder
    Case $msg = $Button_4
    MsgBox(8192, "Test", "you pushed button 5", 5)
   ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\1030Viewfolder")
   $thepath = "C:\Documents and Settings\sebrad\Desktop\shawn\1030Viewfolder"
   $hHandle = WinWait("", $thepath)
   WinMove($hHandle, "", 200, 300, 400, 400)
      ; end button 4
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
       ; BUTTON 5 Make NPR Promo folder
    Case $msg = $Button_5
    MsgBox(8192, "Test", "you pushed button 5", 5)
    ; month
      $the_month = @MON
      ;the day
      $the_day = @mday
      ;the year
      $the_year = @YEAR
      $the_year2 = StringTrimLeft ($the_year,2)
      ; set the name for DMG (Digital Media Group)
      $todays_promo_NPR =  $the_month & "-" & $the_day & "-" & $the_year2 & " Promos NPR";NEXTDAY 10-15-12
    ; end button 5
   
   
    Local $todays_NPR_promo_folder = "C:\Documents and Settings\sebrad\Desktop\shawn\Nuendo Projects\" & $todays_promo_NPR
      DirCreate($todays_NPR_promo_folder)
   
   
   
   
   
   
   
   
   
   
   
   
   
     ; BUTTON 6 NEXTDAY to DMG
     Case $msg = $Button_6
     MsgBox(8192, "Test", "you pushed button 6", 5)
    
      ; month
      $the_month = @MON
      ;the day
      $the_day = @mday
      ;the year
      $the_year = @YEAR
      $the_year2 = StringTrimLeft ($the_year,2)
      ; set the name for DMG (Digital Media Group)
      $todays_promo_DMG = "NEXTDAY " & $the_month & "-" & $the_day & "-" & $the_year2 ;NEXTDAY 10-15-12
      ShellExecute("\\10.100.20.40\DMG Drop Off\Streaming\PROMOS") ; open DMG folder
      WinWait("PROMOS") ; wait till the drive exists
      WinMove("PROMOS","",50,800,200,300) ; open the drive in lower left of the screen
      $NDP_SRC = "D:\Promos\NEXTDAY.mxf"
      $DEST = "\\10.100.20.40\DMG Drop Off\Streaming\PROMOS\" & $todays_promo_DMG
      FileCopy ($NDP_SRC,$DEST) ;move NEXTDAY and rename to DMG
     ; end button 6
    
      ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\DMG")
      $thepath = "C:\Documents and Settings\sebrad\Desktop\shawn\DMG"
      $hHandle = WinWait("", $thepath)
      WinMove($hHandle, "", 200, 300, 400, 400)
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
      ; BUTTON 7  Rename  Mixes
      Case $msg = $Button_7
     
      ; get the month 11
      $the_month = @MON
      ;get the day 09
      $the_day = @mday
      ;get the year 12
      $the_year = @YEAR
      $the_year2 = StringTrimLeft ($the_year,2)
      $todays_promo1 = $the_month & "-" & $the_day & "-" & $the_year2 & " Promos NPR" ;10-15-12 Promos NPR
     
      MsgBox(8192, "Test", "you pushed button 7", 1)
      WinClose ("Promo AM2")
      Sleep (200)
      WinClose ("1030Viewfolder")
      Sleep (200)
      WinClose ("Promos")
      Sleep (200)
      WinClose ($todays_promo1  )
     
     
      ; end button 7
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
   
    EndSelect
    WEnd
EndFunc

Share this post


Link to post
Share on other sites



when I run the script, click button 1, and look at "tools"......it looks like its still running, so I click "Stop Executing", that kills the GUI.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

sbrady,

Before I even look in detail at the script I will ask you this simple question:

What have YOU done to errorcheck the script?

In your recent posts the solution was simple once some errorchecking had isolated the line that caused the problem - so have you made any effort to do so this time? Not from what I can see - when you press button 7 what do those WinClose lines return? Have they found the windows they are supposed to close or not?

You do some work first and then we aill see what might be the problem. :)

M23

Edit:

And as to your new question - why should the script exit? You have not told it to do so. If you want it to exit after running some code, you are correct that you need to add an Exit at that point.

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I have found opening the last folder from button 1, the folder that comes from a network connection (10.100.20.40) is the culprit. It's what's doing the damage and freezing things up. Why would that one folder window being opened freeze the script.

Share this post


Link to post
Share on other sites
Two Advices
  • Reproducing your problem in a small example will get you more help
  • Try Opt('TrayIconDebug', 1) to get the ScriptLine where the Script Freezes

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

I can shellExecute the folder path so the window opens, its the rest of the code to move the window that somewhere is making things stop working.

Share this post


Link to post
Share on other sites

Try using a time out value on the WinWait, that way if the window doesn't show up in a certain time frame the script won't sit there forever waiting for it.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I can use ShellExecute and the folder window opens. I can place and size the window and the script seems to remember where I placed it and the dimensions.........works for me.....no need to code it. Thanks.

Share this post


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
Sign in to follow this  
Followers 0