Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

[Excel] Can't close Excel when Screensaver is active...

$
0
0
Hi there!

This is a script to open an Excel document of the user's choice, and automatic refresh it every x minutes.
The refreshing is: Close the readonly Excel document, and directly reopen it. (A loop of course)

Just one little problem:
When the screensaver becomes active, it won't close excel anymore, but just opens another instance of the file. Resulting that when I end the screensaver, there are more then 10 instances of Excel active.

Can anyone help me with this annoying problem?

[ autoit ]         
Opt("WinTitleMatchMode", 2) Local $selectXLS = "Selecteer het gewenste Excel bestand." Local $openXLS = FileOpenDialog($selectXLS, @ScriptDir & "\", "Excel bestanden (*.xls;*.xlsx)", 1) If @error Then MsgBox(4096, "", "Geen bestand gekozen.") Exit Else $FileName = $openXLS EndIf if not FileExists($FileName) then Msgbox (0,"Bestandsfout","Ik kan het bestand niet vinden. "& $FileName) Exit Else Local $xLoop = 1 Local $tijdSec = InputBox("Tijdschema Opgeven", "Geef de verversingstijd van bestand in minuten: (bijv: 20)") If @error = 1 Then MsgBox(4096, "Sluiten", "Programma afgebroken.") Exit Else ; OK geklikt, nu openen bestand en verversingsloop in. If $tijdSec < 1 Then MsgBox(4096, "Sluiten", "De minimale verversingstijd is 1 minuut.") Exit Else While $xLoop = 1 ShellExecute("excel.exe", '/r "' & $FileName & '"', @ScriptDir, "", @SW_MAXIMIZE) Sleep($tijdSec*1000*60) if ProcessExists("excel.exe") Then WinWaitActive("Microsoft Excel") WinClose("[ACTIVE]", "") Else Exit EndIf WEnd EndIf EndIf EndIf

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>