Jump to content

Script doesn't stop running after ShellExecute


Recommended Posts

I created a Launcher script for work, which checks a network drive for the newest version of a Microsoft Access front end file, updates the user's copy if they have an older version, and then launches the newest version. However, each time it's run, new tasks keep showing up in the Task Manager that don't get closed. I've tracked down the problem to the ShellExecute function.

ShellExecute("U:\My Documents\Access DB\Test.accdb")

I created a script with a single line of code (above) and ran it 10 times. 2 out of 10 times (2nd run and 10th run), the script opened the Test.accdb file and stopped running, as intended. The other 8 times, the Test.accdb file was opened, but the script kept running indefinitely. It just fails to stop running, and doesn't appear to be doing anything. I can add extra lines of code after Shellexecute, like ConsoleWrite("Am I still running?") and it will run that code, but the script will still fail to exit afterwards..

Does anyone know what the problem is, or how I can avoid it?

Link to comment
Share on other sites

Instead of running your script 10 time you can use a loop like:

For $i = 1 To 10
    ShellExecute("U:\My Documents\Access DB\Test.accdb")
Next

Exit

Hi!

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

Yes, I could, but that defeats the purpose of what I was trying to point out: The script fails to exit when it reaches the end.

A user only needs to launch the file once, but they may re-open the file 3-5 times throughout the day. Each time they run it, more and more memory is used up that doesn't get released.

The reason for this launcher is so that I can constantly update a Microsoft Access file and push updates, without requiring users to grab a new file themselves. Whenever the person runs the launcher they will automatically get the most up-to-date version of the file. I can post the full code for the launcher, but I figured it's irrelevent if the same problem can be demonstrated with a single line of code.

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

×
×
  • Create New...