; I'm a left-handed guy whose computer is often used by the right-handed, ; but not so often that they would need their own accounts. ; I wrote this little script to provide a two-click way of swapping mouse buttons, ; without having to go to Control Panel. So using a language selection dialog ; would kinda beat the purpose. Since user interaction consists of clicking OK once, ; multiple language support is not exactly needed, it's mostly for my own educational ; purposes, this is my first script that uses LangStrings. ; ------------------------------------------------------------------------------------ OutFile "MBSwap.exe" ;Icon "mouse.ico" LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf" LoadLanguageFile "${NSISDIR}\Contrib\Language files\Croatian.nlf" LangString Caption ${LANG_ENGLISH} "MBSwapper" LangString Caption ${LANG_CROATIAN} "Mišoobrtač" Caption $(Caption) LangString Msg1 ${LANG_ENGLISH} "Error occured: can't read required registry key." LangString Msg2 ${LANG_ENGLISH} "Swapped mouse buttons.$\nNow they're for the left-handed." LangString Msg3 ${LANG_ENGLISH} "Swapped mouse buttons.$\nNow they're for the right-handed." LangString Msg1 ${LANG_CROATIAN} "Uzalud." LangString Msg2 ${LANG_CROATIAN} "Okrenuo mišje tipke.$\nSad su za ljevičare." LangString Msg3 ${LANG_CROATIAN} "Okrenuo mišje tipke.$\nSad su za dešnjake." Function .onInit System::Call 'kernel32::CreateMutexA(i 0, i 0, t "MBSwapper") i .r1 ?e' Pop $R0 StrCmp $R0 0 +3 MessageBox MB_OK|MB_ICONEXCLAMATION "???" Abort ; This is the way I handled 'language selection issue': System::Call 'kernel32::GetSystemDefaultLangID() i .r0' StrCmp $0 "1050" Cro 0 ;Croatian ; if an ex-Yu language is detecteted, use Croatian: StrCmp $0 "1060" Cro 0 ;Slovenian StrCmp $0 "1071" Cro 0 ;Macedonian StrCmp $0 "2074" Cro 0 ;Serbian Latin StrCmp $0 "3098" Cro 0 ;Serbian StrCmp $0 "5146" 0 +2 ;Bosnian Cro: StrCpy $LANGUAGE ${LANG_CROATIAN} ; If none of the above languages were detected, $LANGUAGE is English. SetSilent Silent FunctionEnd Section "Swap" SecSwap ReadRegStr $0 HKCU "Control Panel\Mouse" "SwapMouseButtons" IfErrors 0 +3 MessageBox MB_OK|MB_ICONSTOP $(Msg1) Quit StrCmp $0 "0" 0 +5 System::Call "user32::SwapMouseButton(i 1)" WriteRegStr HKCU "Control Panel\Mouse" "SwapMouseButtons" "1" MessageBox MB_OK|MB_ICONINFORMATION $(Msg2) Quit System::Call "user32::SwapMouseButton(i 0)" WriteRegStr HKCU "Control Panel\Mouse" "SwapMouseButtons" "0" MessageBox MB_OK|MB_ICONINFORMATION $(Msg3) SectionEnd VIProductVersion "1.0.0.0" VIAddVersionKey "ProductName" "MBSwapper" VIAddVersionKey "Comments" " ;-)" VIAddVersionKey "CompanyName" "Boodhala Software" VIAddVersionKey "LegalCopyright" "© Andrea M. 2007. No rights reserved." VIAddVersionKey "FileDescription" "Swaps mouse buttons." VIAddVersionKey "FileVersion" "1.0"