Jump to content

MHz

Member
  • Posts

    1,691
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Australia

Posts posted by MHz

  1. Just RunOnceEx problem remains, even if it is secondary now.

    It can only run files and not commands directly, so I can't add the "start" option there.

    I couldn't test the script from RunOnceEx for that reason.

    Perhaps you can call the Comspec variable. Comspec contains the path to the systems default command interpreter.

    "%COMSPEC%" /c Start actbar.exe 10 2

    The above command can be added to registry. You may also try using a bat file from the registry and use it to start actbar.exe.

    p.s: err, is "_interpreter" just a string, right?

    Correct. Every AutoIt process has a hidden window and the string mentioned is used to set a part of the title for that window. If WinClose is used on that hidden window then the AutoIt process associated with that window closes.

  2. I am only missing a piece of the puzzle.

    It maybe possible that RunOnceEx.cmd is adding the entries but the commands added are failing later when the RunOnceEx entries are executed. The regtweaks file looks like it is in the correct folder and looks OK in cmdlines.txt.

    You will need to ensure that the contents of the $OEM$ are copied over to %SYSTEMDRIVE% by using the below setting in Winnt.sif as mentioned here in the guide. Your RunOnceEx.cmd relies on this setting to exist and set to Yes.

    OemPreinstall=Yes

    It also seems like your RunOnceEx.cmd is missing a couple of escapes with quotes which may cause the entries to fail if whitespace exists. It may not be an issue as your previous entries are added to registry but without the quotes that you did not escape. Changes done below.

    @echo off
    SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
    REG ADD %KEY% /V TITLE /D "Softwareinstallation" /f
    REG ADD %KEY%\0 /VE /D "Office2000" /f
    REG ADD %KEY%\0 /V 1 /D "\"%systemdrive%\apps\Office2000\SETUP.EXE\" TRANSFORMS=\"Custom.MST\" /qn+" /f
    REG ADD %KEY%\0 /V 2 /D "taskkill /F /IM outlook.exe" /f
    REG ADD %KEY%\1 /VE /D "AdobeReader7" /f
    REG ADD %KEY%\1 /V 1 /D "\"%systemdrive%\apps\AdobeReader7\AdbeRdr707_en_US.exe\" /Q /W /S /V\"/QN\"" /f
    REG ADD %KEY%\1 /V 2 /D "taskkill /F /IM 123.exe" /f

  3. Wow the script is perfect that way, thanks! :)

    Nice things the "Interpreter" and "infinite while" solutions (I couldn't understand before why that bar disappeared)

    Your welcome :)

    I still have the second problem though, because I'm running actbar.exe from a batch file.

    I have to use it as I'm doing registry modifications and various operations. Converting all to a script would be long and full of new errors. Putting it in another script would be a poor solution (multiple files).

    I am guessing the batch file is a CMD file? That is fine. No matter what type of script that you use, the method of executing Actbar.exe from that script will be basically the same.

    Anyway, with the batch the execution stops after the first script launch.

    I don't know why, dos shouldn't wait for program termination normally! (only with start /wait)

    What the.. ??

    Not AFAIK with the NT based interpreter.

    • The CMD interpreter will wait for an execution until processing the next line when a CMD script is used as to invoke the CMD interpreter initially. I notice some particular executions do return immediately as to possibly respawning a new process or some other unknown reason so using Start /wait tends to handle these more reliabily to prevent the immediate return. The default behavior allows the CMD script to complete the command on the line before progressing with the next line.
    • An execution from a CMD prompt will not wait for an execution unless you use Start /wait. The default behavior allows you to do multiple commands without waiting for the CMD prompt.

    I'll add a batch example so you can see the problem.

    (You won't reach the first pause :no: )

    Try this CMD script


    If $CMDLINE[0] <> 2 Then
    ; Exit if 2 parameters were not used
    Exit 1
    Else
    ; assign parameters to friently variable names
    Global $Max = $CMDLINE[1]
    Global $Counter = $CMDLINE[2]
    ; show progress window
    ProgressOn("Status", "", "")
    ; set data to progress window
    ProgressSet(($Counter / $Max) * 100, "", "Completed " & ($Counter / $Max) * 100 & "%")
    ; title to use for the interpreter window title
    Global Const $AUTOIT_TITLE = @ScriptName & '_Interpreter'
    ; close any previous progress windows
    If WinExists($AUTOIT_TITLE) Then
    Do
    ; attempt to close the previous progress window
    WinClose($AUTOIT_TITLE)
    ; perform a sleep if window still exists
    If WinExists($AUTOIT_TITLE) Then
    Sleep(500)
    EndIf
    ; exit the loop if the window does not exist
    Until Not WinExists($AUTOIT_TITLE)
    EndIf
    ; set current window as the main interpreter window title
    AutoitWinSetTitle($AUTOIT_TITLE)
    ; if max is reached, then exit
    If $Counter = $Max Then
    Sleep(2000)
    Exit
    EndIf
    EndIf

    ; keep the current process running
    While 1
    Sleep(250)
    WEnd

    I expect that you will need to use Start without the wait switch in your CMD file to execute Actbar.exe so the CMD interpreter can progress to the next line of execution which the latter is the one that you want to wait for.

  4. Hi phaolo,

    There is no condition to keep the script running. A loop can be used to keep the script running and that is what I will use below.

    Here is some minor modifications to your code that may suit your need. Comments added to explain the steps of operation.


    If $CMDLINE[0] <> 2 Then
    ; Exit if 2 parameters were not used
    Exit 1
    Else
    ; assign parameters to friently variable names
    Global $Max = $CMDLINE[1]
    Global $Counter = $CMDLINE[2]
    ; show progress window
    ProgressOn("Status", "", "")
    ; set data to progress window
    ProgressSet(($Counter / $Max) * 100, "", "Completed " & ($Counter / $Max) * 100 & "%")
    ; title to use for the interpreter window title
    Global Const $AUTOIT_TITLE = @ScriptName & '_Interpreter'
    ; close any previous progress windows
    If WinExists($AUTOIT_TITLE) Then
    WinClose($AUTOIT_TITLE)
    WinWaitClose($AUTOIT_TITLE)
    EndIf
    ; set current window as the main interpreter window title
    AutoitWinSetTitle($AUTOIT_TITLE)
    ; if max is reached, then exit
    If $Counter = $Max Then
    Sleep(2000)
    Exit
    EndIf
    EndIf

    ; keep the current process running
    While 1
    Sleep(250)
    WEnd

    It will overlap the window of the previous execution of progress to prevent a pause between progress window updating and you can change it if it causes issue.

    I tested using this script and runs it from the desktop fine.


    Run('"' & @DesktopDir & '\actbar.exe" 10 2')
    Sleep(2000)
    Run('"' & @DesktopDir & '\actbar.exe" 10 4')
    Sleep(2000)
    Run('"' & @DesktopDir & '\actbar.exe" 10 6')
    Sleep(2000)
    Run('"' & @DesktopDir & '\actbar.exe" 10 8')
    Sleep(2000)
    Run('"' & @DesktopDir & '\actbar.exe" 10 10')

    :)

  5. Here is an example of retrieving the error message from an execution using Run().


    ; run a file that does not exist to produce error
    Run('I-do-not-exist.exe')
    ; check error status
    If @error And @extended Then
    ; get the error message
    $message = _FormatMessage(@extended)
    If Not @error Then
    ; show the error message
    MsgBox(0, Default, $message)
    EndIf
    EndIf

    Func _FormatMessage($iErrorcode)
    ; Finds the message definition in a message table resource
    Local $lpBuffer, $sMessage
    Local Const $FORMAT_MESSAGE_FROM_SYSTEM = 0x1000
    $lpBuffer = DllStructCreate('char[4096]')
    If @error Then Return SetError(1, 0, '')
    DllCall('kernel32.dll', 'int', 'FormatMessage', _
    'int', $FORMAT_MESSAGE_FROM_SYSTEM, _
    'ptr', 0, _
    'int', $iErrorcode, _
    'int', 0, _
    'ptr', DllStructGetPtr($lpBuffer), _
    'int', 4096, _
    'ptr', 0)
    If Not @error Then
    $sMessage = DllStructGetData($lpBuffer, 1)
    $lpBuffer = 0
    Return $sMessage
    Else
    $lpBuffer = 0
    Return SetError(2, 0, '')
    EndIf
    EndFunc

    :)

  6. Run(@ComSpec & " /c " & @ProgramFilesDir & '"\nsclient\pNSClient.exe" /install', "", @SW_HIDE)

    ...but it came up with a parsing error during run time.

    Yeah, you have a double quote in a bad place. Good practice to add a Msgbox prior to the function call with the command string in it to debug issues in the syntax.

    Your command string would evaluate to be

    C:\Windows\System32\cmd.exe /c C:\Program Files"\nsclient\pNSClient.exe" /install

    Some changes I made but the your lines of concern should be resolved.


    MsgBox(0, "Notice", "Line 2")
    ; run pNSClient.exe installation
    Run('"' & @ComSpec & '" /c "' & @ProgramFilesDir & '\nsclient\pNSClient.exe" /install', "", @SW_HIDE)
    ; call function every 250ms to check for error title
    AdlibEnable('_Error_check')
    Sleep(2000)
    MsgBox(0, "Notice", "Line 5")
    ; wait for Information title
    If WinWait("Information", "", 10) Then
    While Not WinActive("Information")
    ; activate the Information title
    WinActivate("Information")
    Sleep(500)
    If Not WinExists("Information") Then
    ; quit the loop if title does not exist
    ExitLoop
    EndIf
    WEnd
    ; progress if the title is active
    WinWaitActive("Information")
    Send("{ENTER}")
    EndIf
    Sleep(500)
    ; start a service
    Run('"' & @ComSpec & '" /c NET START "NetSaint NT Agent"', "", @SW_HIDE)
    MsgBox(0, "Notice", "Service Started")

    Exit

    Func _Error_check()
    If WinExists('Error') Then
    WinActivate('Error')
    If WinActive('Error') Then
    Send('{ENTER}')
    EndIf
    EndIf
    EndFunc

    Just changed to make use of AdlibEnable to handle the error window and other minor changes.

    :)

  7. I use it when everything else fails, why use autoit when it can be done with swiches etc.

    And your valid reasons being?

    I have a question for you. What is the difference between using a cmd file to run a file with switches and using a au3 file to run a file with switches?

    My answer is none, so long as you have both interpreters. AutoIt IMO gives you many more options to achieve your goal. So saying AutoIt is a last resort seems very illogical. AutoIt is far more then just an automation language and people who know this make very good use of AutoIt.

  8. Line 52 would be the DPsfnshr.exe file under GuiRunOnce, but if I remove that line, then I receive a Line 51 error for the install.bat.

    kzaman

    Hi,

    It could be a line ending character or similar whitespace character causing issues. I would view the file in a text editor like Scite or similar and activate the "view" --> "end of line" and "view" --> "whitespace". Then you may see something odd liike a LF that should be a CRLF on one of the lines to match the other lines.

    :)

  9. Not sure but perhaps the installer might be Java based or something. Differcult to know with the small amount of information suppled. The "Dcom Server Process Launcher" service is probably all that program disables and you can just use SC.exe to do that for you.

    Untested but I presume it will work for you.

    RunWait('sc stop DcomLaunch && sc config DcomLaunch start=disabled', '', @SW_HIDE)

    :)

  10. Strangely enough I tried it once to install a program and it did record keystrokes and mouse clicks successfully, but my virus scanner activated itself right in the middle of the installation and those mouse clicks and keystrokes to appease the virus scanner were recorded into the AutoIt script and when I tried to run the script, of course it didn't work.

    Thereafter I recorded over the old script and since then all it does is run the setup popup and goes no further.

    Are there any settings that I have implement in Process Guard or my router firewall to get Autoscript to work?

    Process Guard is advertised as a rootkit prevention application so I am unsure why it is an issue. As for a firewall, if you try to use InetGet() with AutoIt then any firewall should alert you and ask permission to allow.

    Does AutoIt implement ActiveX, Javascript, Java or DCOM? (I shut those off for security reasons)

    AutoIt does hamdle Com, Dom and ActiveX objects but you need to create the objects first before any issue can relate to the use of them. AutoIt is easy target for Antivirus programs as some virus writers tend to use AutoIt for their use. You may need to clear false positives with your AV vendor if a false positive happens to you.

    I would really like to have a better understanding of the program. Isn't there anyone out there that can help me understand this?

    If you want some basic help with AutoIt, then a forum full of helpers exist at the AutoIt Forums. I and others here can help with specific questions here but if you want to learn the language good then consider joining the AutoIt forum so many experienced people with AutoIt can help you.

    :)

  11. For me, I prefer microsoft's splitstreamed sp3 version

    OMG :angry: Now I prefer also Microsoft's slipstream version of Windows XP.

    Now I think VLK users should slipstream SP3 on SP0 (RTM)

    and OEM and Retail users should go for SP1 or SP2 to slipstream SP3...and after slipstreaming, delete SP1.cab n SP1.cat and SP2.cab n SP2.cat from I386 folder and WIN51IP.SP2 from the root of XPCD.

    It saves some bytes of Windows XP CD....and no need to worry...SP3 slipstreamed CD will rocks

    Sorry to say, but *cough* someone who considers themselves as a "Microsoft® MVP" within their title and using "Vista Utimate" (Defective by design) does leave a concern to the protest. I hope you do not pay the MS tax as some do to protest against unreasonable corporations like Microsoft. Windows XP SP3 mainly exists to be able to talk to Vista on a network. Yes, I did pay the Vista tax and am disgusted now as I refuse to use it.

    Be well and choose your future through your/others actions.

  12. According to the guide this file was supposed to be copied during the installation into the system32 directory, but for some reason it isn't being copied.

    So the obvious question is: Why isn't the file not being copied? Or should I say what am I doing wrong? :blink:

    Ensure that OemPreinstall=Yes within Winnt.sif as mentioned here within the unattended guide.

    You can use another language to hide the window or totally replace the cmd script. AutoIt can do a better job at hiding the window. The demonstration code below show how the window can hidden without any flicker.


    ; create a test CMD file
    FileWrite('test.cmd', 'pause')

    ; show window then close
    $pid = Run('test.cmd')
    Sleep(5000)
    ProcessClose($pid)

    Sleep(1000)

    ; hide window then close
    $pid = Run('test.cmd', '', @SW_HIDE)
    Sleep(5000)
    ProcessClose($pid)

    ; remove test CMD file
    FileDelete('test.cmd')

    MsgBox(0x40000, '', 'Demonstration finished')

    Exit

    or compile your own window hide exe from the below code


    ; Usage: CompiledScript.exe "path/to/test.cmd"

    If $CMDLINE[0] Then
    Const $FILE = $CMDLINE[1]
    If FileExists($FILE) Then
    If StringRight($FILE, 4) = '.bat' Or StringRight($FILE, 4) = '.cmd' Then
    RunWait('"' & $FILE & '"', '', @SW_HIDE)
    EndIf
    EndIf
    EndIf

    Or perhaps try WScript.exe using VBScript or JScript. Or some other language.

    :)

  13. ...

    If I put in a line at the end of my RunOnceEx that looks like this:

    REG ADD %KEY%\095 /V 1 /D "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce /v command0 /d regedit /s %systemdrive%\install\regtweaks2.reg" /f

    You have wrapped a portion within quotes to be treated as 1 string but it includes switches as the bold text shows below.

    REG ADD %KEY%\095 /V 1 /D "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce /v command0 /d regedit /s %systemdrive%\install\regtweaks2.reg" /f

    Portions that can be quoted as strings are

    SET KEY=HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce

    REG ADD "%KEY%" /v "Regtweaks2" /d "regedit /s %systemdrive%\install\regtweaks2.reg" /f

    The strings that contain spaces may only require quotes as a general rule. RunOnce key does not use sub keys like the RunOnceEx key, so omit the use of them in the RunOnce key.

    :)

  14. Some use this method. This will work so long as the versions are not padded with leading zeros.


    If Not FileExists('file1.txt') And Not FileExists('file2.txt') Then
    ; create test files
    If FileWrite('file1.txt', '2.1.1.0') And FileWrite('file2.txt', '1.1.1.0') Then
    ConsoleWrite('Test files written' & @CRLF)
    EndIf

    ; Read test files and compare versions
    $file1 = StringStripWS(FileRead('file1.txt'), 3)
    $file2 = StringStripWS(FileRead('file2.txt'), 3)
    If $file1 > $file2 Then
    MsgBox(0x40000, '', $file1 & ' > ' & $file2 & @CRLF)
    EndIf

    ; remove test files
    If FileDelete('file1.txt') And FileDelete('file2.txt') Then
    ConsoleWrite('Test files removed' & @CRLF)
    EndIf
    EndIf

    To have a more thorough method then use StringSplit to split the version into elements that can be compared numerically.


    If Not FileExists('file1.txt') And Not FileExists('file2.txt') Then
    ; create test files
    If FileWrite('file1.txt', '2.1.1.0') And FileWrite('file2.txt', '2.2.1.0') Then
    ConsoleWrite('Test files written' & @CRLF)
    EndIf

    ; Read test files and compare versions
    $file1 = FileRead('file1.txt')
    $file2 = FileRead('file2.txt')
    If _HigherVersion($file1, $file2) And Not @error Then
    MsgBox(0x40000, '', 'Higher version')
    ElseIf @error Then
    MsgBox(0x40000, 'Error', @error)
    EndIf

    ; remove test files
    If FileDelete('file1.txt') And FileDelete('file2.txt') Then
    ConsoleWrite('Test files removed' & @CRLF)
    EndIf
    EndIf

    Func _HigherVersion($current, $update)
    $current = StringSplit($current, '.')
    If @error Then Return SetError(1, 0, '')
    $update = StringSplit($update, '.')
    If @error Then Return SetError(1, 0, '')
    If $current[0] <> $update[0] Then Return SetError(2, 0, '')
    For $i = 1 To $current[0]
    If Int($current[$i]) = Int($update[$i]) Then
    ContinueLoop
    ElseIf Int($current[$i]) < Int($update[$i]) Then
    Return True
    EndIf
    Next
    EndFunc

    :)

  15. Perhaps you do not have Reg.exe on Windows 2000? I looked at Windows 2000 source files and I cannot see Reg.exe in a cab file. I looked at a website here and quote the vital information below.

    The Microsoft ® Windows NT ® Server 4.0 Resource Kit contains, among many others, REG.EXE.

    In Windows 2000 REG.EXE is available on the Windows installation CD-ROM, but has to be installed manually (on the CD-ROM run "\SUPPORT\TOOLS\SETUP.EXE").

    As of Windows XP, REG.EXE is a native command.

    I see it within the "\SUPPORT\TOOLS\SUPPORT.CAB" that SETUP.EXE with the same folder probably extracts. I feel sorry for all the testing that you have done only to find out Reg.exe is perhaps missing for use. :blink: You maybe able to copy needed files into "$OEM$\$$\System32" using the OEMPreinstall option in Winnt.sif.

  16. Business object 6.5.4 Hotfix 81 is the application name

    If you search the website of Business object, then you may find they have good support to answer you question. I downloaded a PDF here that shows you a picture of the installation and I can see InstallShield branded on the window. It also tells you where to get information about silent install by searching for KB article c2014706 found here which lists InstallShield switches to use. The website seems to require IE to view so use IETab in Firefox or IE to view.

    actually its not working for any setup.exe.

    I tried with other and got the same error...

    though i have kept peid.exe in the same folder as USSF.exe

    when i run peid.exe its doesnt give any option to find the commandline...

    actually i dont kno how to use this...

    can also tell me the procedure please..

    If PEiD does not identify it then you will need to search for switches yourself. Look for branding etc when starting a manual installation to notice installer type used. Only several installer types support switches thus automation or repacking... etc may need to occur for unattended installation for those that do not support switches.

    :)

  17. here's my cmdline.txt (edited to multi line)

    cmdlineS.txt

    Perhaps just a typo mistake as you got the filename correct in the topic title but failed in your previous post. But that is all it takes for something to go wrong if you named it cmdline.txt which setup may not recognize. The entries seem fine. You can remove the "rundll32.exe iernonce.dll,RunOnceExProcess" entry from runonceex.cmd as that seems not the issue.

    ROE.exe is BTS's driverpacks finisher. and it's the only thing that runs in first logon

    Well, that is the 1st entry of cmdlines.txt and you state it works. Strange... try changing the entry order.

    [COMMANDS]
    "runonceex.cmd"
    "themes.cmd"
    "REGEDIT /S regtv1.reg"
    "ROE.exe 937"

    If you need to for debugging, try to add an entry of "REGEDIT" in cmdlines.txt and check the RunOnceEx key to ensure the entries were added at T-12.

  18. Sorry, i don't know the answer to your problem, but atleast i can tell you that 'RunOnceEx' + multi-line 'cmdlines.txt' entries does work on Win2K also...

    Looks like I have been corrected. Thanks for informing.

    @larciel

    I amended your script with changes suggest by Yzöwl. You can also use goto a label to jump over lots of comments so the interpreter quickly skips them and is good for header comments at the top of your script.


    cmdow @ /HID
    @echo off
    goto :main
    :: RegKey
    :: 1-10 - Drivers
    :: 15-25 - System Related
    :: 26-35 - nero adobe media

    :main
    FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (
    IF EXIST %%i:\CDROM_NT.5 SET CDROM=%%i:
    )

    SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

    REG ADD %KEY% /V TITLE /D "Installing Applications" /f

    :: REG ADD %KEY%\001 /VE /D "" /f
    :: REG ADD %KEY%\001 /V 1 /D "%systemdrive%\none1.bat" /f

    :: REG ADD %KEY%\002 /VE /D "" /f
    :: REG ADD %KEY%\002 /V 1 /D "REGEDIT /S %systemdrive%\regtv1.reg" /f

    REG ADD %KEY%\003 /VE /D "" /f
    REG ADD %KEY%\003 /V 1 /D "%systemdrive%\themes.cmd" /f

    REG ADD %KEY%\004 /VE /D "" /f
    REG ADD %KEY%\004 /V 1 /D "%CDROM%\wpi\wpi.hta" /f

    REG ADD %KEY%\937 /VE /D "Finishing Installation 0 of 3" /f
    REG ADD %KEY%\937 /V 1 /D "%SystemDrive%\DPsFnshr.exe" /f

    REG ADD %KEY%\938 /VE /D "Finishing Installation 1 of 3" /f
    REG ADD %KEY%\938 /V 1 /D "%systemdrive%\none1.bat" /f

    REG ADD %KEY%\939 /VE /D "Finishing Installation 2 of 3" /f
    REG ADD %KEY%\939 /V 1 /D "%CDROM%\winapp\cmd2.cmd" /f

    REG ADD %KEY%\940 /VE /D "Finishing Installation 3 of 3" /f
    REG ADD %KEY%\940 /V 1 /D "%CDROM%\winapp\finish.cmd" /f

    :: REG ADD %KEY%\0 /VE /D "" /f
    :: REG ADD %KEY%\0 /V 1 /D "%CDROM%\winapp\" /f

    EXIT

    I tested adding into my registry within XP (looked good viewed in regedit) and then running iernonce.dll manually to invoke RunOnceEx and it performs as well as expected. So there maybe something else causing the issue. Perhaps a good idea to check the Cmdlines.txt file (ensure the name is correct and entries within are correct).

×
×
  • Create New...