Sign in to follow this  
Followers 0
cutefluff

script stuck on pause

3 posts in this topic

#1 ·  Posted (edited)

hi all

i have a problem closing this script after it finishes its run... the autoit icon stays and appears as "paused"

besides that it does what it should - check for a file and according to its modify date run it for some days as described in the ini file

any help would be appriciated :)

thanks and have a great weekend

Sean.

If FileExists("Q:TermAutoit_Codesafety_eventssafety_event.ppsx") Then

            $days2run = Int(IniRead("Q:TermAutoit_Codesafety_eventssafety_events.ini", "SCRIPT_PARAMETERS", "days2run", "2")) * 24

            $win_timeout = Int(IniRead("Q:TermAutoit_Codesafety_eventssafety_events.ini", "SCRIPT_PARAMETERS", "timeout_sec", "60")) * 1000

            Dim $safety_event_timestamp

            $safety_event_timestamp = FileGetTime("Q:TermAutoit_Codesafety_eventssafety_event.ppsx", 1, 0)

            $safety_event_timestamp_lag = _DateDiff('D', $safety_event_timestamp[0] & "/" & $safety_event_timestamp[1] & "/" & $safety_event_timestamp[2] & " " & $safety_event_timestamp[3] & ":" & $safety_event_timestamp[4] & ":" & $safety_event_timestamp[5], _NowCalc())

            If $safety_event_timestamp_lag < $days2run + 1 Then

                        ShellExecute("Q:TermAutoit_Codesafety_eventssafety_event.ppsx", "", "", "", @SW_MAXIMIZE)

                       

                        Sleep($win_timeout)

                        WinKill("PowerPoint Slide Show - [safety_event]")

            EndIf

  EndIf

Exit

Edited by cutefluff

Share this post


Link to post
Share on other sites



You need to add error checking in your script, to see where the problem is. Look at @error, and ConsoleWrite in the help file. If you aren't generating any errors, a ConsoleWrite after every step can at least tell you how far you're getting.

You can also use Opt("TrayIconDebug", 1). Then when the script stalls, you can hover your mouse over the tray icon and see which line it is sitting at.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I can't say exactly why the AutoIt icon stays in the tray after the program exit's, but it says 'paused' only because that is the default operation that is performed when the icon is clicked on. The script doesn't go into that state until then. The icon may still be there because the script isn't actually exitting when it should, IOW, it may still be running for some reason. The error checking that JLogan3o13 suggested is probably the only way to determine what the reason is, or where it is..

Use the blue A button, or manually use autoit tags to post your code in the future.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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