
Sigi2
Members-
Posts
16 -
Joined
-
Last visited
Everything posted by Sigi2
-
Running Silent Install via RunAsSet
Sigi2 replied to KidScriptor's topic in AutoIt General Help and Support
Lets test that: Compile this script to c:\temp\user.exe msgbox(0,"USERNAME", @username) and run this script: RunWait("c:\temp\user.exe") RunAsSet("Administrator", @ComputerName, "password") RunWait("c:\temp\user.exe") then you should see 1. Message showing your Username and a 2. Message with Administrator! An other secure way to Test: Compile this script to c:\temp\setuser.exe RegWrite("HKEY_CURRENT_USER","Username","REG_SZ",@UserName) Compile this to c:\temp\getuser.exe $username = RegRead("HKEY_CURRENT_USER","Username") msgbox(0,"USERNAME", $username) run c:\temp\setuser.exe ! Log on as Administrator an run c:\temp\setuser.exe again! then logon back ( with your user account) again and run this script: RunWait("c:\temp\getuser.exe") RunAsSet("Administrator", @ComputerName, "password") RunWait("c:\temp\getuser.exe") again you should see 1. Message showing your Username and a 2. Message with Administrator! -
I'm sad about the way my bug report v3 beta - possible bug in IniReadSection is treated. So i scripted my own Function that runs as expected and with added functionality. SYNTAX: _IniReadSection ( "filename", "section"[, option] ) PARAMETERS: "filename" and "section" are like the built in ones the new parameter "option" is optional: 0 = read only values in proper format (keyname = value) bad formatted lines (without the '=') are ignored (default) 1 = read all values bad formatted lines are treated as keynames without a value 2 = read all values bad formatted lines are treated as values without a keyname 3 = read all values bad formatted lines are treated as values with a numbered keyname and here is my version: Func _IniReadSection($filename, $section, $option = 0) local $file, $error, $line, $data, $sectionfound, $returndata local $l, $p, $i, $counter, $counter2 if $filename = "" or $section = "" or $option > 3 or $option < 0 Then $error = 1 Else $file = FileOpen($filename, 0) If $file = -1 Then $error = 1 EndIf If $error Then SetError(1) Return Else While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $line = StringStripWS($line, 3) If StringLen($line) > 0 Then If StringLeft($line, 1) = "[" Then if $sectionfound Then ExitLoop if StringInStr($line, "[" & $section & "]") Then $sectionfound = 1 ElseIf $sectionfound then if StringInStr($line, "=") or $option Then $data = $data & $line & chr(1) $counter = $counter + 1 EndIf EndIf EndIf Wend EndIf FileClose($file) dim $returndata[$counter + 1][2] $returndata[0][0] = $counter for $i = 1 to $counter $p = StringInStr($data, chr(1), 0, $i) $line = StringMid($data, $l +1, $p - $l -1) $l = $p $p = StringInStr($line, "=") if $p > 1 Then $returndata[$i][0] = StringStripWS(StringLeft($line, $p -1), 3) $returndata[$i][1] = StringStripWS(StringTrimLeft($line, $p), 3) Else if $option = 1 Then $returndata[$i][0] = StringStripWS($line, 3) $returndata[$i][1] = "" ElseIf $option = 2 Then $returndata[$i][0] = "" $returndata[$i][1] = StringStripWS($line, 3) Else while 1 $counter2 = $counter2 + 1 if IniRead($filename, $section, $counter2, "") = "" then ExitLoop WEnd $returndata[$i][0] = $counter2 $returndata[$i][1] = StringStripWS($line, 3) EndIf EndIf Next Return $returndata EndFunc as an side-effect it enables you to read ini-like files as this one: [section1] line 1 line 2 line 3 [section2] line one ... for an example script on how to use, please take a look in the latest beta v3.1 documentation and replace "IniReadSection(..." with "_IniReadSection(..." any suggestions ?
-
nice idea - but can you give an example to understand the function? this is the error i get ... C:\test\test.au3 (4) : ==> Badly formatted "Func" statement.: Func _FileChangeExt($s_FilePath = '', $s_Extension) thx, sigi
-
@MHz ok, thanx for your exeption i updated my 1st post now and hope there is no more misunderstanding.
-
Just a thought for a long awaited script
Sigi2 replied to MadSc13ntist's topic in AutoIt Example Scripts
I like PSTOOLS too and use them in many batch-files. But never i was thiking about an GUI ! PSEXEC is a tool to remotely execute programs (like beyondexec, xcmd and others). What should a GUI be good for ?? Should it help creating the complete Commandline with all the switches ? Like this great Tool: CopyRite XP - a GUI for robocopy CopyRite XP - Hompage -
Yes, I only tested with ANSI files - without any problem. As i know there is no way dealing with Unicode Chars in AutoIt . But hey, there are many more Limitations to live with: some Types of Registry Values: ( * = supported in AutoIt ) * hex: REG_BINARY hex(0): REG_NONE - Null value * hex(1): REG_SZ - Null terminated Unicode fixed string value * hex(2): EXPAND_SZ - Null terminated unexpanded Unicode/ANSI environment string value * hex(3): REG_BINARY - Binary value of any form/length * hex(4): REG_DWORD - 32-bit numerical value hex(4): REG_DWORD_LITTLE_ENDIAN - little-endian 32-bit numerical value (same as REG_DWORD) hex(5): REG_DWORD_BIG_ENDIAN - 32-bit reversed numerical value hex(6): REG_LINK - Symbolic Unicode link string value * hex(7): REG_MULTI_SZ - Array of multiple Unicode strings separated/ended by null characters hex(8): REG_RESOURCE_LIST - Device driver list of hardware resources in Resource Map tree hex(9): REG_FULL_RESOURCE_DESCRIPTOR - List of hardware resources in Description tree hex(a): REG_RESOURCE_REQUIREMENTS_LIST - Device driver list of hardware resource requirements in Resource Map tree hex(?): REG_QWORD - 64-bit numerical value hex(?): REG_QWORD_LITTLE_ENDIAN - little-endian 64-bit numerical value (same as REG_QWORD) an other limitation is the maximum line and string-lenght ... this key [HKEY_CURRENT_USER\SYSTEM\CurrentControlSet\Control\Session Manager\AppCompatibility] is to big to handle. @sugi RunWait('cmd /c type possibleunicode.txt > plaintext.txt', '', @SW_HIDE) works only with ANSI-Chars too .. Thx, Sigi
-
@MHz have you read the purpose of the script ??? have i used any external tools / commands whitin the script ??? do i look as a bloody beginner to you ?? i have written this script on my own, without anybodies help or stealing code from others. @all has anybody tested the script - any comments ? helpful suggestions are welcome Thx, Sigi PS: like testing around with reg2au3 ?? see the attechment (rename it to .reg first) and test it. you can test it against oter reg2au3 skripts and see what happens ... reg_test.txt
-
@SlimShady sorry - i really have not seen your post before . i am curious about your version. ok - i will rename my next version to avoid confusions @sugi why using external 'tools' when the job could be done inside autoit ?
-
you're right - i have not seen the post before. now, this is my way ... this version can read unicode files, has full regdelete support and is tested with many complicated registry exports. try this key with any other tool: [HKEY_CURRENT_USER\SYSTEM\CurrentControlSet\Control\Session Manager\AppCompatibility] have you already tryed it out ?
-
this is a very basic script enabling you to read in textfiles like .cmd .bat .txt .ini .reg and write it to an autoit au3-file. but why this script ?? it was an simple alternative to fileinstall. having a complete textfile within a string, enabling you to work with string-functions before writing to disk, has some advantages. script is not commented but should be not to hard to read. any comments / ideas ? txt2au3.au3
-
ever wanted to write many registry keys at once using regwrite within a script ?? tired about fileinstall a .reg file and run regedit -s ?? this script helps you converting your .reg files (exported with regedit from registry) to .au3 code ready to paste into your script. yes, it can read UNICODE files (exported with windows 2000/xp). Unicode-Reading is limited to ANSI-Code only! an other handicap is that autoit could not write every kind of registry value types like REG_NONE or REG_LINK and others. look at my way to read a simple unicode text file ... the script is not well commented yet - give it a try. comments / ideas are welcome. Reg2au3.au3