Jump to content

MHz

Member
  • Posts

    1,691
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Australia

Everything posted by MHz

  1. You will find that subroutines do not return a value so do not use brackets. On the use of functions with storing the returned value into a variable, then you may need to use brackets. I keep to that concept and has proven consistent with good results. So this should be fine subroutine "parameter" and this variable = function("parameter") The below (reversed usage of brackets) will occur error that I would expect. subroutine ("parameter") and this variable = function "parameter" So if it returns a value, then use brackets, else do not. I'm not sure by my memory atm about the following, but if you do not store the value of a function return, then do not use brackets (like a subroutines behavior) to avoid error. A function may require brackets if used with an IF statement like below to also avoid error. If function("parameter") Then Edit: Added last sentence about using IF statement
  2. MHz

    CMenu

    I sent a request to Kaspersky Virus Lab to check for being false positive. Thank you Edit: I have been informed that the message is a warning only as the keywords in the description are "not a virus". The file that is being flagged is TheHook.dll which is used by AutoItMacroGenerator02.exe to enable the recording ability of the desktop shell. To the best of my knowledge, AutoItMacroGenerator02.exe is not using the TheHook.dll in a malicious manner. The warning is shown and the end user needs to decide whether to trust.
  3. If you have the full Scite4AutoIt3 editor installed then selecting "Compile" (Ctrl+F7) will show the dialog else selecting "Build" (F7) will compile without prompt (as long as no errors are detected). With some changes to the code you posted, the script worked for me. Stopping at the 1st window may have been because the window did not activate. My changes to the code forces the window to activate. The Do Untill loop is illogical as 1 will never equal 2 and no condition allows the exit of the loop so the loop will forever loop. i replaced the loop as I do not see a need for a loop with the code. The code shows a lack of using the text parameters and I would advise the use of them to ensure the script operates with the correct window with each execution. I have not done the previous mention of text parameter changes so you can use some time to improve on this. Posted script with changes made #RequireAdmin If WinExists(@ScriptName) Then Exit AutoItWinSetTitle(@ScriptName) AutoItSetOption("TrayIconDebug", 1) ; AutoItSetOption("SendKeyDelay", 20) Global $title = 'Avira AntiVir Personal - Free Antivirus' Global $file = 'avira_antivir_personal_en.exe' ; Use quoted double quotes to prevent issues with spaces in the path $pid = Run('"' & @ScriptDir & '\' & $file & '"') If @error Then Exit 1 ; WinWait is usually adequate for Control* functions to operate correct WinWait($title, "") ControlClick($title, "Continue", "Button1") WinWait($title, "This wizard will install Avira AntiVir Personal") Send("!n") WinWait($title, "") ControlClick($title, "&Next >", "Button2") ; Ensure window is active for Send function to operate correct _WinWaitActive($title, "Licence agreement Avira AntiVir Personal") Send("!a") ControlClick($title, "&Next >", "Button3") WinWait($title, "Please confirm that you will use"); ...not for commercial use ControlClick($title, "", "Button2") ControlClick($title, "&Next >", "Button5") WinWait($title, "Select the program features you want to install") ControlClick($title, "C&omplete", "Button1") ControlClick($title, "&Next >", "Button7") WinWait($title, "Yes, I would like to subscribe to the Avira newsletter") ControlClick($title, "", "Button2") ControlClick($title, "&Next >", "Button5") WinWait($title, "Installation complete") ControlClick($title, "Show readme.txt", "Button1") ControlClick($title, "Finish", "Button12") ; Wait for up to 60 seconds for config window If WinWait("Configuration wizard", "", 60) Then ControlClick("Configuration wizard", "", "Button2") WinWait("Configuration wizard", "") ControlClick("Configuration wizard", "", "Button6") WinWait("Configuration wizard", "") ControlClick("Configuration wizard", "", "Button8") WinWait("Configuration wizard", "") ControlClick("Configuration wizard", "", "Button10") WinWait("Configuration wizard", "") ControlClick("Configuration wizard", "", "Button1") WinWait("Configuration wizard", "") ControlClick("Configuration wizard", "", "Button11") WinWait("Configuration wizard", "You have now specified the basic configuration") ControlClick("Configuration wizard", "", "Button12") EndIf ; Wait up to 60 seconds for previous Run process to close ProcessWaitClose($pid, 60) Exit Func _WinWaitActive($title, $text = '') ; Window wait, activate and then wait until active WinWait($title, $text) WinActivate($title, $text) WinWaitActive($title, $text) EndFunc
  4. If you go into the help menu of MPC (I have the mpc homecinema version so hopefully same), you will see a "Command Line Switches" entry which pops up a window with all switches available to pass to mplayerc.exe. Use the switch "/regvid" to associate all video types to MPC. You could try to run the command from a NSIS script or do it with an external command after installation.
  5. The path used in your CMD script seems strange for a desktop shortcut path. If you will check the additions that I added to the previous script from radix, then you notice that removal of all associated desktop shortcuts are removed by the code block shown below So, is there an issue with a WinAmp desktop shortcut still existing after execution of the script?
  6. Hi, Perhaps it is how you are missing some window waits before using Send() that maybe causing the issue. I have cleaned up your code some and made some minor changes. Hopefully it may solve your problem. You could use FileDelete to remove any shortcuts and DirRemove to remove the group folder from the startmenu. I would also delete the toolbar installer if possible (something for you to consider). #RequireAdmin Opt ('SendKeyDelay', 1500); pauses between sent keystrokes Opt ('TrayIconDebug', True) $pid = Run ("winamp.exe") If @error Then Exit 1 ;Language _WinWaitActive ("Installer Language" , "") Send ("{ENTER}") ;Välkommen till installationsprogrammet för Winamp _WinWaitActive ("Installationsprogram för Winamp" , "") ControlClick ("Installationsprogram för Winamp" , "" , "Button2") ;Licens _WinWaitActive ("Installationsprogram för Winamp" , "") ControlClick ("Installationsprogram för Winamp" , "" , "Button2") ;Installationsprogram för Winamp _WinWaitActive ("Installationsprogram för Winamp" , "") ControlClick ("Installationsprogram för Winamp" , "" , "Button2") ;Välj komponenter _WinWaitActive ( "Installationsprogram för Winamp" , "" ) Send ("{TAB}{DOWN}{SPACE}{DOWN}{SPACE}{DOWN}{SPACE}{DOWN}{SPACE}") ControlClick ( "Installationsprogram för Winamp" , "" , "Button2") ;Välj startalternativ _WinWaitActive ( "Installationsprogram för Winamp" , "" ); added (correct title?) Send ("{TAB 3}{SPACE}{DOWN}{SPACE}{DOWN}{SPACE}") ControlClick ( "Installationsprogram för Winamp" , "" , "Button2") ;Utnyttja hela potentialen hos Winamp _WinWaitActive ( "Installationsprogram för Winamp" , "" ); added (correct title?) Send ("{TAB 2}{DOWN}{SPACE}{DOWN}{SPACE}{DOWN}{SPACE}") ControlClick ( "Installationsprogram för Winamp" , "" , "Button2") ;Installationen är klar Sleep(4000) _WinWaitActive ("Installationsprogram för Winamp" , "") Send ("{ENTER}") ;Välj Skal _WinWaitActive ("Installera Winamp" , "") ControlClick ("Installera Winamp" , "" , "Button5") ;Inställningar _WinWaitActive ( "Installera Winamp" , "" ) Send ("{DOWN 2}{RIGHT}{DOWN}{SPACE}{DOWN}{SPACE}") ControlClick ( "Installera Winamp" , "" , "Button5") ;Sista inställnigar _WinWaitActive ( "Installera Winamp" , "" ) Send ("{TAB 3}{SPACE}") ControlClick ( "Installera Winamp" , "" , "Button6") ProcessWaitClose($pid, 300) ;Waits for winamp to start, then silently kills it If ProcessWait('winamp.exe', 120) Then For $i = 1 To 2 ProcessClose('winamp.exe') If Not ProcessExists('winamp.exe') Then ExitLoop EndIf Sleep(1000) Next EndIf Exit Func OnAutoItStart() ; single script instance only If WinExists(@ScriptName & '_Interpreter') Then Exit AutoItWinSetTitle(@ScriptName & '_Interpreter') EndFunc Func _WinWaitActive($title, $text = '') ; window wait functions WinWait($title, $text) WinActivate($title, $text) WinWaitActive($title, $text) EndFunc
  7. Hi from Australia I am not sure if I understand correct but perhaps this may help you. It is cleaned up and added some possible improvements. Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) ; close instance of bsplayer.exe If ProcessExists("bsplayer.exe") Then ProcessClose("bsplayer.exe") EndIf ; use quoted double quotes with paths that contain spaces $pid = Run('"BSPlayer PRO 2.27.959.exe"') ; if Run() sets @error then exit If @error Then Exit 1 _WinWaitActive("BS.Player PRO Setup", "Please review the li") Send("{ENTER}") _WinWaitActive("BS.Player PRO Setup", "Welcome to the BS.Pl") Send("{ENTER}") _WinWaitActive("BS.Player PRO Setup", "Choose which feature") Send("{ENTER}") _WinWaitActive("BS.Player PRO Setup", "Choose Install Locat") Send("{ENTER}") _WinWaitActive("BS.Player PRO Setup", "Additional install o") Send("{ENTER}") _WinWaitActive("BS.Player PRO Setup", "Select default langu") Send("{DOWN 23}{ENTER}") _WinWaitActive("BS.Player PRO Setup", "Installation Complet") Send("{ENTER}") _WinWaitActive("BS.Player PRO Setup", "Completing the BS.Pl") Send("{ENTER}") _WinWaitActive("Información de Registro", " Registro de BSp") Send("{SHIFTDOWN}xxx{SHIFTUP}xxxxx{TAB}xxxxxxxxxx{ENTER}{TAB}{ENTER}") _WinWaitActive("Información", "Gracias por registra") Send("{ENTER}") ;Cierra Aplicacion ProcessWait("bsplayer.exe", 10) ProcessClose("bsplayer.exe") ProcessWaitClose($pid) Exit Func OnAutoItStart() ; run one script instance only If WinExists(@ScriptName & '_Interpreter') Then Exit AutoItWinSetTitle(@ScriptName & '_Interpreter') EndFunc Func _WinWaitActive($title, $text = "") ; window wait functions WinWait($title, $text) WinActivate($title, $text) WinWaitActive($title, $text) EndFunc
  8. Hi Alpha_95 I do not have version 7 but I would presume that the installer type and techniques are the same as previous builds. The Nullsoft Scriptable Install System (NSIS) is used by most install package creators to follow the standard methods. Since NSIS can be customized then this allows some install package creators to be more inconsiderate towards the end-users and create unfriendly installers. CMenu identified the installer correct but the install package creator chose that you get what they customized with using NSIS. The DivX.com organization has chosen to be like this since they became a commercial entity. If you are interested in just the codec to decode and/or encode then I would suggest XviD or Ffdshow which are Inno Setup installers that give you the freedom to install with standard switches that Inno Setup offers. Either of the above will handle DixX files. Ffdshow handles many more codec types as well which you may know as a bundle of codecs. If you wish to persist with the DivX installer then you can search for AutoIt automated scripts posted in the forum or perhaps repack the installer and make it more friendly to install. Edit: Added missing word from a sentence
  9. Hi, An ini file is a txt file that is structured to get and/or store information easily so I would be recommending that method to you unless you have special needs. example code ; ini file name to use $file_ini = 'my program settings.ini' ; create ini file if not exists If Not FileExists($file_ini) Then IniWrite($file_ini, 'gmail', 'username', '') IniWrite($file_ini, 'gmail', 'password', '') EndIf ; read ini file values form gmail section $username = IniRead($file_ini, 'gmail', 'username', '') $password = IniRead($file_ini, 'gmail', 'password', '') ; show result MsgBox(0, Default, '$username = ' & $username & @CRLF & '$password = ' & $password) ; example of checking for non empty values for both values If $username <> '' And $password <> '' Then MsgBox(0, Default, 'both variables have values worth using') EndIf
  10. The reason that WHILE/WEND was outed in "VBScript" as it is tested once at the start. DO/WHILE also gives the option at the start or end of the loop. When tested "Do While" or "Loop While" gives more options for you as a programmer. Edit: Keyword change
  11. The dialogs already exist during setup so I fail to see the relevance stated about "slowing" down the install. The dialogs are behind the billboard that covers them up. Info here shows you how to remove the billboard so the dialogs are seen without any other action needed nor any resources wasted. Here is an AutoIt script that may help if you want to keep the billboard. Changes maybe needed depending on the state and reaction of the windows. Resources wasted would be very little to notice. $title = 'Windows XP Professional Setup' _WinWaitSetState($title, 'Installing Devices') _WinWaitSetState($title, 'Network Settings') _WinWaitSetState($title, 'Installing Components') _WinWaitSetState($title, 'Performing Final Tasks') Exit Func _WinWaitSetState($title, $text = '', $flag = @SW_SHOW) WinWait($title, $text) WinSetState($title, $text, $flag) WinActivate($title, $text) EndFunc
  12. Another option. Using CMD in WinNT based systems is safe to use multiline statements so this avoids the goto feature. %systemroot%\system32\msiexec.exe /q /x {76B2BC31-2D96-4170-9C44-09E13B5555F3} /norestart If Not Exist "%Programfiles%\Sophos\savmain.exe" ( \\ln-co-avs01\InterChk\ESXP\setup.exe -mng yes -user domain\username -pwd Pass#123 -s ) Using Start /Wait is another option that gunsmokingman mentions that could be needed though I test without first up to see if successful. You can use the command 'If /?' at a command prompt to learn the usage of 'If'. 'Goto' is rather redundant in many of the latest programming languages so is perhaps good to avoid using if possible IMO unless you service 9x or earlier systems with scripts.
  13. Sorry for late reply. I would like to comment that using XP 32 bit I had no problems at all with scripting SAPI with AutoIt or VBScript. Under Vista 32 Bit is little joy as the sound drivers that I have are not good in certain sound generation methods used. I use the Creative card and drivers that are not quite there yet for the card that i have. Perhaps some similar issues is your recognition of disappointment with using scripts to using SAPI?
  14. You can use VBScript or AutoIt 3 to access the SAPI object. Here is a AutoIt example that can be compiled to say.exe and use a CLI switch to run it i.e. say.exe "this is a test parameter". The VBScript syntax is similar to translate to. If $CMDLINE[0] = 1 Then ; call function using cli parameter _Say($CMDLINE[1], 1, 100) Else ; else call function with a warning _Say('No parameters used') EndIf Func _Say($sText, $iRate = 1, $iVolume = 100) ; use sapi text to speech If $iRate > 10 Or $iVolume > 100 Then Return Local $oTalk = ObjCreate('SAPI.SpVoice') If Not @error Then With $oTalk .Rate = $iRate .Volume = $iVolume .Speak($sText, 1) .WaitUntilDone(500) .Pause() Sleep(1000) .Resume() .WaitUntilDone(-1) EndWith EndIf EndFunc
  15. I believe that iamtheky was refering to a script like this ; extract Alcohol installer from the AutoIt executable and put it in the temp folder If FileInstall("Alcohol1.9.8.7117.exe", @TempDir & '\Alcohol1.9.8.7117.exe') Then ; execute Alcohol installer with silent switches RunWait('"' & @TempDir & '\Alcohol1.9.8.7117.exe" /qn /REBOOT=ReallySuppress', @TempDir) ; pause for half second Sleep(500) ; remove temp copy of Alcohol installer FileDelete(@TempDir & '\Alcohol1.9.8.7117.exe') EndIf The Alcohol installer is stored with in the AutoIt created executable when compiled. This means that you only need the AutoIt executable and not the Alcohol installer as the Alcohol installer is with in the AutoIt executable and the Alcohol installer will be extracted to Temp dir when executed and will install Alcohol and then delete the Alcohol installer.
  16. MHz

    CMenu

    I have added a link to the current CMenu homepage in the 1st post so details of the MD5 etc can be viewed there.
  17. Welcome, Perhaps the application setup files are not copied over at textmode part of setup. You may need to set OemPreinstall=Yes in your unattended answer file and to have your application setup files in the $OEM$ Distribution Folders.
  18. The window that appears briefly is probably stealing focus from your waiting window and since you make no attempt to activate the window then your script may stall in waiting for the window to activate. You do not seem to require the window to be active as you are using ControlClick() only so you may just use WinWait() instead of WinWaitAcitive(). If you want to use WinWaitActive() in an unattended install script then I would advise to force activation of the windows to prevent your script from stalling. Comments added to code $pid = Run("setup.exe") ; check error if setup.exe fails If Not $pid And @error Then Exit 1 EndIf ; use a user defined function to wait, activate and then wait until active with the window _WinWaitActive("Choose Setup Language") Send("{ENTER}") $title = "FileMaker Pro 8.5 Advanced Setup" _WinWaitActive($title) Sleep(5000) ControlClick($title, "Welcome to the InstallShield Wizard for FileMaker Pro 8.5 Advanced", "&Next >") _WinWaitActive($title, "Customer Information") Send("Admin") Send("{TAB 2}") Send("36F34" & "69C76" & "E4934" & "8BF70" & "0A54A" & "8FDD3" & "A6C11") ControlClick ($title, "Customer Information", "&Next >") ; using WinWait with Control* functions as is normally sufficient WinWait($title, "License Agreement") ControlClick($title, "License Agreement", "I &accept the terms in the license agreement") ControlClick($title, "License Agreement", "&Next >") WinWait($title, "Destination Folder") ControlClick($title, "Destination Folder", "&Next >") WinWait($title, "Application Shortcuts") ControlClick($title, "Application Shortcuts", "&Next >") WinWait($title, "Setup Type") ControlClick($title, "Setup Type", "&Next >") WinWait($title, "Ready to Install the Program") ControlClick($title, "Ready to Install the Program", "&Install") WinWait($title, "InstallShield Wizard Completed") ControlClick($title, "InstallShield Wizard Completed", "&Finish") ; title correction as you may have made an error as titles were different WinWait("FileMaker Product Registration") ControlClick("FileMaker Product Registration", "", "&Cancel") WinWait("Registration is not completed") ControlClick("Registration is not completed", "", "&Yes") ; a process may take a moment to finish after the last window so added a wait ProcessWaitClose($pid, 10) Exit Func _WinWaitActive($title, $text = "") ; UDF to wait, activate and wait until active WinWait($title, $text) Sleep(250) WinActivate($title, $text) WinWaitActive($title, $text) EndFunc Func OnAutoItStart() ; 1 script instance only If WinExists(@ScriptName & '_Interpreter') Then Exit AutoItWinSetTitle(@ScriptName & '_Interpreter') EndFunc I replaced the common title string with the variable $title to account for the repetition.
  19. I would look use the switch -uv for it's mention of DVD compatibility but it mentions to not be combined with other mentioned switches which you display in your command line usage. AFAIK, OSCDIMG 2.54 is similar to CDIMAGE 2.54. ImageX is possibly the latest OS imager that MS uses though it may not suit your needs with Video DVDs.
  20. This conditional test is for checking if command line parameters were used and if so will be non zero. If $CMDLINE[0] then Switch $CMDLINE[1] Case 'help', '/?', '-?', '/help' _DisplayHELP() Case 'open' ToolTip ( "Ejecting "&$DVDLetter&" tray...", @DesktopWidth/2 , @DesktopHeight/2 , "DVDTray" , 0,1 ) CDTray($DVDLetter, 'open') Case 'close' ToolTip ( "Closing "&$DVDLetter&" tray...", @DesktopWidth/2 , @DesktopHeight/2 , "DVDTray" , 0,1 ) CDTray($DVDLetter, 'closed') EndSwitch Else _DisplayHELP() Endif And you could add a Case Else condition to show help if a unrecognized command line parameter was passed. If $CMDLINE[0] then Switch $CMDLINE[1] Case 'help', '/?', '-?', '/help' _DisplayHELP() Case 'open' ToolTip ( "Ejecting "&$DVDLetter&" tray...", @DesktopWidth/2 , @DesktopHeight/2 , "DVDTray" , 0,1 ) CDTray($DVDLetter, 'open') Case 'close' ToolTip ( "Closing "&$DVDLetter&" tray...", @DesktopWidth/2 , @DesktopHeight/2 , "DVDTray" , 0,1 ) CDTray($DVDLetter, 'closed') Case Else _DisplayHELP() EndSwitch Else _DisplayHELP() Endif
  21. Be sure to read the MSFN Unattended Guide. It has the answer that you seek. The advice given by Martin H is critical for installing InstallShield from read only media as InstallShield by default tries to create a log file in its own directory when run as silent mode and may cause the install to fail if the log cannot be written.
  22. Hi bingelman, I am going to guess what you are referring to as your explanation seems very brief. There are 2 types of installs that support recording, being Inno Setup and InstallShield. The configuration file for Inno Setup is read when the AutoIt script is generated. The configuration file can then be discarded. The configuration file for InstallShield is used depending on the script generated as the setup maybe packed or unpacked. If you would like, then just PM me the script generated and I will have a look at it to allow me to give you some better advise.
  23. I am not sure what application and hotkeys has to do with an installation. Overriding hotkeys seems like acting against the flow so may I suggest asking these general questions at the AutoIt Forums where someone experienced with hotkeys and any other general questions can answer you.
  24. A function needs to return before you can call another function so that hinders your attempt. AutoIt3 runs code from a script line by line so trying to run 2 blocks of code at the exact same time cannot be done unless timers or other is used. The easiest solution would be to rearrange your code to use 1 loop to handle the conditions of concern at that time. #include <GuiConstants.au3> Dim $MID, $Color HotKeySet('{F8}', '_HotKeyPressed') HotKeySet('{F9}', '_HotKeyPressed') Opt('MouseCoordMode', 1) Opt('PixelCoordMode', 1) GUICreate('Test', 300, 100) $label_coords = GUICtrlCreateLabel('Mouse coordinates:', 20, 20, 260, 20) $label_color = GUICtrlCreateLabel('Hex color:', 20, 50, 260, 20) GUISetState() While 1 If GUIGetMsg() = -3 Then ExitLoop EndIf $pos = MouseGetPos() $var = PixelGetColor($pos[0], $pos[1]) If $MID Then GUICtrlSetData($label_coords, 'Mouse coordinates: X = ' & $pos[0] & ' Y = ' & $pos[1]) EndIf If $Color Then GUICtrlSetData($label_color, 'Hex color: ' & Hex($var, 6)) EndIf WEnd Func _HotKeyPressed() If @HotKeyPressed = '{F8}' Then $MID = Not $MID ElseIf @HotKeyPressed = '{F9}' Then $Color = Not $Color EndIf EndFunc
×
×
  • Create New...