Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/18/2016 in all areas

  1. BigDaddyO, Loop through the array like this: Switch $nMsg Case $GUI_EVENT_CLOSE, $hBtnClose Exit Case Else For $i = 1 To UBound($hChk) - 1 If $nMsg = $$hChk[$i] Then If BitAND(GUICtrlRead($hChk[$i]), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($hID[$i], @SW_ENABLE) GUICtrlSetState($hPW[$i], @SW_ENABLE) GUICtrlSetState($hDB[$i], @SW_ENABLE) Else GUICtrlSetState($hID[$i], @SW_DISABLE) GUICtrlSetState($hPW[$i], @SW_DISABLE) GUICtrlSetState($hDB[$i], @SW_DISABLE) EndIf ; No point in looping further ExitLoop EndIf Next M23 Edit: I see Jos had the same idea.
    1 point
  2. Something like this? The GUI is changed as soon as you select a different language from the combo: #include <Constants.au3> #include <GUIConstants.au3> #include <StringConstants.au3> Opt('MustDeclareVars', 1) Global $iGUI_Elements = 4, $iCurrentLanguage = 0, $iCurrentGUI = 1 Global $iLanguages = 3, $sLanguages = "English|Thailand|Indonesia", $sSelectedLanguage Global $aGUI1[$iGUI_Elements], $aGUILanguage1[$iGUI_Elements][$iLanguages] = [["English title 1", "Thai title 1", "Indonisian title 1"], ["English Combo 1", "Thai Combo 1", "Indonisian Combo 1"], ["English label 1", "Thai Label 1", "Indonisian Label 1"], ["English Button 1", "Thai Button 1", "Indonisian Button 1"]] Global $aGUI2[$iGUI_Elements], $aGUILanguage2[$iGUI_Elements][$iLanguages] = [["English title 2", "Thai title 2", "Indonisian title 2"], ["English Combo 2", "Thai Combo 2", "Indonisian Combo 2"], ["English label 2", "Thai Label 2", "Indonisian Label 2"], ["English Button 2", "Thai Button 2", "Indonisian Button 2"]] Global $idCombo, $aLanguages = StringSplit($sLanguages, "|", $STR_NOCOUNT) $aGUI1[0] = GUICreate($aGUILanguage1[0][$iCurrentLanguage], 315, 170, -1, -1) $aGUI1[1] = GUICtrlCreateLabel($aGUILanguage1[1][$iCurrentLanguage], 10, 10, 93, -1) $idCombo = GUICtrlCreateCombo("", 105, 10, 195, -1, 0x0003) GUICtrlSetData(-1, $sLanguages, $aLanguages[0]) $aGUI1[2] = GUICtrlCreateLabel($aGUILanguage1[2][$iCurrentLanguage], 10, 40, 292, -1) $aGUI1[3] = GUICtrlCreateButton($aGUILanguage1[3][$iCurrentLanguage], 10, 96, 283, -1) GUISetState(@SW_SHOW) While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idCombo $sSelectedLanguage = GUICtrlRead($idCombo) ConsoleWrite($sSelectedLanguage & @CRLF) For $i = 0 To UBound($aLanguages) - 1 If $sSelectedLanguage = $aLanguages[$i] Then If $i <> $iCurrentLanguage Then $iCurrentLanguage = $i _SwitchLanguage($aGUI1, $aGUILanguage1) ExitLoop EndIf EndIf Next EndSwitch WEnd Func _SwitchLanguage(ByRef $aGUI, ByRef $aGUILanguage) Local $iRC = WinSetTitle($aGUI[0], "", $aGUILanguage[0][$iCurrentLanguage]) For $i = 1 To UBound($aGUI) - 1 GUICtrlSetData($aGUI[$i], $aGUILanguage[$i][$iCurrentLanguage]) Next EndFunc ;==>_SwitchLanguage
    1 point
  3. Ops. Copy & Paste error. I fixed my above post.
    1 point
  4. Sure. I created a second set of language arrays. Set $iCurrentGUI to 1 or 2 to define witch GUI to switch the language. When creating the second GUI you need to use $aGUI2 and $aGUILanguage2. NB: The example does not include creation or switching to the second GUI. #include <Constants.au3> #include <GUIConstants.au3> Opt('MustDeclareVars', 1) Global $iGUI_Elements = 4, $iCurrentLanguage = 0, $iCurrentGUI = 1 Global $aGUI1[$iGUI_Elements], $aGUILanguage1[$iGUI_Elements][2] = [["Window title", "Fenstertitel"], ["LabelCombo", "Text Combo"], ["Label", "Text"], ["Button", "Schaltknopf"]] Global $aGUI2[$iGUI_Elements], $aGUILanguage2[$iGUI_Elements][2] = [["Window title2", "Fenstertitel2"], ["LabelCombo2", "Text Combo2"], ["Label2", "Text2"], ["Button2", "Schaltknopf2"]] Global $idCombo, $idSwitch $aGUI1[0] = GUICreate($aGUILanguage1[0][$iCurrentLanguage], 315, 170, -1, -1) $aGUI1[1] = GUICtrlCreateLabel($aGUILanguage1[1][$iCurrentLanguage], 10, 10, 93, -1) $idCombo = GUICtrlCreateCombo("", 105, 10, 195, -1, 0x0003) GUICtrlSetData(-1, 'English|Thailand|Indonesia') $aGUI1[2] = GUICtrlCreateLabel($aGUILanguage1[2][$iCurrentLanguage], 10, 40, 292, -1) $aGUI1[3] = GUICtrlCreateButton($aGUILanguage1[3][$iCurrentLanguage], 10, 96, 283, -1) $idSwitch = GUICtrlCreateButton("Switch language", 10, 130, 100, 20) GUISetState(@SW_SHOW) ; While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idSwitch If $iCurrentGUI = 1 Then _SwitchLanguage($aGUI1, $aGUILanguage1) Else _SwitchLanguage($aGUI2, $aGUILanguage2) EndIf EndSwitch WEnd Func _SwitchLanguage($aGUI, $aGUILanguage) If $iCurrentLanguage = 0 Then $iCurrentLanguage = 1 Else $iCurrentLanguage = 0 EndIf WinSetTitle($aGUI[0], "", $aGUILanguage[0][$iCurrentLanguage]) For $i = 1 To UBound($aGUI) - 1 GUICtrlSetData($aGUI[$i], $aGUILanguage[$i][$iCurrentLanguage]) Next EndFunc ;==>_SwitchLanguage
    1 point
  5. no no - just copy and paste your code here. I'm not gonna download a rar file just to look at code. When you compile to your 64 bit - we want to see THAT code you compile. Not an example either. The actual code please. Its the only way we can see what is happening and be able to help you. IMPORTANT: Now seeing how this is for image search and this sort of thing is frequently used for games (and your new) - let me make this clear for you: If this is for a game, please understand game automation is against forum rules. If it is, just say so, a mod will close the thread and it will be the end of it.
    1 point
  6. You could store the IDs of the controls plus the text for all languages in an 2D array. When you switch the language loop through the array and assign the language dependant text. Quick and dirty: #include <Constants.au3> #include <GUIConstants.au3> Opt('MustDeclareVars', 1) Global $iGUI_Elements = 4, $iCurrentLanguage = 0, $aGUI[$iGUI_Elements], $aGUILanguage[$iGUI_Elements][2] = [["Window title", "Fenstertitel"], ["LabelCombo", "Text Combo"], ["Label", "Text"], ["Button", "Schaltknopf"]] Global $idCombo, $idSwitch $aGUI[0] = GUICreate($aGUILanguage[0][$iCurrentLanguage], 315, 170, -1, -1) $aGUI[1] = GUICtrlCreateLabel($aGUILanguage[1][$iCurrentLanguage], 10, 10, 93, -1) $idCombo = GUICtrlCreateCombo("", 105, 10, 195, -1, 0x0003) GUICtrlSetData(-1, 'English|Thailand|Indonesia') $aGUI[2] = GUICtrlCreateLabel($aGUILanguage[2][$iCurrentLanguage], 10, 40, 292, -1) $aGUI[3] = GUICtrlCreateButton($aGUILanguage[3][$iCurrentLanguage], 10, 96, 283, -1) $idSwitch = GUICtrlCreateButton("Switch language", 10, 130, 100, 20) GUISetState(@SW_SHOW) ; While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idSwitch _SwitchLanguage() EndSwitch WEnd Func _SwitchLanguage() If $iCurrentLanguage = 0 Then $iCurrentLanguage = 1 Else $iCurrentLanguage = 0 EndIf WinSetTitle($aGUI[0], "", $aGUILanguage[0][$iCurrentLanguage]) For $i = 1 To UBound($aGUI) - 1 GUICtrlSetData($aGUI[$i], $aGUILanguage[$i][$iCurrentLanguage]) Next EndFunc ;==>_SwitchLanguage
    1 point
  7. PACaleala

    Google Maps Lat Long

    Check the forum 'Examples' section for "Google Maps" Udf and "_Mouse_Udf".
    1 point
  8. Update: beta version 0.9 released., with thanks to @LegitStack. After the discussion here I realised that DPI rescaling also affects the canvas size for the readouts this UDF produces. That means that if your GUIs appear 20% bigger, then the bottom and right edges of the display were being clipped commensurately. So I added a simple adjustment to take care of this, shamelessly copied from LegitStack's code in the other thread (thanks!). No other bells and whistles added, I'm afraid; still too busy battling the forces of darkness to keep your planet safe.
    1 point
  9. Usually you get IP info by connecting to some site that echoes your IP address. The bad thing about that method is almost proverbial need of site administrators to make changes to sites or their policies requiring from you to frequently update your code. Another issue could be caching thingy of the Inet approach. I did some reading about alternative ways to get public IP, and initially tried with SMTP. This Works great but it's kind of slow and on top of that some ISPs tend to block users on port 25 to prevent spam. Then further reading lead me to STUN protocol documentation. STUN servers are made to resolve and echo users' IP addresses, and are often used by VoIP services. The protocol is extremly simple and everything happens very quickly. Client connects (it's UDP so you Know what Imean), sends request, server replies, client parses the response and IP is there. RFC5389 describes STUN in details, so knock yourself out, if you are that crazy. I have found some implementations written in c++ and c sharp, but OMG, some people are just to stubborn and love to write incomprehensible idiotic hundreds of thousands kilobytes of code for something as simple as STUN. That went nowhere for me and gave me only the pain, so I just fall back to RFC and wrote my own client based on documentation. Function is called STUN_GetMyIP() and you can find example of usage in this little script. It's UDP this and UDP that: STUN.au3 If something wouldn't work, do say.
    1 point
  10. I'm going to use these menus. I've updated the UDF, ModernMenuRaw.au3. Of the posts it appears that Holger updated the code on a regular basis until May 2008. ProgAndy made some updates in August 2008. These updates were about the background color of the menubar, the ability to use icon handles, and better cleanup code on exit. The updates I've made are based on the UDF by ProgAndy attached to post 213. It's my intention to update the UDF to make it run under the current versions of AutoIt, and to get rid of errors. Especially already known errors, which can be fixed in a few lines of code. It's not my intention to add a lot of new code to the UDF. Updates 2014-10-18 This update is based on original code by Holger (first post) and updates by ProgAndy (posts 211 - 213). The update supports AutoIt 3.3.10 and later. Code relating to Windows versions not supported by 3.3.10 is deleted. WindowsConstants.au3 is included and double-defined global constants are commented out. Added an update to be able to use colored controls e.g. buttons with this UDF. Post 222. Update (one line) for x64 support. Post 266 by Holger. Added x64 support to functions by ProgAndy. Declared a few local variables. Updates 2014-10-19 Updates to pass Au3Check. (-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6) Updates 2015-01-24 Updates for tray menus suggested by nickston (posts 298, 299, 312) Most important is an update that makes it possible to use a flashing tray menu icon. There are also a few code optimizations. Updates 2021-11-12 Disabled $IDI_ global constants in ModernMenuRaw.au3. $IDI_ constants are included in AutoItConstants.au3. None of the updates above are script breaking. If you are using tray menus and want to compile your script, you should pay attention to posts 268 - 270. Note also that _TrayIconCreate creates a GUI to receive messages from tray icons. After calling this function you should probably use GUISwitch($hGui) or something. Post 227. In the top of ModernMenuRaw.au3 I've included commands.txt from the original zip by Holger. Two commands of ProgAndy to handle the background color of the menubar are added. I've also added an alphabetical list of functions, and a list of Windows messages (used with GUIRegisterMsg). Examples In order to make it easy the examples are included in the zip. The original examples by Holger are included with no changes at all. The 32 examples by AZJIO in the post above are also included with no changes. There are two versions of the examples: an english and a russian. The examples demonstrates the commands one by one and are named with the name of the command. Copied an example by AZJIO and renamed it to _TrayIconSetState-flashing.au3. Added one line of code to make the tray menu icon flash. Only an english version. A new example by nickston that demonstrates a flashing tray menu icon. The example shows how to turn flashing on and off. Two new examples _GUICtrlCreateODTopMenu.au3 and _GUIMenuBarSetBkColor.au3 that demonstrates the commands by ProgAndy to set the background color of the menubar. _GUIMenuBarSetBkColor.au3 is not working on Windows 7. A new example that shows how to use a bitmap from an image list as an icon in a menu item. The example shows also how to use icon handles. 7z-file ModernMenuRaw.au3 - update on 12.11.2021 ModernMenuRaw.au3 - all previous versions ExamplesAZJIO - 32 examples by AZJIO in english and russian versions ExamplesHolger - the original examples by Holger Examplesnickston - flashing tray menu icon ExampleszNew - three new examples Tested with AutoIt 3.3.10 on Windows 7 32/64 bit and Windows XP 32 bit. 2014-10-19: ModernMenuRaw.7z 2015-01-24: ModernMenuRaw.7z Tested with AutoIt 3.3.14.2/5 and beta 3.3.15.4 on Windows 7/10 32/64 bit. ModernMenuRaw.7z
    1 point
  11. Oky doky, I'll update the code. Thanks.
    1 point
  12. Here is efect universal solution for all edit controls in GUI #include <GUIConstantsEx.au3> #include <GUIEdit.au3> #include <WinAPI.au3> $hGUI = GUICreate("Test", 500, 500) $hInput1 = GUICtrlCreateEdit("here is some text 1", 10, 10, 480, 240) $hInput2 = GUICtrlCreateEdit("here is some text 2", 10, 250, 480, 240) ; Create dummy for accelerator key to activate $hSelAll = GUICtrlCreateDummy() GUISetState() ; Set accelerators for Ctrl+a Dim $AccelKeys[1][2]=[["^a", $hSelAll]] GUISetAccelerators($AccelKeys) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hSelAll _SelAll() EndSwitch WEnd Func _SelAll() $hWnd = _WinAPI_GetFocus() $class = _WinAPI_GetClassName($hWnd) If $class = 'Edit' Then _GUICtrlEdit_SetSel($hWnd, 0, -1) EndFunc ;==>_SelAll
    1 point
×
×
  • Create New...