Jump to content

Last line will not execute on first run


spsblah
 Share

Recommended Posts

After this has run, the drive is mapped and files have copied over successfully but the 930 installer will not execute. Then, if i comment out all lines but the 930 installer line, it installs without fail?? Please help. Thx.

;Map Network Drive

DriveMapDel("X:")

DriveMapAdd("X:", "\\such\and\such\Management")

;Copy Install files to temp directory

DirCopy("X:\Manager", "C:\Windows\Temp\9.30")

Sleep(25000)

RunWait ("930Installer.exe", "C:\Windows\Temp\9.30")

Exit

Link to comment
Share on other sites

You need some error checking in your script. What's the return value of each function (DirCopy, RunWait ..)? What is the value of @error after a function has been called.

Do a ConsoleWrite or write the values to a file. This will help in solving the problem.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thank you very much for your reply. I am very new to this but have added as much as i could:

;Map Network Drive

DriveMapDel("X:")

DriveMapAdd("X:", "suchandsuchManagement")

If @error <> 0 Then

$file = FileOpen("C:WindowsTempAM_LOG.txt", 9)

FileWriteLine($file, "An error accured while trying to map drive")

FileClose($file)

ElseIf @error = 0 Then

$file = FileOpen("C:WindowsTempAM_LOG.txt", 9)

FileWriteLine($file, "Map drive successful")

FileClose($file)

EndIf

;Copy Install files to temp directory

DirCopy("X:Manager", "C:WindowsTemp9.30")

If @error <> 0 Then

$file = FileOpen("C:WindowsTempAM_LOG.txt", 9)

FileWriteLine($file, "An error accured while trying to copy directory")

FileClose($file)

ElseIf @error = 0 Then

$file = FileOpen("C:WindowsTempAM_LOG.txt", 9)

FileWriteLine($file, "Copy directory successful")

FileClose($file)

EndIf

Sleep(25000)

RunWait ("930Installer.exe", "C:WindowsTemp9.30")

If @error <> 0 Then

$file = FileOpen("C:WindowsTempAM_LOG.txt", 9)

FileWriteLine($file, "An error accured while trying to run installer")

FileClose($file)

ElseIf @error = 0 Then

$file = FileOpen("C:WindowsTempAM_LOG.txt", 9)

FileWriteLine($file, "Installer successful")

FileClose($file)

EndIf

Exit

This is whats in the txt file:

Map drive successful

Copy directory successful

An error accured while trying to run installer

Anything else I can add to this for more detailed reporting on where it fails?

Link to comment
Share on other sites

According to the help file you have to specify "The full path of the program (EXE, BAT, COM, or PIF) to run (see remarks)." for Run/RunWait.

I stripped down your script a bit:

;Map Network Drive
$file = FileOpen("C:\Windows\Temp\AM_LOG.txt", 9)
DriveMapDel("X:")
DriveMapAdd("X:", "\\such\and\such\Management")
If @error <> 0 Then
    FileWriteLine($file, "An error accured while trying to map drive")
Else
    FileWriteLine($file, "Map drive successful")
EndIf
;Copy Install files to temp directory
DirCopy("X:\Manager", "C:\Windows\Temp\9.30")
If @error <> 0 Then
    FileWriteLine($file, "An error accured while trying to copy directory")
Else
    FileWriteLine($file, "Copy directory successful")
EndIf
Sleep(25000)
RunWait("C:\Windows\Temp\9.30\930Installer.exe", "C:\Windows\Temp\9.30")
If @error <> 0 Then
    FileWriteLine($file, "An error accured while trying to run installer")
Else
    FileWriteLine($file, "Installer successful")
EndIf
FileClose($file)
Exit

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...