Sign in to follow this  
Followers 0
spsblah

Last line will not execute on first run

4 posts in this topic

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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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?

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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