Jump to content

How to find an error in a script


Go to solution Solved by Docfxit,

Recommended Posts

This script runs but doesn't produce the output.

; Copy file Shutdown.lnk into Desktop directory
RunWait(@Comspec & ' /c Copy "C:\Dnload\9xAddons\Shutdown.lnk" "C:\Documents and Settings\All Users\Desktop" ')

How can I figure out why Shutdown.lnk  doesn't get copied into the desktop folder?

Link to post
Share on other sites

What happens if you copy the file with the AutoIt command FileCopy. Before, if necessary, check with FileExists whether the target directory exists (evaluate @error).

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to post
Share on other sites
  • Solution

I did originally write this for XP.  I've been using it many years.  Currently I'm using it in Windows 10.

I tried this:

#include <WinAPIError.au3>
If Not FileCopy("C:\Dnload\9xAddons\Shutdown.lnk", @DesktopCommonDir, 9) Then
    $iLastError = _WinAPI_GetLastError()
    $sLastErrorMessage = _WinAPI_GetLastErrorMessage()
    Msgbox(0, "Show Error ", $iLastError & " - " & $sLastErrorMessage & @CRLF)
EndIf

And found it does copy the file.

Edited by Docfxit
Link to post
Share on other sites
  • Developers
11 hours ago, Docfxit said:

"C:\Documents and Settings\All Users\Desktop"

Just for the record: Doubt that target is correct ....   shouldn't that have been been something like: C:\Users\Default\Desktop

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...