Leaderboard
Popular Content
Showing content with the highest reputation on 09/02/2011 in all areas
-
@bogQ MultiByteToWideChar is no longer needed. #include <GUIConstantsEX.au3> #include <EditConstants.au3> #include <WinAPI.au3> $hGui = GUICreate("", 500, 300) GUICtrlCreateLabel("Info", 10, 5) Local $aInput[6][2] = [[0, "Name"],[0, "Address"],[0, "Home Phone"],[0, "Mobile Phone"],[0, "Date of birth"],[0, "Town"]] For $i = 0 To UBound($aInput) -1 $aInput[$i][0] = GUICtrlCreateInput("", 10, (20*($i+1)), 140, 20) GUICtrlSendMsg(-1, $EM_SETCUEBANNER, True, $aInput[$i][1]) Next GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd ;Does not work for edit controls with $ES_MULTILINE style. ;In XP, the banner disappears when the edit has focus (cursor in edit) ;In Vista/7 the banner can optionally still appear when the edit has focus (cursor in edit) ;(third parameter = True/False) The original function was coded in 2008 for an Ansi version of AutoIt.1 point
-
Hi, Here my version: ;#include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #Include <WinAPI.au3> #Include <GuiComboBox.au3> $hGUI = GUICreate("Test", 230, 230, -1, -1, $WS_TABSTOP) GUISetBkColor(0xFFFFFF) $idCombo = GUICtrlCreateCombo("", 8, 8, 209, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) SetCueText($idCombo, "Example555@hotmail.com") GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) $idInput = GUICtrlCreateInput("", 8, 40, 209, 23) SetCueText($idInput, "Enter your password") GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func SetCueText($control, $text, $wParam = False) $hWnd = GUICtrlGetHandle($control) if (_WinAPI_GetClassName($hWnd)='ComboBox') Then _GUICtrlComboBox_SetCueBanner($hWnd, $text) else If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) $text = _WinAPI_MultiByteToWideChar($text) Return _SendMessage($hWnd, $EM_SETCUEBANNER, $wParam, DllStructGetPtr($text)) = 1; EndIf EndFunc Jeanphile1 point
-
Here my version: #include <ComboConstants.au3> #include <EditConstants.au3> #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 230, 230, -1, -1, $WS_TABSTOP) GUISetBkColor(0xFFFFFF) $idCombo = GUICtrlCreateCombo("Example555@hotmail.com", 8, 8, 209, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) $hCombo = GUICtrlGetHandle($idCombo) $idInput = GUICtrlCreateInput("Enter your password", 8, 40, 209, 23, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) $hInput = GUICtrlGetHandle($idInput) $idButton = GUICtrlCreateButton("Exit", 194, 170) Global $DefaultPassChar = GUICtrlSendMsg($idInput, $EM_GETPASSWORDCHAR, 0, 0) GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, 0, 0) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "Check") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $idButton Exit EndSwitch WEnd Func Check($hWnd, $iMsg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAND($wParam, 0x0000FFFF) Switch $nNotifyCode Case 256, 3 ;set focus Switch $nID Case $idCombo If _GUICtrlComboBox_GetEditText($hCombo) = "Example555@hotmail.com" Then _GUICtrlComboBox_SetEditText($hCombo, "") Case $idInput If GUICtrlRead($idInput) = "Enter your password" Then GUICtrlSetData($idInput, "") GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, $DefaultPassChar, 0) EndIf EndSwitch Case 512, 4 ;kill focus If GUICtrlRead($idInput) = "" Then GUICtrlSetData($idInput, "Enter your password") GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, 0, 0) EndIf If GUICtrlRead($idCombo) = "" Then _GUICtrlComboBox_SetEditText($hCombo, "Example555@hotmail.com") EndSwitch Return "GUI_RUNDEFMSG" EndFunc Br, UEZ1 point
-
So this is using UEZ's initial example but I've added the option of when a user selects the combo or inputbox it will delete the data & if you don't add any data then it will revert back to the previous text! #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <ComboConstants.au3> #include <EditConstants.au3> #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global $__ControlID, $__PreviousText _Main() Func _Main() Local $hGUI $hGUI = GUICreate("Example by guinness 2011", 230, 230, -1, -1) GUISetBkColor(0xFFFFFF) GUICtrlCreateCombo("Example555@hotmail.com", 8, 8, 209, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) GUICtrlCreateInput("Enter your password", 8, 40, 209, 23) GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) GUICtrlSetState(-1, $GUI_FOCUS) GUIRegisterMsg($WM_COMMAND, 'WM_CHECK') GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>_Main Func WM_CHECK($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $ilParam Local $hHandle, $iCode $hHandle = GUICtrlGetHandle($__ControlID) $iCode = _WinAPI_HiWord($iwParam) Switch $iCode Case $EN_SETFOCUS, $CBN_SETFOCUS $__ControlID = _WinAPI_LoWord($iwParam) $__PreviousText = GUICtrlRead($__ControlID) GUICtrlSetData($__ControlID, "") Case $EN_KILLFOCUS, $CBN_KILLFOCUS If _WinAPI_GetClassName($hHandle) = "ComboBox" Then _GUICtrlComboBox_SetEditText($hHandle, $__PreviousText) Else If GUICtrlRead($__ControlID) = "" Then GUICtrlSetData($__ControlID, $__PreviousText) EndIf EndIf EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_CHECK1 point
-
Post small reproducing script then we can fix it for you ...1 point
-
Try this: $usr = "administrator" $pwd = "Test" Run ("net use b: \\10.100.100.225\g /savecred /persistent:yes /user:" $usr & " " & $pwd) Br, UEZ1 point
-
Is there an easy way?
Clark reacted to monoscout999 for a topic
Maybe using arrays and a check variable and a function to do the job, it is not so hard, right now i can not write any snippet, but later i will post an example of what i am saying1 point -
If pop-up window exists than do some action
monoscout999 reacted to m00 for a topic
Hello, I happened to be working on an "Is IIS installed on this server" script this afternoon for work, and I came across this thread. It looks like you are opening a configuration window to check on whether IIS is installed or not. I'm sure you could probably get that to work, but it seems pretty slow, and you'd have to wait while windows get opened, etc. You should be able to check if IIS is installed or not on a single registry key: source: http://geekswithblogs.net/sdorman/archive/2007/03/01/107732.aspx Here is what I am using currently. It meets my needs, though you may want to expand if you have other goals. $iiskey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp" ;takes our IIS key and checks to see if it exists. we will be using error codes to determine whether it is installed or not. RegRead($iiskey,"") If @error > 1 Then MsgBox(16,"IIS Status Check Error","Unable to open registry, or main key inaccessible.") ElseIf @error = 1 Then MsgBox(48,"IIS NOT Installed","IIS is not installed on this server.") ElseIf @error <1 Then MsgBox(64,"IIS Installed","Success!" & @CRLF & "IIS is installed on this server.") EndIf1 point -
How i can move the mouse to place by controlclick cords?
KeyOne reacted to monoscout999 for a topic
I got a demostration script about some controlcommands... look #include <winapi.au3> If not winexists("[Class:CalcFrame]") then ShellExecute("calc") ; if calc doesn`t exists, it run it. Winwait("[Class:CalcFrame]") ; waits until calc exists. $hndl = WinActivate("[Class:CalcFrame]") ; Active calc, and save the window handle in a variable. $pos = Controlgetpos("[Class:CalcFrame]","","[CLASS:Button; INSTANCE:5]") ; Get the position of the button "1". Msgbox(0,"Position of the button","Position of the control inside the clien area"&@CRLF _ &"The X coord of the control inside the client area is "&$pos[0]&@CRLF _ &"The Y coord of the control inside the client area is "&$pos[1]&@CRLF _ &"The width of the control is "&$pos[2]&@CRLF _ &"The height of the control is "&$pos[3]&@CRLF) ; -----------Preparating the Structure for the function call to get the absolute coords of the control ----------- $tPoint = DllStructCreate($tagPoint) ; The Struct tagPoint is alreade declared, it has two elements "x" and "y" DllStructsetdata($tPoint, "x",$pos[0]) ; I put in the element X of the structure the X pos of the control DllStructsetdata($tPoint, "y",$pos[1]) ; I put in the element Y of the structure the X pos of the control _WinAPI_ClientToScreen($hndl,$tPoint) ;~ Msgbox(0,"Position of the button","Absolute position of the control"&@CRLF _ ;~ &"The X coord of the control is "&DllStructgetdata($tPoint, "x")&@CRLF _ ;~ &"The Y coord of the control is "&DllStructgetdata($tPoint, "y")&@CRLF) ;IF YOU WANT TO SAVE THE DATA INTO VARIABLES YOU SHOULD DO THIS. $x = DllStructgetdata($tPoint, "x") $y = DllStructgetdata($tPoint, "y") $tPoint = 0 ; free the struct. Msgbox(0,"Position of the button","Absolute position of the control"&@CRLF _ &"The X coord of the control is "&$x&@CRLF _ &"The Y coord of the control is "&$y&@CRLF) mousemove($x, $y, 15) sleep(500) mousemove($x + $pos[2], $y + $pos[3], 15) sleep(500) MsgBox(0,"ControlSend","You can send the keys input directly to a control") ControlSend("[Class:CalcFrame]","","[CLASS:#32770; INSTANCE:1]","123456789") sleep(1000) ControlClick("[Class:CalcFrame]","","[CLASS:Button; INSTANCE:13]") sleep(1000) For $i = 1 to 9 ControlSend("[Class:CalcFrame]","","[CLASS:#32770; INSTANCE:1]",$i) sleep(500) Next sleep(500) ControlClick("[Class:CalcFrame]","","[CLASS:Button; INSTANCE:13]") sleep(500) MsgBox(0,"Non active window try","Now we gonna try to do this but with the window minimized") sleep(500) winsetstate("[Class:CalcFrame]","",@SW_MINIMIZE) sleep(500) For $i = 9 to 1 step -1 ControlSend("[Class:CalcFrame]","","[CLASS:#32770; INSTANCE:1]",$i) sleep(500) Next Msgbox(0,"It is the end","This is the end of the demostration, good look")1 point