Unknown1

Replace Macro

4 posts in this topic

I have crated a macro that is compiled into an EXE.    When I run it, the exe needs to allow it's own file to be replaced (updated).    Is there anyway to make it so when it runs, it does not lock it's self?

I guess the other option is to copy it's self to a temp location then re-run the program from the temp location so the source file can be replaced.  Any code suggestions on this?

 

 

Share this post


Link to post
Share on other sites



Hi, @Unknown1, welcome to the forum. There are several ways to approach what you're trying to do, such as using FileInstall. How about posting your code so we can determine the best route?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Welcome to AutoIt and the forum!

The keyword to search for is: "SelfUpdate". One of the hits is this thread by Guinness.


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

Thanks for your quick responses.  

At my work we use a program called vcp.exe, this vcp program is created by our vendor.   It verifies that all of there files are up to date and does any needed updating.  This includes updating it's self.    After this program is finished it starts another program called let's say appmenu.exe.    And from that program all other programs run.

I need vcp.exe to run as a local administrator.   And the appmenu.exe to run as the logged in user.   So to around this problem I created a two line auto script that basically performs a runaswait of vcp.exe, (with special command line options preventing vcp from starting the appmenu.exe program.    And then my script will then run appmenu.exe as the normal user.   Problem solved.

But now I have another large problem.   I have over 100 computers out there with icons all paointing to vcp.exe to start the application.  Now I need them to point to my program.  So what I did was rename my compiled script to vcp.exe and renamed the original vcp.exe to another name such run_vcp.exe.   Then my script (now vcp.exe), turns around and runs run_vcp.exe, and it will update the files.   And once finished will execute appmenu.exe.

The only hickup in this way of doing this is when run_vcp.exe updates the files, and if there is a new vcp.exe file to update.   It can't copy it because my script vcp.exe is in the way.  But because my script is not performing the copy operation there is little I can do about it.   My hope is that the run_vcp.exe can copy the vcp.exe file and overright my script.  and then operate like normal.  Then I can use other methods to place my vcp.exe file back if needed.

Sorry if that was very confusing.  But that is the best way I can explain what I'm trying to do.

The only way I can think of to fix this problem is to make make script topy the vcp.exe to a temp location, then run it's self there and terminate the origonal file.  Then the copied version will perform the runaswait of run_vcp.exe and in turn start the appmenu.exe.

Any other thoughts?

 

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