Leaderboard
Popular Content
Showing content with the highest reputation on 12/14/2016 in all areas
-
I was looking at Trac on AutoIt and decided just to create this quick function which displays the number of monitors connected as well as the total width/height of all monitors. I know this is available elsewhere but felt I would contribute anyway. Thanks. Function: ; #FUNCTION# ==================================================================================================================== ; Name ..........: _DesktopDimensions ; Description ...: Returns an array containing information about the primary and virtual monitors. ; Syntax ........: _DesktopDimensions() ; Return values .: Success - Returns a 6-element array containing the following information: ; $aArray[0] = Total number of monitors. ; $aArray[1] = Width of the primary monitor. ; $aArray[2] = Height of the primary monitor. ; $aArray[3] = Total width of the desktop including the width of multiple monitors. Note: If no secondary monitor this will be the same as $aArray[2]. ; $aArray[4] = Total height of the desktop including the height of multiple monitors. Note: If no secondary monitor this will be the same as $aArray[3]. ; Author ........: guinness ; Remarks .......: WinAPI.au3 must be included i.e. #include <WinAPI.au3> ; Related .......: @DesktopWidth, @DesktopHeight, _WinAPI_GetSystemMetrics ; Example .......: Yes ; =============================================================================================================================== Func _DesktopDimensions() Local $aReturn = [_WinAPI_GetSystemMetrics($SM_CMONITORS), _ ; Number of monitors. _WinAPI_GetSystemMetrics($SM_CXSCREEN), _ ; Width or Primary monitor. _WinAPI_GetSystemMetrics($SM_CYSCREEN), _ ; Height or Primary monitor. _WinAPI_GetSystemMetrics($SM_CXVIRTUALSCREEN), _ ; Width of the Virtual screen. _WinAPI_GetSystemMetrics($SM_CYVIRTUALSCREEN)] ; Height of the Virtual screen. Return $aReturn EndFunc ;==>_DesktopDimensionsExample use of Function: #include <WinAPI.au3> #include <WindowsConstants.au3> Local $aScreenResolution = _DesktopDimensions() MsgBox($MB_SYSTEMMODAL, '', 'Example of _DesktopDimensions:' & @CRLF & _ 'Number of monitors = ' & $aScreenResolution[0] & @CRLF & _ 'Primary Width = ' & $aScreenResolution[1] & @CRLF & _ 'Primary Height = ' & $aScreenResolution[2] & @CRLF & _ 'Secondary Width = ' & $aScreenResolution[3] & @CRLF & _ 'Secondary Height = ' & $aScreenResolution[4] & @CRLF)1 point
-
I have tryed to compile this "com object" and then use with AutoIt3 but not work: "err.number 0x80020006. How to do? #include-once Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local Const $sCLSID_TaskbarList = "{7233b105-bc01-41ff-b72e-582c5954b76d}" Local Const $sIID_ITaskbarList = "{702d63b3-d7d1-4f17-ab11-2f2ed770fdc8}" Local Const $sTagITaskbarList = 'SetString(wstr:cdecl);wstr:cdecl GetString();' Local $oIExample = ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList, $sTagITaskbarList) $a=$oIExample.SetString("Abc") msgbox(0,@error,$a) $a=$oIExample.GetString() ;.GetRootElement.CurrentClassName exit msgbox(0,0,$a) Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc1 point
-
Using _IEFormElementOptionSelect I would imagine. <shrug> You asked a question and I answered it. If you want assistance with a specific website, then you will need to provide more information, such as: The site name / URL Your code showing what you have tried thus far If the site isn't open to the public, then it would be good if you found an example of one that is so that we can use it to test and provide you with a working solution.1 point
-
MyRiverRaid
coffeeturtle reacted to Luigi for a topic
A simple example using IrrLitch to render an airplane moving through a finite map in infinite loop. The map was built with the Tiled Map Editor and the code translates 2d images into its 3D equivalent. Q changes the camera (3 angles) T moves up G down arrows (up, down, left, right) movement https://github.com/chechelaky/MyRiverRaid1 point -
Sorry, I don't have time to test yours but I'll post a working script below that I've used in the past. Revise the ID name and password accordingly and let us know if you have any questions. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <GDIPlus.au3> ;#Escape program HotKeySet("{ESC}", "Terminate") Local $iWidthCell = 70 ;#GUI Create $width = 800 ;#GUI Create $height = 625 ;#GUI Create Global $x ;#Func Email Global $y ;#Func Password _IEErrorHandlerRegister() #Region ### START Koda GUI section ### Form= $hMain = GUICreate("Test", 1015, 585, @DesktopWidth / 2 - $width / 2, @DesktopHeight / 2 - $height / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $wPos = WinGetPos($hMain) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;#Input Email GUICtrlCreateLabel("Email:", 880, 65, $iWidthCell) $hInput1 = GUICtrlCreateInput("", 880, 90, 85, 20) ;#Input Password GUICtrlCreateLabel("Password:", 880, 115, $iWidthCell) $hInput2 = GUICtrlCreateInput("", 880, 140, 85, 20) ;#Initializes the IE Explore Local $RunProgram = GUICtrlCreateButton("Run Program", 880, 170, 85, 25) ;#IE Create Func internet() Local $oIE = _IECreateEmbedded() GUICtrlCreateObj($oIE, 0, 0, $width + 0, $height + 0) _IENavigate($oIE, "https://www.facebook.com/?_rdr=p") Local $username = _IEGetObjByName($oIE, "email") Local $password = _IEGetObjByName($oIE, "pass") Local $button = _IEGetObjByName($oIE, "u_0_x") _IEFormElementSetValue($username, $x) _IEFormElementSetValue($password, $y) ;$oBtn = _IEGetObjById($oIE, "u_0_x") ; works on the main login page ;$oBtn = _IEGetObjById($oIE, "u_0_2") ; works on the second login page ; _IEAction($oBtn, "click") EndFunc ;==>internet While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $RunProgram $x = GUICtrlRead($hInput1) $y = GUICtrlRead($hInput2) internet() EndSwitch WEnd Func Email($x) $x = ControlGetText(WinGetTitle("[AutoIt v3 GUI]"), "", "[CLASS:Edit; INSTANCE:1]") EndFunc ;==>Email Func Password($y) $y = ControlGetText(WinGetTitle("[AutoIt v3 GUI]"), "", "[CLASS:Edit; INSTANCE:2]") EndFunc ;==>Password Func Terminate() Exit EndFunc ;==>Terminate1 point
-
It's a nice little example you found there. You have to download, compile and run the C-code in the link. Then you create an object with ObjCreateInterface in this way: #include <WinAPIConstants.au3> Opt( "MustDeclareVars", 1 ) Global Const $sCLSID_Example = "{6899A2A3-405B-44d4-A415-E08CEE2A97CB}" Global Const $sIID_IExample = "{74666CAC-C2B1-4fa8-A049-97F3214802F0}" Global Const $dtag_IExample = _ "SetString hresult(str);" & _ "GetString hresult(str;int);" Example() Func Example() Local $oExample = ObjCreateInterface( $sCLSID_Example, $sIID_IExample, $dtag_IExample ) If Not IsObj( $oExample ) Then Return ConsoleWrite( "ObjCreateInterface ERR" & @CRLF ) ConsoleWrite( "ObjCreateInterface OK" & @CRLF ) If Not $oExample.SetString( "My grandmother could do that too" ) = $S_OK Then _ Return ConsoleWrite( "SetString method ERR" & @CRLF ) ConsoleWrite( "SetString method OK" & @CRLF ) Local $sStr1, $sStr2 = "is a cool coder" If Not $oExample.GetString( $sStr1, 16 ) = $S_OK Then _ Return ConsoleWrite( "GetString method ERR" & @CRLF ) ConsoleWrite( "GetString method OK" & @CRLF ) ConsoleWrite( $sStr1 & $sStr2 & @CRLF ) EndFunc #cs SciTE console: ObjCreateInterface OK SetString method OK GetString method OK My grandmother is a cool coder #ce1 point
-
Second Desktop - secure workspace with kiosk option
coffeeturtle reacted to RTFC for a topic
Two tiny, simple scripts (secondDesktop & desktopSwitch) that elaborate (slightly) on _WinAPI_CreateDesktop() to create a second workspace with some interesting features: Startup: define any number of programmes to be auto-started on the second desktop, hard-coded (by you, in desktopSwitch.au3) or parsed as parameters (from secondDesktop.au3);Full desktop mode: provides acccess to all your desktop shortcuts, start menu (Win7), taskbar, plus a one-button switch in both desktops;Kiosk mode: provides an empty workspace where only your designated startup entries will run; Switch button/GUI is absent; an unadvertised hotkey provides switching to the original desktop (Ctrl-Alt-Del still works, but a task manager started on the second desktop will appear on the original desktop). To enable kiosk mode, set flag $kioskmode=True in secondDesktop.au3;Security: software keyloggers running in your regular environment cannot capture keystrokes on the second desktop, and windows messages cannot be sent between desktops, so your apps won't be hijacked easily through remote control. (NB not extensively tested; use at your own risk!) In full desktop mode, the (red or green) background colour of the Switch GUI shows you whether you are on the exposed or secure desktop.I SecondDesktop.v0.8.7z (first beta release) Important: you'll need to compile desktopSwitch before running secondDesktop. You can test your edited version of desktopSwitch.au3 "dry," as a script on your regular desktop first, by setting its internal flag $testing=True; but don't forget to reset that flag again before compiling.1 point -
GUIHyperLink - Create HyperLink controls
jparnell8839 reacted to MrCreatoR for a topic
AutoIt version: 3.3.6.1 UDF version: 1.2 Description: This library allows easily to create HyperLink controls. Few Label-distinctive features: Example: Attachments: GUIHyperLink_1.2.zip GUICtrlHyperLink_1.1.zip GUICtrlHyperLink_1.0.zip Screenshot: Changelog:1 point -
As many are aware, the standard AutoIt Send() function can leave modifier keys (usually Shift, Alt, Ctrl) in a pressed-like state. While there are at least a few alternatives that can be found on this forum, as well as one in the Wiki (which i can't find at the moment), they have all failed me at some point, leaving a modifier key "stuck". So far i have had no issues with this function however. LAST UPDATED: 21-SEP-2014 #include-once ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendEx ; Description ...: alternative to built-in Send() function which prevents modifier keys from being left in a pressed state ; Syntax ........: _SendEx($sSendKeys[, $iTimeout[, $sReleaseKeys[, $hUser32Dll]]]) ; Parameters ....: $sSendKeys - string of keys to send in Send() format ; $hUser32Dll - [optional] handle to user32.dll ; $iTimeout - [optional] maximum time in ms to attempt to release pressed keys (minimum = 250) ; $sReleaseKeys - [optional] comma seperated string of keys to release before issuing Send() (no spaces). ; defaults to: Shift, Ctrl, Alt, L Win, R Win ; Return values .: Success returns 1, else sets @error to 1 and returns an error message string ; Release date ..: 25-May-2014 ; Modify date ...: 21-Sep-2014 ; Author ........: iCode ; Modified by ...: ; Remarks .......: ; Related .......: Send() ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SendEx($sSendKeys, $hUser32Dll = "", $iTimeout = 2000, $sReleaseKeys = "0x10,0x11,0x12,0x5B,0x5C") Local $bCloseDll, $sRet Local $iDelay = Opt("SendKeyDelay") + Opt("SendKeyDownDelay") If $iDelay < 50 Then $iDelay = 50 Local $aReleaseKeys = StringSplit($sReleaseKeys, ",") If @error Then Return SetError(1, 0, "Failed to create release key array") If $hUser32Dll <> "user32.dll" Then $hUser32Dll = DllOpen("user32.dll") If @error Then Return SetError(1, 0, "Failed to open handle to user32.dll") $bCloseDll = True EndIf $sRet = __ReleaseKeys($aReleaseKeys, $iTimeout, $hUser32Dll) If Not @error Then Send($sSendKeys) Sleep($iDelay) $sRet = __ReleaseKeys($aReleaseKeys, $iTimeout, $hUser32Dll) EndIf If $bCloseDll Then DllClose("user32.dll") If $sRet Then Return SetError(1, 0, $sRet) Return 1 EndFunc ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __ReleaseKeys ; Description ...: release pressed keys ; Syntax ........: __ReleaseKeys(Byref $aReleaseKeys, $iTimeout, $hUser32Dll) ; Parameters ....: $aReleaseKeys - [in/out] An array of unknowns. ; $iTimeout - An integer value. ; $hUser32Dll - A handle value. ; Return values .: None ; Author ........: iCode ; Modified ......: 25-May-2014 ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __ReleaseKeys(ByRef $aReleaseKeys, $iTimeout, $hUser32Dll) If $iTimeout < 50 Then $iTimeout = 250 Local $aRet, $hTimer = TimerInit() For $i = 0 To UBound($aReleaseKeys) - 1 $aRet = DllCall($hUser32Dll, "short", "GetAsyncKeyState", "int", $aReleaseKeys[$i]) If @error Then Return SetError(1, 0, "Dll call GetAsyncKeyState failed with key: " & $aReleaseKeys[$i]) If BitAND($aRet[0], 0x8000) <> 0 Then Do Sleep(100) DllCall($hUser32Dll, "int", "keybd_event", "int", $aReleaseKeys[$i], "int", 0, "long", 2, "long", 0) If @error Then Return SetError(1, 0, "Dll call keybd_event failed with key: " & $aReleaseKeys[$i]) $aRet = DllCall($hUser32Dll, "short", "GetAsyncKeyState", "int", $aReleaseKeys[$i]) If TimerDiff($hTimer) >= $iTimeout Then Return SetError(1, 0, "Time out limit reached") Until BitAND($aRet[0], 0x8000) = 0 EndIf Next EndFunc Change log... 29-JUN-2014 - changed the order of the parameters for _SendEx, moving $sReleaseKeys to the last position 21-SEP-2014 - in the interest of efficiency, i removed the StringStripWS() function - $sReleaseKeys can no longer have spaces in the string1 point