coucou Posted June 16, 2005 Share Posted June 16, 2005 Hello,I have is a Multilangual Cyberlink Home Cinema (English, French, German..). It automatically detect the (System) Regional language and install the right version.I wrote 2 AutoIt installers (tested working) for Cyberlink HomeCinema (here enclosed):HomeCinema_EN.au3 for English installation and HomeCinema_FR.au3 for French installation. I need a help for small script which add an "IF" condition.In fact, i'm looking to an automatic (System) Regional language detectionThen, IF the regional language is French call HomeCinema_FR.au3 ELSE/OTHERWISE call HomeCinema_EN.au3RegardscoucouHomeCinema_EN.au3HomeCinema_FR.au3 Link to comment Share on other sites More sharing options...
herewasplato Posted June 16, 2005 Share Posted June 16, 2005 I need a help for small script which add an "IF" condition.In fact, i'm looking to an automatic (System) Regional language detectionThen, IF the regional language is French call HomeCinema_FR.au3 ELSE/OTHERWISE call HomeCinema_EN.au3<{POST_SNAPBACK}>Look at RegRead within the AutoIt help file and then read about "sLanguage" within this web site:http://www.jsifaq.com/SUBA/tip0300/rh0311.htmI would suggest that you place all of your code into one script - Psuedo-code:If RegRead = ENU Then;;put English install code here;EndIfIf RegRead = FRA Then;;put French install code here;EndIfYou might look into using the AutoIt function named ElseIf.Also, consider adding WinActivate before each WinWaitActive line just in case some other window steals focus... or look into the Control commands in AutoIt.have fun [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
jpm Posted June 16, 2005 Share Posted June 16, 2005 Hello,I have is a Multilangual Cyberlink Home Cinema (English, French, German..). It automatically detect the (System) Regional language and install the right version.I wrote 2 AutoIt installers (tested working) for Cyberlink HomeCinema (here enclosed):HomeCinema_EN.au3 for English installation and HomeCinema_FR.au3 for French installation. I need a help for small script which add an "IF" condition.In fact, i'm looking to an automatic (System) Regional language detectionThen, IF the regional language is French call HomeCinema_FR.au3 ELSE/OTHERWISE call HomeCinema_EN.au3Regardscoucou<{POST_SNAPBACK}>Perhaps is enough?if @OSLANG == "040C" then ;french else ;other endif Link to comment Share on other sites More sharing options...
MHz Posted June 16, 2005 Share Posted June 16, 2005 This script may do the task? If StringInStr("040c,080c,0c0c,100c,140c,180c", @OSLang) Then $title = "Home Cinema Setup" $text1 = "Contrat de Licence Utilisateur Final" $text2 = "Veuillez entrer votre nom" $text3 = "installation installera Home Cinema" $text4 = "installation ajoutera les icĂ´nes" $text5 = "Please select the software" $text6 = "installation de Home Cinema" $key = "t" Else $title = "Home Cinema Setup" $text1 = "End User License Agreement" $text2 = "Please enter your name" $text3 = "Setup will install Home Cinema" $text4 = "Setup will add program icons" $text5 = "Please select the software" $text6 = "Setup has completed" $key = "f" EndIf Run("Setup.exe") If WinWaitActive($title) Then Send("!s") If WinWaitActive($title, $text1) Then Send("!o") If WinWaitActive($title, $text2) Then Send("!s") If WinWaitActive($title, $text3) Then Send("!s") If WinWaitActive($title, $text4) Then Send("!s") If WinWaitActive($title, $text5) Then Send("!s") If WinWaitActive($title, $text6) Then Send("{TAB}{SPACE}{TAB}{SPACE}") Send("!" & $key) EndIf Link to comment Share on other sites More sharing options...
coucou Posted June 16, 2005 Author Share Posted June 16, 2005 Woowww!!!TNX all for yr help and what is more, yr quick reply.@MHz: I try following yr advise because first i'm not a coder and second yr sccript is looked complet, although i need some precisions.the command Send "!s" (Suivant) and "!o" (Oui) are for french.What about the english when "!s" should be "!n" (Next) and "!o" should be "!y" (Yes)?What do you think about this small modification?If StringInStr("040c,080c,0c0c,100c,140c,180c", @OSLang) Then $title = "Home Cinema Setup" $text1 = "Contrat de Licence Utilisateur Final" $text2 = "Veuillez entrer votre nom" $text3 = "installation installera Home Cinema" $text4 = "installation ajoutera les icĂ´nes" $text5 = "Please select the software" $text6 = "installation de Home Cinema" $key1 = "o" $key2 = "s" $key3 = "t" Else $title = "Home Cinema Setup" $text1 = "End User License Agreement" $text2 = "Please enter your name" $text3 = "Setup will install Home Cinema" $text4 = "Setup will add program icons" $text5 = "Please select the software" $text6 = "Setup has completed" $key1 = "y" $key2 = "n" $key3 = "f" EndIf Run("Setup.exe") If WinWaitActive($title) Then Send("!" & $key2) If WinWaitActive($title, $text1) Then Send("!" & $key1) If WinWaitActive($title, $text2) Then Send("!" & $key2) If WinWaitActive($title, $text3) Then Send("!" & $key2) If WinWaitActive($title, $text4) Then Send("!" & $key2) If WinWaitActive($title, $text5) Then Send("!" & $key2) If WinWaitActive($title, $text6) Then Send("{TAB}{SPACE}{TAB}{SPACE}") Send("!" & $key3) EndIfRegardscoucou Link to comment Share on other sites More sharing options...
herewasplato Posted June 16, 2005 Share Posted June 16, 2005 I was in the middle of posting this when I saw that coucou noticed the problem. Sending the "French keys" to the "English" setup..... MHz, Nice use of StringInStr. coucou, Your modification to what MHz posted looks okay at first glance and you can run with that... or something like the code below. I had suggested ElseIf - perhaps Case statements would be better. Just need something to allow the script to deal with a return from @OSLang that is neither French or English. The first "Case" statement to be true will execute the code just under the that Case statement and will skip all of the other case statements. If it makes it to the last case statement, then tell the user that something went wrong. expandcollapse popupRun("Setup.exe") Select Case StringInStr("040c,080c,0c0c,100c,140c,180c", @OSLang) = 1 WinWaitActive("Home Cinema Setup") Send("!s") WinWaitActive("Home Cinema Setup", "Contrat de Licence Utilisateur Final") Send("!o") WinWaitActive("Home Cinema Setup", "Veuillez entrer votre nom, et le nom de la société qui vous emploie.") Send("!s") WinWaitActive("Home Cinema Setup", "installation installera Home Cinema dans le dossier suivant.") Send("!s") WinWaitActive("Home Cinema Setup", "installation ajoutera les icônes de programmes au dossier de programme inscrit ci-dessous.") Send("!s") WinWaitActive("Home Cinema Setup", "Please select the software you want to install from the following list.") Send("!s") WinWaitActive("Home Cinema Setup", "installation de Home Cinema est terminée.") Send("{TAB}") Send("{SPACE}") Send("{TAB}") Send("{SPACE}") Send("!T") Case StringInStr("", @OSLang) = 1; <<<< see help file for "English codes" WinWaitActive("Home Cinema Setup") Send("!n") WinWaitActive("Home Cinema Setup", "End User License Agreement") Send("!y") WinWaitActive("Home Cinema Setup", "Please enter your name and the name of the company for whom you work.") Send("!n") WinWaitActive("Home Cinema Setup", "Setup will install Home Cinema in the following folder.") Send("!n") WinWaitActive("Home Cinema Setup", "Setup will add program icons to the Program Folder listed below.") Send("!n") WinWaitActive("Home Cinema Setup", "Please select the software you want to install from the following list.") Send("!n") WinWaitActive("Home Cinema Setup", "Setup has completed the Home Cinema installation.") Send("{TAB}") Send("{SPACE}") Send("{TAB}") Send("{SPACE}") Send("!F") Case 1 = 1 MsgBox(0,"","You lose") EndSelect [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
coucou Posted June 16, 2005 Author Share Posted June 16, 2005 TNX herewasplato, I try building an unattended CD for silent installation. Does yr script end send any message???Case 1 = 1 MsgBox(0,"","You lose") EndSelect Regards coucou Link to comment Share on other sites More sharing options...
jpm Posted June 16, 2005 Share Posted June 16, 2005 This script may do the task?If StringInStr("040c,080c,0c0c,100c,140c,180c", @OSLang) Then $title = "Home Cinema Setup" $text1 = "Contrat de Licence Utilisateur Final" $text2 = "Veuillez entrer votre nom" $text3 = "installation installera Home Cinema" $text4 = "installation ajoutera les icĂ´nes" $text5 = "Please select the software" $text6 = "installation de Home Cinema" $key = "t" Else $title = "Home Cinema Setup" $text1 = "End User License Agreement" $text2 = "Please enter your name" $text3 = "Setup will install Home Cinema" $text4 = "Setup will add program icons" $text5 = "Please select the software" $text6 = "Setup has completed" $key = "f" EndIf Run("Setup.exe") If WinWaitActive($title) Then Send("!s") If WinWaitActive($title, $text1) Then Send("!o") If WinWaitActive($title, $text2) Then Send("!s") If WinWaitActive($title, $text3) Then Send("!s") If WinWaitActive($title, $text4) Then Send("!s") If WinWaitActive($title, $text5) Then Send("!s") If WinWaitActive($title, $text6) Then Send("{TAB}{SPACE}{TAB}{SPACE}") Send("!" & $key) EndIf<{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
herewasplato Posted June 16, 2005 Share Posted June 16, 2005 TNX herewasplato,I try building an unattended CD for silent installation. Does yr script end send any message???Case 1 = 1 MsgBox(0,"","You lose") EndSelectRegardscoucou<{POST_SNAPBACK}>Only one of the case statements will run.The French install will happen on systems meeting the OSLANG check as coded.ORThe English install will happen on systems meeting the OSLANG check that YOU CODE.... I did not write that part for you.ORThe msgbox will pop up ONLY IF neither the French or the English install happened.If you do not put the msgbox (or some other code in) and the CD is run on a system that is not French or English, then the script will load and exit without doing a thing - if this is desired - then remove that last Case statement.later [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
MHz Posted June 17, 2005 Share Posted June 17, 2005 Woowww!!!TNX all for yr help and what is more, yr quick reply.@MHz: I try following yr advise because first i'm not a coder and second yr sccript is looked complet, although i need some precisions.the command Send "!s" (Suivant) and "!o" (Oui) are for french.What about the english when "!s" should be "!n" (Next) and "!o" should be "!y" (Yes)?What do you think about this small modification?If StringInStr("040c,080c,0c0c,100c,140c,180c", @OSLang) Then $title = "Home Cinema Setup" $text1 = "Contrat de Licence Utilisateur Final" $text2 = "Veuillez entrer votre nom" $text3 = "installation installera Home Cinema" $text4 = "installation ajoutera les icĂ´nes" $text5 = "Please select the software" $text6 = "installation de Home Cinema" $key1 = "o" $key2 = "s" $key3 = "t" Else $title = "Home Cinema Setup" $text1 = "End User License Agreement" $text2 = "Please enter your name" $text3 = "Setup will install Home Cinema" $text4 = "Setup will add program icons" $text5 = "Please select the software" $text6 = "Setup has completed" $key1 = "y" $key2 = "n" $key3 = "f" EndIf Run("Setup.exe") If WinWaitActive($title) Then Send("!" & $key2) If WinWaitActive($title, $text1) Then Send("!" & $key1) If WinWaitActive($title, $text2) Then Send("!" & $key2) If WinWaitActive($title, $text3) Then Send("!" & $key2) If WinWaitActive($title, $text4) Then Send("!" & $key2) If WinWaitActive($title, $text5) Then Send("!" & $key2) If WinWaitActive($title, $text6) Then Send("{TAB}{SPACE}{TAB}{SPACE}") Send("!" & $key3) EndIfRegardscoucou<{POST_SNAPBACK}>You catch on well. I think we can raise you, to the rank of junior coder. As for french. JPM has the knowledge of interpretation.The script looks good. Give it a test and find out, if it works. Link to comment Share on other sites More sharing options...
MHz Posted June 17, 2005 Share Posted June 17, 2005 Case 1 = 1 MsgBox(0,"","You lose") EndSelect<{POST_SNAPBACK}>Maybe use of Case Else, would be more appropriate? Link to comment Share on other sites More sharing options...
coucou Posted June 17, 2005 Author Share Posted June 17, 2005 TNX to you I can raise to be a junior coder. I'm realy proud. TNX all again. coucou Link to comment Share on other sites More sharing options...
herewasplato Posted June 17, 2005 Share Posted June 17, 2005 (edited) Maybe use of Case Else, would be more appropriate?<{POST_SNAPBACK}>Quite right.I normally use "Case 1" but since I was writing out the "= 1" part of each case statement, I went with "Case 1 = 1"... but you are correct - "Else" conveys more about when that section of code might execute than "1 = 1" does. I'm not sure if there are any technical reasons to use "Else", do you know of any? Edited March 16, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
MHz Posted June 18, 2005 Share Posted June 18, 2005 I'm not sure if there are any technical reasons to use "Else", do you know of any?<{POST_SNAPBACK}>Technical reasons, either concept will work. But does not Case Else look far better, when you read through the Select statements. Else, portrays the message that it is the last option left. Where as, 1 means either true, or the start of something numerical? Link to comment Share on other sites More sharing options...
herewasplato Posted June 18, 2005 Share Posted June 18, 2005 Agreed, "Case Else" looks better and conveys more info to the reader. I'll try and break that habit. I just wanted to be sure that I was not missing some small functional difference between "Case 1" and "Case Else". (I think that I started using "Case 1" about the same time as I started using "While 1".) Thanks for your reply. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
coucou Posted June 19, 2005 Author Share Posted June 19, 2005 Hello, I tried today both scripts (IF and CASE). Sorry to tell tou, No one works. the setup is launched (French) and stop /paused on the 1st windows. WinWaitActive("Home Cinema Setup") Send("!s") I tested again my 2 AutoIt installers (HomeCinema_EN.au3 and HomeCinema_FR.au3), they still works! What could be wrong??? Regards coucou Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted June 19, 2005 Share Posted June 19, 2005 I believe that in a different order, the Case 1=1 would be processed instead of something else, where Case Else might not...I haven't tested it...but it might be just that...or something Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
coucou Posted June 20, 2005 Author Share Posted June 20, 2005 Here is it, tested working. expandcollapse popup$Lang = RegRead("HKEY_CURRENT_USER\Control Panel\International", "sLanguage") If $Lang = "FRA" Then Run("Setup.exe") WinWaitActive("Home Cinema Setup") Send("!S") WinWaitActive("Home Cinema Setup", "Contrat de Licence Utilisateur Final") Send("!o") WinWaitActive("Home Cinema Setup", "Veuillez entrer votre nom, et le nom de la société qui vous emploie.") Send("!s") WinWaitActive("Home Cinema Setup", "installation installera Home Cinema dans le dossier suivant.") Send("!s") WinWaitActive("Home Cinema Setup", "installation ajoutera les icônes de programmes au dossier de programme inscrit ci-dessous.") Send("!s") WinWaitActive("Home Cinema Setup", "Please select the software you want to install from the following list.") Send("!s") WinWaitActive("Home Cinema Setup", "installation de Home Cinema est terminée.") Send("{TAB}") Send("{SPACE}") Send("{TAB}") Send("{SPACE}") Send("!T") ; Else Run("Setup.exe") WinWaitActive("Home Cinema Setup") Send("!n") WinWaitActive("Home Cinema Setup", "End User License Agreement") Send("!y") WinWaitActive("Home Cinema Setup", "Please enter your name and the name of the company for whom you work.") Send("!n") WinWaitActive("Home Cinema Setup", "Setup will install Home Cinema in the following folder.") Send("!n") WinWaitActive("Home Cinema Setup", "Setup will add program icons to the Program Folder listed below.") Send("!n") WinWaitActive("Home Cinema Setup", "Please select the software you want to install from the following list.") Send("!n") WinWaitActive("Home Cinema Setup", "Setup has completed the Home Cinema installation.") Send("{TAB}") Send("{SPACE}") Send("{TAB}") Send("{SPACE}") Send("!F") EndIf Regards coucou Link to comment Share on other sites More sharing options...
herewasplato Posted June 22, 2005 Share Posted June 22, 2005 I believe that in a different order, the Case 1=1 would be processed instead of something else, where Case Else might not...I haven't tested it...but it might be just that...or something <{POST_SNAPBACK}>I had not thought of that... but it seems that the first true statement "runs" and Case Else seems to always be true. So, in the wrong order, "Else" could convey the wrong message to the reader... but when used properly, it is still probably better/cleaner than Case 1 or Case 1=1.Select Case 1 = 19 MsgBox(0, "Case 1", "1 = 19") Case 1 = 1 MsgBox(0, "Case 2", "1 = 1");runs Case 2 = 2 MsgBox(0, "Case 3", "2 = 2") EndSelect Select Case 1 = 19 MsgBox(0, "Case 1", "1 = 19") Case Else MsgBox(0, "Case 2", "Else");runs Case 1 = 1 MsgBox(0, "Case 3", "1 = 1") EndSelect ; Au3Check barfs at the order above ; but it runs as expected - first case that is true runs $Lang = RegRead("HKEY_CURRENT_USER\Control Panel\International", "sLanguage") Select Case $Lang = "FRA" MsgBox(0, "Case 1", "FRA") Case $Lang = "ENU" MsgBox(0, "Case 2", "ENU") Case Else MsgBox(0, "Case 3", "Spricht Deutsch") EndSelectcoucou,Glad that something worked for you... [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now