Sign in to follow this  
Followers 0
SirHaschke

7 Zip Script does't work on a Netherland XP

16 posts in this topic

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

Share this post


Link to post
Share on other sites



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


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Hello,

how can i see the console output?

Share this post


Link to post
Share on other sites

WinWaitActive("7-Zip Dateimanager")

WinWaitActive("Optionen")

Those Window titles sound more German than Dutch to me (en ik spreek een beetje nederlands :))...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thats correct, but the standard language in 7-Zip is german.

After the AutoIt skript i chang it to netherlands via reg key.

Edited by SirHaschke

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Bingo.

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

But why not Run("C:Program Files7-Zip7zFM.exe")?

Thanks in advance.

Share this post


Link to post
Share on other sites

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

MsgBox(0, "", @ProgramFilesDir)

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

OK.

The output is C:Program Files

Thanks for your help.

Share this post


Link to post
Share on other sites

In my case it was a dutch machine.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

The installation is english.

After that if i start the 7 Zip filemanager it is on a dutch machine german !!

After that i import an reg key an then the language of 7Zip is dutch.

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0