Jump to content

Odd Problem


Recommended Posts

I've recently written 2 different programs with AutoIt, the first of which, Installer.exe, creates 2 files (a text file and a batch file), then calls other batch files in the same folder that rely on the newly created files to perform some network installations. This program works without a hitch.

The second program creates all of the supporting batch files, and copies the Installer.exe into the newly created folder. This program works fine too, but the problem is, at the end of the program I have a message box ask "Would you like to run Installer.exe now?" and if you click yes, it starts Installer.exe and quits the first program, but Installer.exe doesn't create the files that it needs to create. However, if I double click on the Installer that was just copied into that folder, the files are created and it works just fine.

I could paste the code of either or both programs in here, but they're pretty long. Any ideas what might be causing this problem?

Thanks,

-Robert

Link to comment
Share on other sites

the first of which, Installer.exe

if you click yes, it starts Installer.exe and quits the first program,

...are you perhaps killing the process you just started?

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Thanks NicePerson :)

Here's the end of the second program where it calls for the first program to start. I'm fairly new to AutoIt, so please forgive any poor naming conventions and what have you.

; copy generic installer and uninstaller files to local installation folder
FileCopy( "servername~Installer.exe", "C:" & $folderName & "Installer.exe", 2 )
FileCopy( "servername~UNINSTALLER.exe", "C:" & $folderName & "UNINSTALLER.exe", 2 )

Local $runIns = MsgBox( 4, "Installer Creator", "Your installer has been created and can now be accessed at:" & @CRLF & "C:" & $folderName & "Installer.exe" & @CRLF & @CRLF & "Do you wish to run the installer now?" )

If $runIns = 6 Then
  Sleep( 4000 )
  Run( "C:" & $folderName & "Installer.exe" )
EndIf

_Exit()

Thanks,

-Robert

Edited by dfmsguitar
Link to comment
Share on other sites

can we see _Exit()

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Yeah, sorry, Only have 2 replies left today (including this one) as a new member, so I'm trying not to do too many.

I'm pretty sure it's not killing the Installer.exe process as that's a GUI based installer and everything seems to work about it, except for the files that it's supposed to be creating.

Func _Exit()

  Sleep( 75 )
  FileDelete( "C:tempimagesinstaller.jpg" )
  Sleep( 75 )

  If $folderExists = False Then
    DirRemove( "C:tempimages" )
  EndIf

  Exit
EndFunc

tempimages is just a directory that it's creating to pretty up the GUI of the Installer Creator program. Shouldn't have anything to do with the Installer.exe

Edited by dfmsguitar
Link to comment
Share on other sites

is it potentially exiting too quickly, what is the behavior if you change that last run to runwait, then _exit()

I dont see wherehow the second program is killing the first program as described...

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Okay, so I'm sure nobody else will ever have this problem, but in the event that somebody does, I figured out the solution.

when I was running the Installer.exe program by calling Run() from the Installer Creator program, my current working directory wasn't the one containing the Installer, hence when the Installer tried to create and place files locally, it wasn't working.

Here is the revised code that solved the problem:

Local $runIns = MsgBox( 4, "Installer Creator", "Your installer has been created and can now be accessed at:" & @CRLF & "C:" & $folderName & "Installer.exe" & @CRLF & @CRLF & "Do you wish to run the installer now?" )

If $runIns = 6 Then
  FileChangeDir( "C:" & $folderName & "" )
  Run( "Installer.exe" )
EndIf

Thanks again for the help guys.

Edited by dfmsguitar
Link to comment
Share on other sites

You can just do the run with the full path:

Run ( "C:" & $folderName & "Installer.exe" )

Yes, that's the way I had it set up originally, and that's what was causing my problem. the Installer.exe file is set up to create 2 variables and write them each into a separate file created at run time, then save those files in the same folder where the Installer.exe was just saved. The problem was that Installer.exe would run as you would expect, but at the point where the installer was supposed to create and save the 2 files, that was not happening. Or, if it was happening, the files were saving in a location that I was unaware of, thus rendering the installer Useless as it had to use those 2 files shortly after creating them.

Changing the current working directory solved the problem for me. The missing slashes in the code segment in one of my earlier posts was just a problem with copying and pasting into the forum. They are present in the original 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

  • Recently Browsing   0 members

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