Solomon Posted October 9, 2006 Posted October 9, 2006 Using Autoit 3.1.1 and SciTE 1.69 for writing the code, on Win2k SP4. Im trying to create an automated installer for a programme. I have been doing FileInstall("d:\file.exe", "C:\file.exe") Run("C:\file.exe") Then comes the install routine, which works fine, so I wont include the text. When the installer is complete and exited, I have FileDelete("C:\file.exe") to do the cleanup after the programme is installed. What Id like to be able to do is FileInstall("d:\file.exe", "%USERPROFILE%/local settings/temp/file.exe") to get the installer to go into the system Temp folder, so I can clean it up myself later if/when necessary. However, when I try this in SciTE, and run it, I get the following message - >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /beta /ErrorStdOut /in "C:\Documents and Settings\Anonymous\Desktop\Install InControl.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams >Running AU3Check params: from:C:\Program Files\AutoIt3\SciTE\au3check\ +>AU3Check ended.rc:0 >Running:(3.1.1.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Anonymous\Desktop\Install InControl.au3" C:\Documents and Settings\Anonymous\Desktop\Install InControl.au3 (2) : ==> Unable to execute the external program.: Run("%userprofile%\local settings\temp\incontrol setup.exe") The system cannot find the file specified. +>AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 1.438 which I figure means that FileInstall isn't copying the file into the Temp folder. Id make it do this - FileInstall("d:\file.exe", "C:\Documents and Settings\Anonymous\Local Settings\Temp\file.exe") but I cant guarantee that the %USERPROFILE% is going to be "Anonymous". It might change over time, or be used on different PC's in the house, and I dont want to have 3-4 different versions of the same file lying about. Is there a way to get FileInstall handle %USERPROFILE%, or would it just be better/easier to use the first method? Ive attached the install script.Install_InControl.au3
Danny35d Posted October 9, 2006 Posted October 9, 2006 Instead of this FileInstall("d:\file.exe", "%USERPROFILE%/local settings/temp/file.exe")try using @UserProfileDir, something like FileInstall("d:\file.exe", @UserProfileDir & "\local settings\temp\file.exe") AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Solomon Posted October 9, 2006 Author Posted October 9, 2006 That works great, thanks! The only problem I had then was getting it to run, but I got round it by doing the following. Send("#r") Send("%userprofile%\Local Settings\Temp\file.exe") Send("{ENTER}") Its a bit more long winded, but it works fine, and thats all that really matters.
Moderators SmOke_N Posted October 9, 2006 Moderators Posted October 9, 2006 (edited) That works great, thanks! The only problem I had then was getting it to run, but I got round it by doing the following. Send("#r") Send("%userprofile%\Local Settings\Temp\file.exe") Send("{ENTER}") Its a bit more long winded, but it works fine, and thats all that really matters.Had you thought to maybe try:Run(@ComSpec & ' /c "' & @UserProfileDir & '\Local Settings\Temp\file.exe"', '', @SW_HIDE)oÝ÷ ØGb´êÞ½éÚºÚ"µÍ[ÛÛTÜXÈ [È ÌÎNÈØÈ ][ÝÉÌÎNÈ [È[ [È ÌÎNÉÌLÙ[K^I][ÝÉÌÎNË ÌÎNÉÌÎNËÕ×ÒQJ Edited October 9, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Solomon Posted October 9, 2006 Author Posted October 9, 2006 No I hadn't, LOL. I'll look it up and read up on it before I use it. Thanks for the tip!
Danny35d Posted October 9, 2006 Posted October 9, 2006 (edited) your welcome,like SmOke_N metion you can use Run() function to start your script. I will personally useRun(@ComSpec & ' /c "' & @UserProfileDir & '\Local Settings\Temp\file.exe"', '', @SW_HIDE)rather than Run(@ComSpec & ' /c "' & @TempDir & '\file.exe"', '', @SW_HIDE)The reason is at work no matter which profile you login your Temp folder is always %WinDir%\Temp. Edited October 9, 2006 by Danny35d AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now