Jump to content

Dan

Active Members
  • Posts

    21
  • Joined

  • Last visited

Everything posted by Dan

  1. In looking at the script, i found a couple more issues related to " and = characters in names and data. I made the simple change to allow for comments as requested and will check out the remaining issue within the next few days.
  2. Thanks, I changed and updated original post. Note to self: In the future, don't code with a hangover.
  3. So it looks like reg_multi_sz were the only issue. Enclosing the string in quotes is not necessary for reg_sz_multi types. I added an else statement to handle it.
  4. Check out the pstools from sysinterals. PSEXEC will allow you to run an executable (compiled autoit script) on a remote machine. PSKILL will kill a process on a remote machine. http://www.sysinternals.com/ntw2k/freeware/pstools.shtml
  5. It's not a problem. Report them all. I wrote it to help with a specific problem and didn't encounter any of the bugs you found as the .reg files I was working with were strings (without " or \ characters) and dwords. The next time i use this, it will be bug free and able to handle any possible .reg formatting thanks to your diligent testing. Your last post said you had a problem with extra entries being placed in the reg file, I can't duplicate this. Can you give me some more details?
  6. Try this: If NOT ($color = 4802889) Then isweg()
  7. I looked at an old installation package I did for the DSClient and found something that should work for you. If it is available, I always use automation methods provided by the installer rather than send clicks or keystrokes to the installer. Microsoft has a way of changing their installers, but the version of the dsclient i deployed appears to be an iexpress package. The following command line works: I may have renamed the installer to dsclient.exe (too long ago, can't remember). dsclient.exe /q /c:"setup /q" the /c switch allows you to override the install command specified in the iexpress package, so I used this to perform a silent installation by running setup with the /q switch.
  8. your .reg file had a space after the = which are not normally present in an export file. "IPAddress"= "172.16.1.24" You may just need to remove the space from this line to make it work. I exported using regedit /e /a print.reg "hkey......" and it worked. I'm using windows xp pro, that may have something to do with it.
  9. This should get you started: AutoItSetOption("WinTitleMatchMode",2) $IEPATH= "c:\program files\internet explorer\iexplore.exe" & " www.google.com" Run($IEPATH,"",@SW_MINIMIZE) Sleep(3000) ;ControlSend("Microsoft Internet Explorer","","Edit1","www.google.com" & "{ENTER}") ControlSend("Google - Microsoft Internet Explorer","","Internet Explorer_Server1","AutoIt3" & "{ENTER}") Sleep(2000) WinSetState("Google", "",@SW_MAXIMIZE)
  10. This will read your regfile, replace the string and write a new file. Dim $INFILEHANDLE, $OUTFILEHANDLE Dim $DATA, $INFILE, $OUTFILE $INFILE = ".\print.reg" $OUTFILE = ".\newprint.reg" $INFILEHANDLE = FileOpen($INFILE, 0) $DATA = FileRead($INFILEHANDLE,FileGetSize($INFILE)) $DATA = StringReplace($DATA, '"IPAddress"= "172.16.1.24"', '"IPAddress"= "10.10.10.27"') $OUTFILEHANDLE = FileOpen($OUTFILE,2) FileWrite($OUTFILEHANDLE, $DATA) FileClose($INFILE) FileClose($OUTFILEHANDLE)
  11. try: Run("\\servername\temp\install.exe")
  12. rathore, 100 posts, but 30 of them were here finding bugs in my code. It looks like the issue was resolved in the data section, but still existed in the key name. I got that fixed, waiting for you to find something else.
  13. Ok. I added some code to deal with escaped characters (" and \). Let me know if you find anything else.
  14. Fixed the issues idenfied by rathore and this-is-me. Thanks for the help guys. If you find anything else, let me know.
  15. The code was updated with all changes identified in this thread. If you find more issues, let me know.
  16. It's not exactly what you are looking for, but if you are only using xp/2000 machines, look at SUS. It uses the windows update client, so new software need be installed on xp. 2000 might require an updated windows update client. Configuration changes are made via registry, or through Active Directory Group policy if available. This works ok, but the logging is almost nonexistent. You will have to parse the iis logs on the sus server for status. I wish the next version WUS would arrive, it seems to address most of the shortcomings of the current version. http://www.microsoft.com/sus
  17. have you registered the file with regsvr32 autoit3x.dll ?? if so, using from vb should only require adding a reference to autoitx3 1.0 type library. Private Sub Form_Load() Dim cAutoit As New AUTOITX3Lib.Control cAutoit.CDTray "e:", "open" End Sub Hope this helps!
  18. I often use autoit for simple configuration/installation tasks including copying files, making registry changes etc. I used it to install an application today and found the little app required 130+ reg keys. i simply exported the pertinent registry sections to file then used file install(@tempdir... and run("regedit.... to import the registry. There were about 25 keys that were dynamic, windows directory, etc, so i had to write these keys from an au3 script with regwrite commands; way too much work. So, i banged out this script to convert a .reg file to an .au3 file which can then be included, copied into main script,.... It could be cleaned up and improved, but it met my needs and i thought it might be of some use to others, so here you go. Dan Make sure when exporting registry files from 2000/xp that you choose Win9x/NT4 Registration file type when saving. ;version .25 - lines begining with; are treated as comments and written to output file. ;Version .24 - Fixed issue with REG_MULTI_SZ AutoItSetOption("MustDeclareVars", 1) ;AutoItSetOption("TrayIconDebug", 1) Dim $REGFILE, $INFILE, $OUTFILE, $TEXT, $KEY, $VALUE, $VALUEDATA, $VALUETYPE OpenFiles() ParseFile() Func OpenFiles() $REGFILE = FileOpenDialog("Choose .REG file",@DesktopDir, "Registry Files (*.reg)") If $REGFILE = 1 Then Exit EndIf $INFILE = FileOpen($REGFILE, 0) $OUTFILE = FileOpen(StringTrimRight($REGFILE,4) & ".au3",1);output file is changed from .reg to .au3 (ie: office.reg will be saved as office.au3) If $OUTFILE = -1 Then ProgramExit("Output File Error|Error opening " & StringTrimRight($REGFILE,4) & ".au3",1) EndIf If $INFILE = -1 Then ProgramExit("Input File Error|Error opening " & $REGFILE,1) EndIf ;read first line of file to confirm it is a regedit4 file $TEXT = FileReadLine($INFILE) If Not StringInStr($TEXT, "REGEDIT4") Then ProgramExit("Error Opening .REG file|" & $REGFILE & " does not appear to be a valid Regedit4 formatted registry file.",1) EndIf EndFunc ;==>OpenFiles Func ParseFile() Dim $TEMP $TEXT =FileReadLine($INFILE) While $TEXT = "" $TEXT = FileReadLine($INFILE) Wend While 1 While StringLeft($TEXT,1) = ";";ignore comment and read next line FileWriteLine($OUTFILE,$TEXT) $TEXT = FileReadLine($INFILE);get next line Wend If StringLeft($TEXT,1) = "[" And StringRight($TEXT, 1) = "]" Then;Brackets at each end. found a key $KEY = StringMid($TEXT,2,StringLen($TEXT)-2); parse string for key name $TEXT = FileReadLine($INFILE);get next line EndIf While StringLeft($TEXT,1) <> "[" And StringRight($TEXT, 1) <> "]" And $TEXT <> "";read values until we see another key. While StringLeft($TEXT,1) = ";";ignore comment and read next line FileWriteLine($OUTFILE,$TEXT) $TEXT = FileReadLine($INFILE);get next line Wend While StringRight($TEXT,1) = "\";Join lines split by regedit export $TEXT = StringTrimRight($TEXT,1) $TEXT = $TEXT & FileReadLine($INFILE) Wend $TEMP = StringSplit($TEXT, "=");split line into value and valuedata $VALUE = TrimQuote($TEMP[1]);remove quotes $VALUE = StringReplace($VALUE,"\\","\");reg file backslashes are \\ replace with \ If $VALUE = "@" Then ;change to autoit format for default value $VALUE = "" EndIf If StringInStr($TEMP[2],"hex:") Then $VALUETYPE = "REG_BINARY" $VALUEDATA = StringTrimLeft($TEMP[2],StringInStr($TEMP[2],"hex:")+3) ;Remove spaces and commas to properly format binary value $VALUEDATA = StringReplace($VALUEDATA," ","") $VALUEDATA = StringReplace($VALUEDATA,",","") ElseIf StringInStr($TEMP[2],"hex(2):") Then $VALUETYPE = "REG_EXPAND_SZ" $VALUEDATA = CharsToString(StringTrimLeft($TEMP[2],StringInStr($TEMP[2],"hex(2):")+6)) ElseIf StringInStr($TEMP[2],"hex(7):") Then $VALUETYPE = "REG_MULTI_SZ" $VALUEDATA = CharsToString(StringTrimLeft($TEMP[2],StringInStr($TEMP[2],"hex(7):")+6)) ElseIf StringInStr($TEMP[2],"dword:") Then $VALUETYPE = "REG_DWORD" $VALUEDATA = StringTrimLeft($TEMP[2],StringInStr($TEMP[2],"dword:")+5) Else $VALUETYPE = "REG_SZ" $VALUEDATA = TrimQuote($TEMP[2]) $VALUEDATA = StringReplace($VALUEDATA,'\"','"');reg file quotes are \" replace with quote $VALUEDATA = StringReplace($VALUEDATA,"\\","\");reg file backslashes are \\ replace with \ $VALUEDATA = StringReplace($VALUEDATA,"'","''");regstring in output file enclose with single quotes. make sure single quotes in string are output EndIf If $VALUETYPE = "REG_MULTI_SZ" Then FileWriteLine($OUTFILE,'RegWrite(' & DblQuote($KEY) & "," & DblQuote($VALUE) & "," & DblQuote($VALUETYPE) & "," & DblQuote($VALUEDATA) & ')') Else FileWriteLine($OUTFILE,'RegWrite(' & DblQuote($KEY) & "," & DblQuote($VALUE) & "," & DblQuote($VALUETYPE) & "," & SingleQuote($VALUEDATA) & ')') EndIf $TEXT = FileReadLine($INFILE) If @error <> 0 Then ExitLoop EndIf Wend $TEXT = FileReadLine($INFILE) If @error <> 0 Then ExitLoop EndIf Wend ProgramExit("Operation Complete|Input File: " & $REGFILE & @CR & "Output File: "& StringTrimRight($REGFILE,4) & ".au3",0) EndFunc ;==>ParseFile Func TrimQuote($INSTRING) ;remove leading and trailing quotes If StringLeft($INSTRING,1) = '"' Then $INSTRING= StringTrimLeft($INSTRING,1) EndIf If StringRight($INSTRING,1) = '"' Then $INSTRING = StringTrimRight($INSTRING, 1) EndIf Return $INSTRING EndFunc ;==>TrimQuote Func CharsToString($INSTRING) Dim $TEMPARRAY, $COUNT $INSTRING = StringReplace($INSTRING," ","") ;Remove trailing nulls While StringRight($INSTRING,3) = ",00" $INSTRING = StringTrimRight($INSTRING,3) Wend ;Create an array of character values and build string $TEMPARRAY = StringSplit($INSTRING, ",") $INSTRING = "" For $COUNT = 1 To $TEMPARRAY[0] If $TEMPARRAY[$COUNT] = "00" Then $INSTRING = $INSTRING & '" & @LF & "';separate items with linefeed character Else $INSTRING = $INSTRING & Chr(Dec($TEMPARRAY[$COUNT]));convert hex to dec then get character value and append to return string EndIf Next Return $INSTRING EndFunc ;==>CharsToString Func DblQuote($INSTRING) $INSTRING = Chr(34) & $INSTRING & Chr(34) Return $INSTRING EndFunc ;==>DblQuote Func SingleQuote($INSTRING) $INSTRING = Chr(39) & $INSTRING & Chr(39) Return $INSTRING EndFunc ;==>SingleQuote Func ProgramExit($INSTRING,$ERROR) Dim $FLAGS,$TEMPARRAY If $ERROR = 1 Then $FLAGS = 16 Else $FLAGS = 64 EndIf $TEMPARRAY = StringSplit($INSTRING, "|") MsgBox($FLAGS, $TEMPARRAY[1], $TEMPARRAY[2]) If $INFILE <> -1 Then FileClose($INFILE) EndIf If $OUTFILE <> -1 Then FileClose($OUTFILE) EndIf Exit EndFunc ;==>ProgramExit
  19. Try this: FileCopy, \\\\sdolco2\\UI - EAAS\\Excel Rating Worksheets\\*.*, %USERPROFILE%\\Desktop\\*.*, 1
  20. I'm not sure if I understand what you are looking for, but here's my best guess. AutoItSetOption("WinTitleMatchMode",2) ; match any substring run("notepad.exe") WinWaitActive("- Notepad") For $Var = 1 to 9 Send("account-" & $var & @CR) Next
×
×
  • Create New...