Jump to content

7 Zip Script does't work on a Netherland XP


Recommended Posts

Hello,

on my german XP Station i create this script:

Run("7z920.exe")

WinWaitActive("7-Zip 9.20 Setup")

Send("{ENTER}")

WinWaitActive("7-Zip 9.20 Setup","&Finish")

Send("{ENTER}")

Run("C:\Programme\7-Zip\7zFM.exe")

WinWaitActive("7-Zip Dateimanager")

Send("{ALTDOWN}")

Send("!e")

Send("!o")

Send("{ALTUP}")

WinWaitActive("Optionen")

Send("!m")

Send("{TAB}")

Send("{TAB}")

Send("{ENTER}")

WinWaitActive("7-Zip Dateimanager")

Send("{ALTDOWN}")

Send("!d")

Send("!e")

Send("{ALTUP}")

On my netherland test system i try this.

The installations starts and the script stops here:

Run("C:\Programme\7-Zip\7zFM.exe")

I change the line to

Run("C:\Program Files\7-Zip\7zFM.exe")

but this doesn't solve my problem.

Any idea why my script stops at this point?

Thanks

Dennis

Link to comment
Share on other sites

  • Moderators

Hi, SirHaschke. What is the error (console output) when you get to this point in your script?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Link to comment
Share on other sites

Maybe

If StringInStr(@OSArch, "64") Then

Run(StringLeft(@ProgramFilesDir, 3) & "Program Files (x86)7-Zip7zFM.exe")

Else

Run(@ProgramFilesDir & "7-Zip7zFM.exe")

EndIf

?

Edited by KaFu
Link to comment
Share on other sites

  • Moderators

SirHaschke, what is the output if you run the code below?

MsgBox(0, "", @ProgramFilesDir)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Afaik the directories are hardcoded for localized XP versions.

MsgBox(0,"",@ProgramFilesDir)

MsgBox(0,"",RegRead("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersion","ProgramFilesDir"))

On Win7 however I think localization is done via hard-links so that both the default "program files" and the localized version should be accessible.

Link to comment
Share on other sites

I believe 7-Zip detects the system language, in which case you will have to change the strings in the script as well or change the language when the script is done.

As an aside you might want to use the Control* functions instead of Send.

I put together an example script which you could modify to install in one language and change it to another afterwords, or install in different languages on different sytems.

Global Const $asStrings[4] = ['en', 'Options', '&Tools', '&Options...'] ; $aDE
Global Const $sInstallDir = @ProgramFilesDir & "7-Zip" ; path to install directory

Do ; close any opened instances of 7z
Until Not ProcessClose("7z.exe") And Not ProcessClose("7zFM.exe") And Not ProcessClose("7zG.exe")

RunWait("7z920.exe /S /D=""" & $sInstallDir & "") ; run the installer with the silent switch /S

RegWrite("HKCUSoftware7-Zip", "Lang", "REG_SZ", $asStrings[0]) ; set language to 'en' for English, default = System Language
Local $iPID = Run($sInstallDir & "7zFM.exe") ; run the filemanager
Local $hWin = WinWait("[TITLE:7-Zip; CLASS:FM; INSTANCE:1]") ; wait until the window exists
WinMenuSelectItem($hWin, "", $asStrings[2], $asStrings[3]) ; open options window
Local $hWinOpts = WinWait("[TITLE:" & $asStrings[1] & "; CLASS:#32770; INSTANCE:1]") ; wait until the options window exists
ControlClick($hWinOpts, "", "[CLASS:Button; INSTANCE:1]", "primary") ; click the select all button
Sleep(300) ; give the changes time to take effect
ControlClick($hWinOpts, "", "[CLASS:Button; INSTANCE:2]", "primary") ; click OK, applies changes and closes window
Sleep(500) ; give the changes time to take effect
ProcessClose($iPID) ; close file manager
;~ RegWrite("HKCUSoftware7-Zip", "Lang", "REG_SZ", 'de') ; write the final language code to the registry
;~ Run($sInstallDir & "7zFM.exe") ; open the file manager for the user?

Edited by Robjong
Link to comment
Share on other sites

In that case just set the language before you make the changes.

Global $sInstallDir = @ProgramFilesDir & "7-Zip" ; path to install directory
If StringInStr(@OSArch, "64") Then $sInstallDir = StringLeft(@ProgramFilesDir, 3) & "Program Files (x86)7-Zip"

Do ; close any opened instances of 7z
Until Not ProcessClose("7z.exe") And Not ProcessClose("7zFM.exe") And Not ProcessClose("7zG.exe")

RunWait("7z920.exe /S /D=""" & $sInstallDir & "") ; run the installer with the silent switch /S

RegWrite("HKCUSoftware7-Zip", "Lang", "REG_SZ", 'nl') ; set language to 'nl' for Dutch, default = System Language
Local $iPID = Run($sInstallDir & "7zFM.exe") ; run the filemanager
Local $hWin = WinWait("[TITLE:7-Zip; CLASS:FM; INSTANCE:1]") ; wait until the window exists
WinMenuSelectItem($hWin, '', 'E&xtra', '&Opties...') ; open options window
Local $hWinOpts = WinWait("[TITLE:Opties; CLASS:#32770; INSTANCE:1]") ; wait until the options window exists
ControlClick($hWinOpts, "", "[CLASS:Button; INSTANCE:1]", "primary") ; click the select all button
Sleep(300) ; give the changes time to take effect
ControlClick($hWinOpts, "", "[CLASS:Button; INSTANCE:2]", "primary") ; click OK, applies changes and closes window
Sleep(500) ; give the changes time to take effect
ProcessClose($iPID) ; close file manager

Edit: added the 64 bit part KaFu mentioned

Edited by Robjong
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...