60aside
Active Members-
Posts
48 -
Joined
-
Last visited
60aside's Achievements
Seeker (1/7)
0
Reputation
-
Help launching calc.exe on computer through browser
60aside replied to 60aside's topic in AutoItX Help and Support
I figured it out anyway using activex, this will launch calc.exe then close the IE window. Not autoIT, just name the file with .html as the extension. You could put your autoit.exe in the path instead of calc.exe to launch through the browser. <script> var ws = new ActiveXObject("WScript.Shell"); ws.Exec("c:\\windows\\system32\\calc.exe"); window.open('','_self'); window.close(); </script> -
Reset AutoIt.Error handler to default
60aside replied to 60aside's topic in AutoIt General Help and Support
answer - with this Global $oMyError = "" -
Hi, Can someone tell me how I can reset the error handler back to the default autoit handler after running this piece of code?:- Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") Func MyErrFunc() msgbox(0,"Error","An error occured processing the SQL query."&@lf&"Please retry.") exit Endfunc $conn.Open($DSN) #cs reset error back to default handler after this point? #ce thanks
-
This is what I ended up with and is working thanks :- #include <GUIConstantsEx.au3> #include <Array.au3> #Include <GuiListBox.au3> Global $hGUI, $hInput, $hList, $sPartialData $hGUI = GUICreate("Example", 200, 400) $hInput = GUICtrlCreateInput("", 5, 5, 190, 20) $hList = GUICtrlCreateList("", 5, 30, 190, 325, BitOR(0x00100000, 0x00200000)) Keywords() $hButton = GUICtrlCreateButton("Read", 60, 360, 80, 30) $hUP = GUICtrlCreateDummy() $hDOWN = GUICtrlCreateDummy() $hENTER = GUICtrlCreateDummy() GUISetState(@SW_SHOW, $hGUI) ; Set accelerators for Cursor up/down and Enter Dim $AccelKeys[3][2]=[["{UP}", $hUP], ["{DOWN}", $hDOWN], ["{ENTER}", $hENTER]] GUISetAccelerators($AccelKeys) $sCurr_Input = "" $iCurrIndex = -1 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hList $sChosen = GUICtrlRead($hList) If $sChosen <> "" Then GUICtrlSetData($hInput, $sChosen) Case $hButton If $sPartialData <> "" Then $sFinal = GUICtrlRead($hInput) If _ArraySearch($asKeyWords, $sFinal) > 0 Then MsgBox(0, "Chosen", $sFinal) EndIf EndIf Case $hUP If $sPartialData <> "" Then $iCurrIndex -= 1 If $iCurrIndex < 0 Then $iCurrIndex = 0 _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf Case $hDOWN If $sPartialData <> "" Then $iTotal = _GUICtrlListBox_GetCount($hList) $iCurrIndex += 1 If $iCurrIndex > $iTotal - 1 Then $iCurrIndex = $iTotal - 1 _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf Case $hENTER If $iCurrIndex <> -1 Then $sText = _GUICtrlListBox_GetText($hList, $iCurrIndex) GUICtrlSetData($hInput, $sText) $iCurrIndex = -1 _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf EndSwitch ; If input has changed, refill list with matching items If GUICtrlRead($hInput) <> $sCurr_Input Then CheckInputText() $sCurr_Input = GUICtrlRead($hInput) If GUICtrlRead($hInput) = "" Then GUICtrlSetData($hList, "") GUICtrlSetData($hList, $sData) Endif EndIf WEnd Func Keywords() global $sData Local $iMax Local $i Global $NameList="Alan|Andrew|Barry|Brian|Colin|Cristopher|Derek|David" ; The string in data will be split into an array everywhere | is encountered global $asKeyWords = StringSplit($NameList, "|") If IsArray($asKeyWords) Then For $i = 1 to $asKeyWords[0] $sData &= $asKeyWords[$i] & "|" Next GUICtrlSetData($hList, $sData) $iCurrIndex = -1 _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf EndFunc ;==>Keywords Func CheckInputText() $sPartialData = "|" ; Start with delimiter so new data always replaces old Local $sInput = GUICtrlRead($hInput) If $sInput <> "" Then For $i = 1 to $asKeyWords[0] If StringInStr($asKeyWords[$i], $sInput) <> 0 Then $sPartialData &= $asKeyWords[$i] & "|" Next GUICtrlSetData($hList, $sPartialData) EndIf EndFunc ;==>CheckInputText
-
Thanks M23, I'm populating the list with data pulled from sql. It will be in the form of something like below :- $NameList = "Alan|Andrew|Barry|Brian|Colin|Cristopher|Derek|David" I'm struggling getting this to "auto suggest" the way that you do with the random 5 letters. Could you help again please? This is the "icing on the cake" to the code I am working on.
-
Many thanks. Works a treat!
-
Hi Melba23, You were right, after trying most of the day to get what I want using a combo box, I've now given up. I can use your example - which does exactly what I want, the only thing lacking is when I want to make a selection from the list - I cannot use the up/down arrow keys to select (only the mouse). Could you advise how to get this working? Thanks.
-
Thanks M23, I think I need a mixture of both to get what I want. I will be using some of your code so thanks a lot for the post. 60aside.
-
Bump. Just kidding I found something to work with here:- autocomplete Looks like I can get what I need from this.
-
I use this to disable the screensaver with a registry entry. And prevent GPO from refreshing the policies until I have finished running a script. RegWrite("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop","ScreenSaveActive", "REG_SZ", "0") RegWrite("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop","ScreenSaverIsSecure", "REG_SZ", "0") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Group Policy\{A2E30F80-D7DE-11d2-BBDE-00C04F86AE3B}","NoBackgroundPolicy", "REG_DWORD", "1") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Group Policy\{A2E30F80-D7DE-11d2-BBDE-00C04F86AE3B}","NoGPOListChanges", "REG_DWORD", "1")
-
question for function on right click
60aside replied to tuanoooo's topic in AutoIt General Help and Support
Hi, Just add the contents of the zip file in the link to C:\Program Files\AutoIt3\Include then use this :- #include <MouseOnEvent.au3> ;Disable Secondary mouse button *up*, and call our function when mouse button *up* event is recieved _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "MouseSecondaryUp_Event") Sleep(5000) _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT) ;Enable mouse button back. Func MouseSecondaryUp_Event() Sleep(50) Send("{ENTER}") Send(" hi hi hi") Send("{ENTER}") Sleep(50) EndFunc -
Hi, Can anyone help (or point me in the right direction) to convert the script below (from help) to act in the following way:- If I type in "ystem" it will find any item containing that string - such as "system32" and "system" and if I type in "s" it will list all items that contain an "s" Something similar to google? Thanks, #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIComboBox.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) $Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work Global $hCombo _Main() Func _Main() ; Create GUI GUICreate("ComboBox Auto Complete", 400, 296) $hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) GUISetState() ; Add files _GUICtrlComboBox_BeginUpdate($hCombo) _GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe") _GUICtrlComboBox_EndUpdate($hCombo) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func _Edit_Changed() _GUICtrlComboBox_AutoComplete($hCombo) EndFunc ;==>_Edit_Changed Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo If Not IsHWnd($hCombo) Then $hWndCombo = GUICtrlGetHandle($hCombo) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word Switch $hWndFrom Case $hCombo, $hWndCombo Switch $iCode Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed _DebugPrint("$CBN_CLOSEUP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_DBLCLK ; Sent when the user double-clicks a string in the list box of a combo box _DebugPrint("$CBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->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" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->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" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->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" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->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" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_KILLFOCUS ; Sent when a combo box loses the keyboard focus _DebugPrint("$CBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->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" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->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" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->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" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $CBN_SETFOCUS ; Sent when a combo box receives the keyboard focus _DebugPrint("$CBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint
-
to set regional settings I copy a text file to c:\system32 - in this case RegOptsUK.txt Then run :- RunDLL32.exe Shell32,Control_RunDLL Intl.cpl,,/f:"c:\windows\system32\RegOptsUK.txt" contents of RegOptsUK.txt :- [RegionalSettings] LanguageGroup=1 SystemLocale=00000809 UserLocale=00000809 InputLocale=0809:00000809 UserLocale_DefaultUser=00000809 InputLocale_DefaultUser=0809:00000809 MUILanguage=00000809 MuiLanguage_DefaultUser=00000809 You should be able to change this to your requirements and even put it into an autoit exe if required.
-
Remove line of txt if a variable is in the line
60aside replied to 60aside's topic in AutoIt General Help and Support
I have found that I have some duplicate entries in $text. Is there a way to remove these and just keep the 1st entry? A quick search comes up with _ArrayUnique, is this the way to go with this? Thanks again.