Anaxibius Posted December 16, 2005 Share Posted December 16, 2005 I exported a key that needs to be imported on several PC's. I created a batch file to run the registry file and I am using a RunWait command to call it. My question is why doesn't it work? Run($Source & "Epsilon 1.7.1\Registry.bat") I have verified the $source location is correct. I have verified that running the batch file by itself works. I have access to the key location that I am modifying (HKEY_CURRENT_USER). Am I missing something? I used a MsgBox to output the above location and it is correct. Before you suggest I use the RegWrite function, I can't. The Key Structure is huge and it would take forever to type it into code. Also, while I am at it what order does AutoIT handle things? It seems to me that even with RunWaits it doesn't actually wait for the previous Runs to finish. Link to comment Share on other sites More sharing options...
Stumpii Posted December 16, 2005 Share Posted December 16, 2005 (edited) I see spaces in file paths give people problems before. Can't remember if this is case for you problem, but try it anyway: Run('"' & $Source & 'Epsilon 1.7.1\Registry.bat"') As to the other problem, Autoit will wait for the batch file to finish, not any program that is called from the batch file. As the batch file probably calls the registry insertion program, it will return imediatly. What is in the batch file? Could these commands be done in AutoIt? Edited December 16, 2005 by Stumpii Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
GaryFrost Posted December 16, 2005 Share Posted December 16, 2005 I use Reg2au3 that way don't need external apps.Reg2au3.au3 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Anaxibius Posted December 16, 2005 Author Share Posted December 16, 2005 I see spaces in file paths give people problems before. Can't remember if this is case for you problem, but try it anyway: Run('"' & $Source & 'Epsilon 1.7.1\Registry.bat"') As to the other problem, Autoit will wait for the batch file to finish, not any program that is called from the batch file. As the batch file probably calls the registry insertion program, it will return imediatly. What is in the batch file? Could these commands be done in AutoIt?You were right. The spaces would cause a problem. I used your code and it looks good, but the registry.bat still doesn't seem to be executing. I guess I will go ahead and start coding the RegWrite lines. I have spent too much time on this one line as is. Thanks Link to comment Share on other sites More sharing options...
Stumpii Posted December 16, 2005 Share Posted December 16, 2005 Take a look at post #3 as it has code to convert .reg to AutoIt script. Also, post the bat file contents here so we can see it. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
Gigglestick Posted December 16, 2005 Share Posted December 16, 2005 (edited) I use Reg2au3 that way don't need external apps.Very nice, but are all the "if 1 then" statements you way of sectioning or grouping your code? I've never seen anyone code that way, not that there's anything wrong with it if it helps you code. Take a look at post #3 as it has code to convert .reg to AutoIt script. Also, post the bat file contents here so we can see it.I have always used .reg files instead of bat files and use this to import it: $intExitCode = RunWait(@WindowsDir & "\regedit.exe /s " & $regfile) Then you can test $intExitCode to see if regedit was successful. Now that I am aware of the Reg2au3, I think I might start using that... though if you need to import to HKLM_LOCAL_MACHINE, in which case you may need to allow for using RunAs (either regedit or your own EXE). Edited December 16, 2005 by c0deWorm My UDFs: ExitCodes Link to comment Share on other sites More sharing options...
GaryFrost Posted December 16, 2005 Share Posted December 16, 2005 Very nice, but are all the "if 1 then" statements you way of sectioning or grouping your code? I've never seen anyone code that way, not that there's anything wrong with it if it helps you code. I have always used .reg files instead of bat files and use this to import it: $intExitCode = RunWait(@WindowsDir & "\regedit.exe /s " & $regfile) Then you can test $intExitCode to see if regedit was successful. Now that I am aware of the Reg2au3, I think I might start using that... though if you need to import to HKLM_LOCAL_MACHINE, in which case you may need to allow for using RunAs (either regedit or your own EXE). Not my code, and I haven't taken the time to modify it. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Anaxibius Posted December 16, 2005 Author Share Posted December 16, 2005 As to the other problem, Autoit will wait for the batch file to finish, not any program that is called from the batch file. As the batch file probably calls the registry insertion program, it will return imediatly. What is in the batch file? Could these commands be done in AutoIt? The other problem is unrelated to the registry issue. The file that was listed was incredibly useful. The issue I am having now is with the following code. If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1] If $RUN = 0 Then RunAsSet($USERNAME, $DOMAIN, $PASSWORD, 0) Run('"' & @ScriptFullPath & '" " 1"') If @error Then MsgBox(4096+32,"Error", "Error starting under admin mode") Exit EndIf ; commands go here that require Administrator rights RunWait($Source & "\Epsilon 1.7.1\SilentInstall.bat") ProcessWait("setup.exe") ;RunWait($Source & "\Epsilon 1.7.1\Epsilon\Setup.exe /s") RunAsSet() Exit The batch file calls a setup file with a string of switches a mile long. The batch file executes and if I monitor the processes setup.exe is the file I need to be finished before I move on to the commented out part of the script. As it is right now it will just never close...ever. If I remove the ProcessWait it will immediately move to the next line of the script as you pointed out. Do I need to register the PSAPI.DLL on the client machine or does it simply have to be in the folder with the install? Link to comment Share on other sites More sharing options...
trids Posted December 19, 2005 Share Posted December 19, 2005 .. I have always used .reg files instead of bat files and use this to import it: $intExitCode = RunWait(@WindowsDir & "\regedit.exe /s " & $regfile) ..I also do it this way - but just a heads-up with REG files created on a Win2K machine that you want to import to NT4 machines: Win2K exports UTF8-encoded files, which don't import into NT4 .. even though they LOOK the same. However, REG files exported from NT4 work fine when importing to Win2K. WORKAROUND If you only have Win2K REG files to work with, convert them to ASCII first, and add the first line that says "REGEDIT4" <--- just going from memory, but this line is the same as the one you get in REG files exported from NT4. HTH Link to comment Share on other sites More sharing options...
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