Leaderboard
Popular Content
Showing content with the highest reputation on 08/17/2017 in all areas
-
Here's how I would do it. Study the comments and code to see that you can support essentially every dialect Windows supports, yet are able to produce the same message for all English (or Spanish or ...) user OR produce distinct messages for US and GB and any dialect you have to support. #include <Array.au3> ; This enumeration lists all applicative strings "short names". ; Expand as necessary. Global Enum $_AppMsgHello, $_AppMsgHowAreYou, $_AppMsgHopeYouEnjoyTheTrip, $_AppMsgSeeYouSoon ; This lists the (generic) languages for which we have strings : English, French, Spanish, Italian, Japanese ; For instance, here we confuse en-US and en-GB and simply group them under "English" for this application ; This is an example but is not mandatory: finer-grain regional strings can be similarly dealt with ; $_AppLangLast is a marker to limit list; keep it last Global Enum $_AppLangEn, $_AppLangFr, $_AppLangEs, $_AppLangIt, $_AppLangJa, $_AppLangLast ; This function will return the requested message for the current language ; $iAppMsg MUST be one of the $_App*** constants ; $iForceAppLang may be used to override @OSLang but must be within supported languages constants Func _GetMsg($iAppMsg, $iForceAppLang = Default) ; All the Static initializations will only be done ONCE and will be skipped after the first call ; Array holding couples of [Regional language variant code (see @OSLang help), AppLanguage] ; Entries can be in any order. Expand as needed. Static $aLangCodes = [ _ ["0409", $_AppLangEn], _ ; en-US ["0809", $_AppLangEn], _ ; en-GB ["0C09", $_AppLangEn], _ ; en-AU ["0410", $_AppLangIt], _ ; it-IT ["0810", $_AppLangIt], _ ; it-CH ["1009", $_AppLangEn], _ ; en-CA ["1409", $_AppLangEn], _ ; en-NZ ["1809", $_AppLangEn], _ ; en-IE ["1C09", $_AppLangEn], _ ; en-ZA ["040C", $_AppLangFr], _ ; fr-FR ["080C", $_AppLangFr], _ ; fr-BE ["4C0A", $_AppLangEs], _ ; es-NI ["0C0C", $_AppLangFr], _ ; fr-CA ["100C", $_AppLangFr], _ ; fr-CH ["140C", $_AppLangFr], _ ; fr-LU ["180C", $_AppLangFr], _ ; fr-MC ["040A", $_AppLangEs], _ ; es-ES_tradnl ["080A", $_AppLangEs], _ ; es-MX ["0C0A", $_AppLangEs], _ ; es-ES ["0411", $_AppLangJa] _ ; ja-JP ] ; Note that almost the same setup could be simplified by ignoring the first 2 hex digits ; of @OSLang, but doing so would preclude distinction between language dialects. ; For instance, @OSLang for all English dialects is xx04, all French is xx0C, a.s.o. ; 2D array holding app strings in every supported app language in turn ; App-supported languages (first dimension) in same order as $_AppLang enumeration ; and strings (second dimension) in same order as $_AppMsg enumeration Static $aStrings = [ _ [ _ ; En "Good morning, dear Sir", _ "How are you today?", _ "We hope you have enjoyed the trip", _ "See you soon!" _ ], _ [ _ ; Fr "Bonjour cher monsieur", _ "Comment allez-vous aujourd'hui ?", _ "Nous espérons que vous avez apprécié le voyage", _ "À bientôt !" _ ], _ [ _ ; Es "Hola estimado Sr.", _ "¿Cómo estás hoy?", _ "Esperamos que hayas disfrutado del viaje", _ "¡Nos vemos pronto!" _ ], _ [ _ ; It "Ciao caro Mr.", _ "Come stai oggi?", _ "Ci auguriamo che abbia mai goduto il viaggio", _ "A presto!" _ ], _ [ _ ; Ja "こんにちは親愛なる氏", _ "今日は元気ですか?", _ "旅行を楽しんでいただければ幸いです", _ "また近いうちにお会いしましょう!" _ ] _ ] ; Determine application language from @OSLang and the tables above Static $OSLang = _ArraySearch($aLangCodes, @OSLang) Static $iLang = ($OSLang < 0) ? -1 : $aLangCodes[$OSLang][1] ; Get the required message ; This is the only active part of code of the function after first invokation! ; Only if absolutely necessary we could check here that $AppMsg is a valid $_AppMsg*** constant ; but it's simpler to insure that the invoking code always uses a valid $_AppMsg*** value If $iForceAppLang = Default Then Return ($iLang < 0 ? "@OSLang code not supported yet!" : $aStrings[$iLang][$iAppMsg]) Else Return (($iForceAppLang < 0) Or ($iForceAppLang >= $_AppLangLast) ? "Forced language " & $iForceAppLang & " is not supported" : $aStrings[$iForceAppLang][$iAppMsg]) EndIf EndFunc ; Tests ; use default @OSLang MsgBox(0, "Test strings", _GetMsg($_AppMsgHowAreYou)) MsgBox(0, "Test strings", _GetMsg($_AppMsgHopeYouEnjoyTheTrip)) MsgBox(0, "Test strings", _GetMsg($_AppMsgHello)) MsgBox(0, "Test strings", _GetMsg($_AppMsgSeeYouSoon)) ; temporarily force a different applicative language MsgBox(0, "Test strings", _GetMsg($_AppMsgHowAreYou, $_AppLangIt)) ; forcing was temporary MsgBox(0, "Test strings", _GetMsg($_AppMsgHowAreYou)) MsgBox(0, "Test strings", _GetMsg($_AppMsgHowAreYou, $_AppLangJa)) ; check that forcing an unsupported language still works MsgBox(0, "Test strings", _GetMsg($_AppMsgHowAreYou, 143)) Forgot to mention that Google translate goes wrong at times!2 points
-
Thx Matt! After fiddling with ControlMove I finally got it. Not sure if the Class name for the "Move Items" window is different on a different PC and I could have used the Window name instead, but whatever, it works nevertheless. I also moved the lower two buttons, just for visuals. If WinExists ("Move Items","Move the selected items to") then WinActivate("Move Items","Move the selected items to") WinMove("Move Items","Move the selected items to", 350, 50, 620, 800) ; Move the SysTreeView32 and Button controls of Outlook 2013 (window "Move Items"). ControlMove("[CLASS:#32770]", "", "[CLASS:SysTreeView32; INSTANCE:1]", 6, 23, 500, 750) ControlMove("[CLASS:#32770]", "", "[CLASS:Button; INSTANCE:1]", 520, 23) ControlMove("[CLASS:#32770]", "", "[CLASS:Button; INSTANCE:2]", 520, 73) ControlMove("[CLASS:#32770]", "", "[CLASS:Button; INSTANCE:3]", 520, 103) Sleep(2500) EndIf1 point
-
ADB Help Please !
Danyfirex reacted to JLogan3o13 for a topic
@bemine17 you need to be clearer, you want your script to double click on the item in Device Manager, or you want to launch a program when that device is inserted? Also, this forum operates on the "Teach a man to fish" motto, rather than you simply putting in a request and someone barfing up code for you. What have you tried on your own? Even a simple search of this forum shows dozens of threads on manipulating the Device Manager.1 point -
[Solved] Function _IECreate doesn't work in Windows 10
dreivilo47 reacted to Danp2 for a topic
Anything else unusual about your setup? Running on a corporate network? Using SandBoxie? Etc. You may want to review this thread.1 point -
1 point
-
... That post #12 was just for fun , .... aniway... from a quick search seems that with comparison operators there is not conversion from strings to numbers: from the "Language Reference - Operators" at the "Comparison operators" session: "Strings are compared lexicographically even if the contents of the string happen to be numeric" and from "Lexicographical order" in Wikipedia in the "Numeral systems and dates" session: ".... Another example of a non-dictionary use of lexicographical ordering appears in the ISO 8601 standard for dates, which expresses a date as YYYY-MM-DD. This formatting scheme has the advantage that the lexicographical order on sequences of characters that represent dates coincides with the chronological order: an earlier date is smaller in the lexicographical order than a later date. This date ordering makes computerized sorting of dates easier by avoiding the need for a separate sorting algorithm." .... p.s. learned something new ,,,,1 point
-
[Solved] Function _IECreate doesn't work in Windows 10
dreivilo47 reacted to Danp2 for a topic
This command works fine in Windows 10, so the issue is local to your install. Post the output of this -- #include <MsgBoxConstants.au3> Global $iEventError = 0 ; To be checked to know if COM error occurs. Must be reset after handling. Local $oMyError = ObjEvent("AutoIt.Error", "ErrFunc") ; Install a custom error handler Local $oObject = ObjCreate("InternetExplorer.Application") ConsoleWrite('@error = ' & @error & @CRLF) ; This is a custom error handler Func ErrFunc() $sHexNumber = Hex($oMyError.number, 8) MsgBox($MB_OK, "", "We intercepted a COM Error !" & @CRLF & _ "Number is: " & $sHexNumber & @CRLF & _ "WinDescription is: " & $oMyError.windescription) $iEventError = 1 ; Use to check when a COM Error occurs EndFunc ;==>ErrFunc1 point -
Like this: Local $loopTime = 10 While $loopTime $loopTime -= 1 If WinWaitNotActive("My Program", "", 1) Then Sleep(100) Send("!+{TAB}") Sleep(4000) ElseIf WinActivate("My Program") Then ExitLoop Else ;...... EndIf WEnd1 point
-
Try this one: #include <WinAPIShellEx.au3> #include <SendMessage.au3> _Restart_Windows_Explorer() ConsoleWrite("+ Result: " & @error & @crlf) Func _Restart_Windows_Explorer() ; By KaFu ; Believed to save icon positions just before Shutting down explorer, which comes next _WinAPI_ShellChangeNotify($SHCNE_ASSOCCHANGED, 0, 0, 0) ;Shutting down explorer gracefully Local $hSysTray_Handle = DllCall("user32.dll", "HWND", "FindWindow", "str", "Shell_TrayWnd", "str", "") If Not IsHWnd($hSysTray_Handle[0]) Then Return SetError(1) Local $iPID_Old = WinGetProcess($hSysTray_Handle[0]) _SendMessage($hSysTray_Handle[0], 0x5B4, 0, 0) #cs Local $i_Timer = TimerInit() While IsHWnd($hSysTray_Handle[0]) Sleep(10) If TimerDiff($i_Timer) > 5000 Then Return SetError(2) WEnd #ce Local $i_Timer = TimerInit() While ProcessExists($iPID_Old) Sleep(10) If TimerDiff($i_Timer) > 5000 Then Return SetError(3) WEnd Sleep(500) Return ShellExecute(@WindowsDir & "\Explorer.exe") EndFunc ;==>_Restart_Windows_Explorer1 point
-
Hi hendrikhe, I would do it like so: #include <WinAPI.au3> #include <WinAPISys.au3> ;Save icon positions (probably not needed since we are doing a graceful exit ..) DllCall("shell32.dll", "none", "SHChangeNotify", "long", 0x8000000, "uint", BitOR(0x0, 0x1000), "ptr", 0, "ptr", 0) ;Close the explorer shell gracefully $hSysTray_Handle = _WinAPI_FindWindow('Shell_TrayWnd', '') _SendMessage($hSysTray_Handle, 0x5B4, 0, 0) While WinExists($hSysTray_Handle) Sleep(500) WEnd _start_explorer() While Not _WinAPI_GetShellWindow() Sleep(500) WEnd EnvUpdate() ; continue script Exit Func _start_explorer() $strComputer = "localhost" $objWMI = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") Local $objexplorer = $objWMI.Get("win32_process") $objexplorer.create("explorer.exe") EndFunc ;==>_start_explorer1 point
-
Skysnake, I would do it like this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> $hGUI = GUICreate("Test", 500, 500) $cCombo = GUICtrlCreateCombo("", 10, 10, 200, 200) $cLabel = GUICtrlCreateLabel("", 10, 100, 200, 20) ; Add files _GUICtrlComboBox_BeginUpdate($cCombo) _GUICtrlComboBox_AddDir($cCombo, @WindowsDir & "\*.exe") _GUICtrlComboBox_EndUpdate($cCombo) GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cCombo ; Use Autoit to do the hard work - this fires when the user makes a selection GUICtrlSetData($cLabel, GUICtrlRead($cCombo)) EndSwitch WEnd Func _Edit_Changed() ; Autocomplete the edit _GUICtrlComboBox_AutoComplete($cCombo) ; Change the label to match the autocompleted edit entry If GUICtrlRead($cLabel) <> GUICtrlRead($cCombo) Then GUICtrlSetData($cLabel, GUICtrlRead($cCombo)) EndIf EndFunc ;==>_Edit_Changed Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg If $lParam = GUICtrlGetHandle($cCombo) And BitShift($wParam, 16) = $CBN_EDITCHANGE Then ; Our combo edit content has changed _Edit_Changed() ; Action this function EndIf EndFunc A bit simpler - but not that dissimilar. M231 point
-
#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $g_idCombo Global $g_fcbmSelected Example() Func Example() ; Create GUI Local $hGUI = GUICreate("ComboBox Auto Complete", 400, 296) $g_idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) ; control $hWndCombo = GUICtrlGetHandle($g_idCombo) ;~ $g_hCombo = _GUICtrlComboBox_Create($hGUI, "", 2, 2, 396, 296) ; handle Local $cmbValue = '' Local $mylabel = GUICtrlCreateLabel("...", 10, 50, 100, 25) GUISetState(@SW_SHOW) ; Add files _GUICtrlComboBox_BeginUpdate($g_idCombo) _GUICtrlComboBox_AddDir($g_idCombo, @WindowsDir & "\*.exe") _GUICtrlComboBox_EndUpdate($g_idCombo) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ;~ ; Loop until the user exits. ;~ Do ;~ Until GUIGetMsg() = $GUI_EVENT_CLOSE ;~ GUIDelete() While 1 Switch GUIGetMsg() Case $g_idCombo, $g_fcbmSelected $cmbValue = GUICtrlRead($g_idCombo) GUICtrlSetData($mylabel, $cmbValue) $g_fcbmSelected = False Case $GUI_EVENT_CLOSE GUIDelete() Exit Case Else ContinueLoop EndSwitch WEnd EndFunc ;==>Example Func _Edit_Changed() _GUICtrlComboBox_AutoComplete($g_idCombo) EndFunc ;==>_Edit_Changed Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo If Not IsHWnd($g_idCombo) Then $hWndCombo = GUICtrlGetHandle($g_idCombo) $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $g_idCombo, $hWndCombo Switch $iCode Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed _DebugPrint("$CBN_CLOSEUP" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value ;~ next line seems to do nothing ;~ Case $CBN_DBLCLK ; Sent when the user double-clicks a string in the list box of a combo box ;~ _DebugPrint("$CBN_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ ;~ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ ;~ "-->Code:" & @TAB & $iCode) ;~ ; no return value Case $CBN_DROPDOWN ; Sent when the list box of a combo box is about to be made visible _DebugPrint("$CBN_DROPDOWN" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_EDITCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box _DebugPrint("$CBN_EDITCHANGE" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) _Edit_Changed() ; no return value Case $CBN_EDITUPDATE ; Sent when the edit control portion of a combo box is about to display altered text _DebugPrint("$CBN_EDITUPDATE" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_ERRSPACE ; Sent when a combo box cannot allocate enough memory to meet a specific request _DebugPrint("$CBN_ERRSPACE" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_KILLFOCUS ; Sent when a combo box loses the keyboard focus _DebugPrint("$CBN_KILLFOCUS" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box _DebugPrint("$CBN_SELCHANGE" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_SELENDCANCEL ; Sent when the user selects an item, but then selects another control or closes the dialog box _DebugPrint("$CBN_SELENDCANCEL" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_SELENDOK ; Sent when the user selects a list item, or selects an item and then closes the list _DebugPrint("$CBN_SELENDOK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; return a flag to be actioned :) Return $g_fcbmSelected = True Case $CBN_SETFOCUS ; Sent when a combo box receives the keyboard focus _DebugPrint("$CBN_SETFOCUS" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; no return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @CRLF & _ "+======================================================" & @CRLF & _ "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _ "+======================================================" & @CRLF) EndFunc ;==>_DebugPrint Dear @Melba23, I have done this based on the wiki and the Help file. For the moment, this is doing what I want. Any comments and criticisms are welcome. What can I do better? The idea is to have (a) that auto-update Combo, and (b) pass on the user's selection to another control. Is this good? Can it be better? Thank you for all your patience. Skysnake1 point
-
It's probably because your "starting point" for your send commands is changed. Probably with that "altup/down" stuff. Also, if i understand what you're doing correctly, you're hitting alt+n to select the Run button, then tab to move to the Save button, then enter to select Save. However, here's a more direct way that may solve your problem: send("!s") ;sends Alt + s1 point
-
#include <date.au3> MsgBox(0, "Check if between", _dateIsBetween(_NowCalc(), "2017/01/01", "2017/12/31")) ; are we in 2017 Func _dateIsBetween($sDate0, $sDate1, $sDate2) Local $date0 = StringReplace($sDate0, "/", ""), $date1 = StringReplace($sDate1, "/", ""), $date2 = StringReplace($sDate2, "/", "") Return (($date0 >= $date1) And ($date0 <= $date2)) ? "yes" : "nope" EndFunc ;==>_dateIsBetween1 point
-
This game is a test environment for me to learn Networking with Unity. Play with up to 20 other hungry soldiers. Download the EXE to terminate other AutoIt soldiers: http://songersoft.com/programming/unity/MP_FPS.zip Collaborate by sending me the email address associated with your Unity account and I'll share the project. Together we will bring peace to the world by destroying it. Oops sorry this topic belongs in the super geeky: Developer General Discussion I will create the next topic like this one there.1 point
-
@BetaLeaf, maybe remove this one from your list? PSafe (PSafe) Aug 10, 10:09 -03 Hello Team, We don't support Windows anymore, our AV for Windows platform was discontinued. Thank you for your contact and if you have any questions, feel free to reach me. Best regards, Thomas Skysnake1 point