Leaderboard
Popular Content
Showing content with the highest reputation on 06/04/2021 in all areas
-
Migration from AHK - OSC Support?
AndreRodrigues and 3 others reacted to water for a topic
I don't think AutoIt's spelling is the OP's biggest problem4 points -
adding timers in my loops
EmyJaneAlovera and one other reacted to JockoDundee for a topic
Just a little higher than the probability that it returns exactly 10000 twice, in succeeding statements Until Not @error Or TimerDiff($start) = 10000 If TimerDiff($start) = 10000 Then2 points -
Replace "." with "," - replaces all numbers in to ,
JockoDundee and one other reacted to FrancescoDiMuro for a topic
The period in Regular Expressions is the meta character for "every character", so, unless you escape it with \, the function is doing its work You don't really need StringRegExpReplace() to do such a simple task; just use StringReplace(), or, if you want to use SRER because you are a cat (you'll probably know in a few posts), then you should do something like this: #include <StringConstants.au3> Test() Func Test() Local $strTest = "715.99" ConsoleWrite(StringRegExpReplace($strTest, '\.', ',') & @CRLF) ConsoleWrite(StringReplace($strTest, '.', ',') & @CRLF) EndFunc2 points -
Replace "." with "," - replaces all numbers in to ,
FrancescoDiMuro reacted to JockoDundee for a topic
Actually, I think your non-SRE solution is cat proof. Well done!1 point -
adding timers in my loops
EmyJaneAlovera reacted to SkysLastChance for a topic
I am betting you only changed one. You need to change both of them. #include <MsgBoxConstants.au3> $start = TimerInit() Do PixelSearch(971,636,977,638,0xFFFFFF) Until Not @error Or TimerDiff($start) >= 10000 If TimerDiff($start) >= 10000 Then MsgBox($MB_OK,"ERROR","TIMEOUT!!!",0) Exit ElseIf Not @error then EndIf1 point -
adding timers in my loops
EmyJaneAlovera reacted to water for a topic
Welcome to AutoIt and the forum! How high is the probability that TimerDiff returns exactly the value 10000?1 point -
Replace "." with "," - replaces all numbers in to ,
TheXman reacted to FrancescoDiMuro for a topic
@TheXman Thanks for the correction! What can I say... You have an eagle eye!1 point -
Replace "." with "," - replaces all numbers in to ,
FrancescoDiMuro reacted to TheXman for a topic
Tiny correction: I think you meant the period (.) in Regular Expressions is the meta character for "any character".1 point -
WebDriver UDF - Help & Support (III)
OliverTonn reacted to Danp2 for a topic
@OliverTonnYou will need to become familiar with the browser's Developer Tools. You can access them by pressing the F12 key. I suggest that you also take a look at ChroPath, which is a browser extension that will help with obtaining the correct xpath.1 point -
Replace "." with "," - replaces all numbers in to ,
FrancescoDiMuro reacted to ArtoAllan for a topic
My man! Exactly what I was looking for! $Test = StringRegExpReplace("715.99", '\.', ',') ; <--- simplified That does the trick, thank you soo much for a fast answer buddy! Appreciate it1 point -
tst00.au3 and tst00.vb based on DotNetAll.au3 and the techniques of Using C# and VB Code demonstrates how the example for the .NET DataGridView class can be run in an AutoIt script. The VB code in tst00.vb is slightly modified to run the code in AutoIt. See the comments at top and bottom of tst00.vb. tst00.au3 is the AutoIt code which, using DotNetAll.au3, executes the VB code in tst00.vb. Edit a cell: Left-click to select a row. Left-click again to select a cell. Enter/Escape to accept/cancel the text in the edit control. tst00.vb Imports System 'This line must be added to run the code in AutoIT. Imports System.Drawing Imports System.Windows.Forms Public Class Form1 Inherits System.Windows.Forms.Form Private buttonPanel As New Panel Private WithEvents songsDataGridView As New DataGridView Private WithEvents addNewRowButton As New Button Private WithEvents deleteRowButton As New Button Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As EventArgs) Handles MyBase.Load SetupLayout() SetupDataGridView() PopulateDataGridView() End Sub Private Sub songsDataGridView_CellFormatting(ByVal sender As Object, _ ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) _ Handles songsDataGridView.CellFormatting If e IsNot Nothing Then If Me.songsDataGridView.Columns(e.ColumnIndex).Name = _ "Release Date" Then If e.Value IsNot Nothing Then Try e.Value = DateTime.Parse(e.Value.ToString()).ToLongDateString() e.FormattingApplied = True Catch ex As FormatException Console.WriteLine("{0} is not a valid date.", e.Value.ToString()) End Try End If End If End If End Sub Private Sub addNewRowButton_Click(ByVal sender As Object, _ ByVal e As EventArgs) Handles addNewRowButton.Click Me.songsDataGridView.Rows.Add() End Sub Private Sub deleteRowButton_Click(ByVal sender As Object, _ ByVal e As EventArgs) Handles deleteRowButton.Click If Me.songsDataGridView.SelectedRows.Count > 0 AndAlso _ Not Me.songsDataGridView.SelectedRows(0).Index = _ Me.songsDataGridView.Rows.Count - 1 Then Me.songsDataGridView.Rows.RemoveAt( _ Me.songsDataGridView.SelectedRows(0).Index) End If End Sub Private Sub SetupLayout() Me.Size = New Size(600, 500) With addNewRowButton .Text = "Add Row" .Location = New Point(10, 10) End With With deleteRowButton .Text = "Delete Row" .Location = New Point(100, 10) End With With buttonPanel .Controls.Add(addNewRowButton) .Controls.Add(deleteRowButton) .Height = 50 .Dock = DockStyle.Bottom End With Me.Controls.Add(Me.buttonPanel) End Sub Private Sub SetupDataGridView() Me.Controls.Add(songsDataGridView) songsDataGridView.ColumnCount = 5 With songsDataGridView.ColumnHeadersDefaultCellStyle .BackColor = Color.Navy .ForeColor = Color.White .Font = New Font(songsDataGridView.Font, FontStyle.Bold) End With With songsDataGridView .Name = "songsDataGridView" .Location = New Point(8, 8) .Size = New Size(500, 250) .AutoSizeRowsMode = _ DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders .ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single .CellBorderStyle = DataGridViewCellBorderStyle.Single .GridColor = Color.Black .RowHeadersVisible = False .Columns(0).Name = "Release Date" .Columns(1).Name = "Track" .Columns(2).Name = "Title" .Columns(3).Name = "Artist" .Columns(4).Name = "Album" .Columns(4).DefaultCellStyle.Font = _ New Font(Me.songsDataGridView.DefaultCellStyle.Font, FontStyle.Italic) .SelectionMode = DataGridViewSelectionMode.FullRowSelect .MultiSelect = False .Dock = DockStyle.Fill End With End Sub Private Sub PopulateDataGridView() Dim row0 As String() = {"11/22/1968", "29", "Revolution 9", _ "Beatles", "The Beatles [White Album]"} Dim row1 As String() = {"1960", "6", "Fools Rush In", _ "Frank Sinatra", "Nice 'N' Easy"} Dim row2 As String() = {"11/11/1971", "1", "One of These Days", _ "Pink Floyd", "Meddle"} Dim row3 As String() = {"1988", "7", "Where Is My Mind?", _ "Pixies", "Surfer Rosa"} Dim row4 As String() = {"5/1981", "9", "Can't Find My Mind", _ "Cramps", "Psychedelic Jungle"} Dim row5 As String() = {"6/10/2003", "13", _ "Scatterbrain. (As Dead As Leaves.)", _ "Radiohead", "Hail to the Thief"} Dim row6 As String() = {"6/30/1992", "3", "Dress", "P J Harvey", "Dry"} With Me.songsDataGridView.Rows .Add(row0) .Add(row1) .Add(row2) .Add(row3) .Add(row4) .Add(row5) .Add(row6) End With With Me.songsDataGridView .Columns(0).DisplayIndex = 3 .Columns(1).DisplayIndex = 4 .Columns(2).DisplayIndex = 0 .Columns(3).DisplayIndex = 1 .Columns(4).DisplayIndex = 2 End With End Sub <STAThreadAttribute()> _ Public Shared Sub Main() '<STAThreadAttribute()> and the Shared keyword doesn't work in AutoIt. Application.EnableVisualStyles() 'This means that the Main() function here cannot be executed directly. Application.Run(New Form1()) End Sub Public Sub RunMain() 'Add this function to execute Main() in AutoIt. Main() End Sub End Class tst00.au3 #include "DotNetAll.au3" Opt( "MustDeclareVars", 1 ) Example() Func Example() Local $oNetCode = DotNet_LoadVBcode( FileRead( "tst00.vb" ), "System.dll | System.Drawing.dll | System.Windows.Forms.dll" ) Local $oForm1 = DotNet_CreateObject( $oNetCode, "Form1" ) $oForm1.RunMain() EndFunc But I think the code in FirstTest.au3 and the GuiListViewSCN.au3 UDF works better. The code is an attempt to simulate a grid control with a listview. The selected cell is marked in yellow. It can be selected with left-click and moved with the arrow keys, Page Up/Down and Home/End. A double-click or Enter in the selected cell or a double-click in a non-selected cell will start editing the cell. Enter/Escape accepts/cancels the text in the edit control. The GuiListViewSCN.au3 UDF originates from a larger project and is still under development. Therefore, the UDF contains much more code than is needed for this small example. FirstTest.au3 #AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=y Opt( "MustDeclareVars", 1 ) ; Official includes #include <GuiEdit.au3> #include <GuiListView.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $iRows = 1000, $iCols = 15 ; Rows, Columns Global $idListView, $hListView ; ListView Global $iListViewWidth ; ListView Global $aData[$iRows][$iCols] ; Data ; Cell editing Global $hEdit, $idEditOpen, $idEditClose, $bEditOpen = False, $aEdit[4] Global $bEditOpenOnEnter = True, $bEditOpenOnSpace = False ; Open Edit control on Enter key and/or Space key Global $bEditOpenOnDoubleClick = True ; Open Edit control on double (True) or single (False) click in cell ; Project includes #include "GuiListViewSCN.au3" ; Single Cell Navigation Example() Func Example() ; Fill data For $i = 0 To $iRows - 1 For $j = 0 To $iCols - 1 $aData[$i][$j] = $i & "/" & $j Next Next ; Create GUI Local $iGuiWidth = $iCols * 90 + 40, $iGuiHeight = 788 + 20 Local $hGui = GUICreate( "Simulate Grid Control With ListView", $iGuiWidth, $iGuiHeight ) GUIRegisterMsg( $WM_NOTIFY, "WM_NOTIFY" ) ; WM_NOTIFY message handler ; Create ListView Default style Select one row Virtual Border $idListView = GUICtrlCreateListView( "", 10, 10, $iGuiWidth-19, $iGuiHeight-20, $GUI_SS_DEFAULT_LISTVIEW-$LVS_SINGLESEL+$LVS_OWNERDATA, $WS_EX_CLIENTEDGE ) GUICtrlSendMsg( $idListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, 0, $LVS_EX_DOUBLEBUFFER+$LVS_EX_FULLROWSELECT+$LVS_EX_GRIDLINES ) $hListView = GUICtrlGetHandle( $idListView ) ; Reduce flicker Highlight entire row Grid lines $iListViewWidth = $iGuiWidth-19-20 ; Header handle Local $hHeader = GUICtrlSendMsg( $idListView, $LVM_GETHEADER, 0, 0 ) ; In a non-resizable GUI, column widths shouldn't be changeable by dragging header dividers ; _WinAPI_SetWindowLong( $hHeader, $GWL_STYLE, _WinAPI_GetWindowLong( $hHeader, $GWL_STYLE ) + $HDS_NOSIZING ) ; AutoIt 3.3.14.5 issue DllCall( "user32.dll", "long_ptr", @AutoItX64 ? "SetWindowLongPtrW" : "SetWindowLongW", "hwnd", $hHeader, "int", $GWL_STYLE, "long_ptr", _ DllCall( "user32.dll", "long_ptr", @AutoItX64 ? "GetWindowLongPtrW" : "GetWindowLongW", "hwnd", $hHeader, "int", $GWL_STYLE )[0] + $HDS_NOSIZING ) ; Add columns Local $tBuffer = DllStructCreate( "wchar Text[10]" ), $pBuffer = DllStructGetPtr( $tBuffer ) Local $tColumn = DllStructCreate( $tagLVCOLUMN ), $pColumn = DllStructGetPtr( $tColumn ) DllStructSetData( $tColumn, "Mask", BitOR( $LVCF_FMT, $LVCF_WIDTH, $LVCF_TEXT ) ) DllStructSetData( $tColumn, "Text", $pBuffer ) DllStructSetData( $tColumn, "CX", 90 ) For $i = 0 To $iCols - 1 DllStructSetData( $tBuffer, "Text", "Col" & $i ) DllStructSetData( $tColumn, "TextMax", 2 * StringLen( "Col" & $i ) + 2 ) GUICtrlSendMsg( $idListView, $LVM_INSERTCOLUMNW, $i, $pColumn ) Next ; Set number of rows GUICtrlSendMsg( $idListView, $LVM_SETITEMCOUNT, $iRows, 0 ) ; Cell editing ; Edit control open and close events $idEditOpen = GUICtrlCreateDummy() $idEditClose = GUICtrlCreateDummy() ; Message handler for the Edit control Local $pEditHandler = DllCallbackGetPtr( DllCallbackRegister( "EditHandler", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr" ) ) ; Enable single cell navigation SCN_SingleCellNavigationEnable( $hGui, $idListView ) ; Show GUI GUISetState( @SW_SHOW ) Local $iRowsVis = GUICtrlSendMsg( $idListView, $LVM_GETCOUNTPERPAGE, 0, 0 ) ; Number of visible rows in ListView ConsoleWrite( "ListView height to fit " & $iRowsVis & " rows = " & _GUICtrlListViewWr_GetHeightToFitRows( $idListView, $iRowsVis ) & @CRLF ) ; Main loop While 1 Switch GUIGetMsg() ; Edit control open event from ListView Case $idEditOpen ; Create Edit control $hEdit = _GUICtrlEdit_Create( $hListView, "", $aEdit[0], $aEdit[1], $aEdit[2] - $aEdit[0], $aEdit[3] - $aEdit[1], $ES_AUTOHSCROLL ) _GUICtrlEdit_SetText( $hEdit, $aData[$SCN_iRowCur][$SCN_iColCur] ) _GUICtrlEdit_SetSel( $hEdit, 0, -1 ) ; Place mouse cursor in middle of Edit control Local $iMouseCoordMode = Opt( "MouseCoordMode", 2 ), $aPos = ControlGetPos( $hGui, "", $idListView ) MouseMove( $aEdit[0]+$aPos[0]+($aEdit[2]-$aEdit[0])/2, $aEdit[1]+$aPos[1]+($aEdit[3]-$aEdit[1])/2+2, 0 ) Opt( "MouseCoordMode", $iMouseCoordMode ) ; Message handler for the Edit control DllCall( "comctl32.dll", "bool", "SetWindowSubclass", "hwnd", $hEdit, "ptr", $pEditHandler, "uint_ptr", 0, "dword_ptr", 0 ) ; $iSubclassId = 0, $pData = 0 ; Set focus to Edit control _WinAPI_SetFocus( $hEdit ) $bEditOpen = True ; Edit control close event Case $idEditClose If Not $bEditOpen Then ContinueLoop If GUICtrlRead( $idEditClose ) Then _ ; Store Edit text $aData[$SCN_iRowCur][$SCN_iColCur] = _GUICtrlEdit_GetText( $hEdit ) ; Delete Edit control DllCall( "comctl32.dll", "bool", "RemoveWindowSubclass", "hwnd", $hEdit, "ptr", $pEditHandler, "uint_ptr", 0 ) ; $iSubclassId = 0 _GUICtrlEdit_Destroy( $hEdit ) $bEditOpen = False Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Cleanup ; Disable single cell navigation SCN_SingleCellNavigationDisable() GUIDelete() EndFunc ; Fill in data in virtual ListView. Func WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam ) Local $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ) Switch HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) ) Case $hListView Switch DllStructGetData( $tNMHDR, "Code" ) Case $LVN_GETDISPINFOW Local $tDispInfo = DllStructCreate( $tagNMLVDISPINFO, $lParam ) If Not BitAND( DllStructGetData( $tDispInfo, "Mask" ), $LVIF_TEXT ) Then Return 0 Local Static $tText = DllStructCreate( "wchar[50]" ), $pText = DllStructGetPtr( $tText ) DllStructSetData( $tText, 1, $aData[DllStructGetData($tDispInfo,"Item")][DllStructGetData($tDispInfo,"SubItem")] ) DllStructSetData( $tDispInfo, "Text", $pText ) Return 0 EndSwitch EndSwitch Return $GUI_RUNDEFMSG #forceref $hWnd, $iMsg, $wParam EndFunc The scripts has been tested on Windows 7. All code is contained in GridControls.7z: GridControls.7z VirtualKeyboard.au3 is contained in ListViewEditingCells.7z: ListViewEditingCells.7z1 point
-
_CommAPI_GetCOMPorts()1 point
-
webdriver - more than one submit
SkysLastChance reacted to Danyfirex for a topic
I meant this: Local $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit'][@value='Search']","",True) _ArrayDisplay($aElements) Saludos1 point -
WebDriver UDF (W3C compliant version) - 2024/09/21
SkysLastChance reacted to Danp2 for a topic
Actually, it will return an array, but only if $lMultiple is True. If not, then it returns a single element id. Here's one way that you could try rewriting your code to use xpath -- $checkboxarray = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, ".x-tree-checkbox", "", True) _ArrayDisplay($checkboxarray)1 point -
I know This is an Old Topic but it really doesn't have a satisfactory answer What you actually need to do is to use A KMS Client Key for 8.1 at the initial install and then enter your Windows 8 key at the activation screen after first boot Here is a document listing all the MS Kms Client Keys https://docs.microsoft.com/en-us/windows-server/get-started/kmsclientkeys Install 8.1 with a win8 key KMS Client Setup Key Windows 8.1 Professional KMS Key GCRJD-8NW9H-F2CDX-CCM8D-9D6T91 point
-
I finally have some more space in the attachments folder. In the past I've had to sacrifice, delete lots of scripts I posted to be able to post more. That was shit. So, what's the subrogation in this context? It's a technique of loading dll file embedded in your script as a string or perhaps stored on a remote server. Purpose is to be able to call functions from some dll without it needed to be written on the HD. As you will see in the script I'm attaching you choose some existing file (in my case I'm going with explorer.exe) then out of embedded dll you construct new fully functional module on the fundaments of the choosen. After that you call functions from embedded module but now (and that's the beauty) you call from subrogated. Pseudo/pseudo-expressed example from the script below would be: Subrogor = "explorer.exe" Subrogee = "kernel32.dll" Subrogate(byref Subrogor, Subrogee) DllCall(Subrogor, FunctionFromSubrogee) There are different problems with (only) some dlls to embed. It can be used both for 32 and 64 bit dlls with no difference. Script: Subrogation.au3 This technique (mild) is used in this script. edit: New script.1 point
-
Try this: #include <WinAPI.au3> #include <Misc.au3> #include <GDIPlus.au3> #include <GuiSlider.au3> #include <EditConstants.au3> #include <SliderConstants.au3> #include <StaticConstants.au3> #include <UpDownConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> Opt("GUIOnEventMode", 1) ;GUISetState(@SW_SHOW) HotKeySet("{ESC}", "Beenden") ;declare Dim $Pos Dim $PosOld[2] Dim $PosSlOld[4] Local $hGUI, $hChild, $hWnd_Desktop, $menu1 Local $hDC_Dest, $hDC_Source, $backbuffer Local $iX, $iY, $iW, $iH, $Lupe, $copyLupe Local $countLR, $countHR, $coordLR, $coordHR, $iXo, $iYo Local $Sl1ScaleMin, $Sl1ScaleMax, $Sl2ScaleMin, $Sl2ScaleMax, $SliderObenPos, $SliderUntenPos, $SliderLinksPos, $SliderRechtsPos $Scale = 10 $Sl1ScaleMin = 0 $Sl1ScaleMax = @DesktopWidth $Sl2ScaleMin = 0 $Sl2ScaleMax = @DesktopHeight $dll = DllOpen("user32.dll") $dist = 96 $Border = 4 $PixelDat = 10 $Pos = MouseGetPos() ;GUI $hGUI = GUICreate("Main", 300, 510, -1, -1, $WS_EX_LAYERED, $WS_EX_TOPMOST) ;$hGraphic = GUICreate("", 300, 485, -1, -1, $WS_EX_LAYERED, $hGUI) $menu1 = GUICtrlCreateMenu("File") $menuexit = GUICtrlCreateMenuitem("Beenden", $menu1) $Slider1 = GUICtrlCreateSlider(5, 290, 160, 32, BitOR($TBS_AUTOTICKS, $TBS_BOTH, $TBS_NOTICKS, $TBS_FIXEDLENGTH, $WS_BORDER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) $Slider2 = GUICtrlCreateSlider(5, 345, 160, 32, BitOR($TBS_AUTOTICKS, $TBS_BOTH, $TBS_NOTICKS, $TBS_FIXEDLENGTH, $WS_BORDER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) $SliderOben = GUICtrlCreateSlider(37, 0, 226, 32, 0) $SliderUnten = GUICtrlCreateSlider(37, 230, 226, 34, BitOR($TBS_TOP, $TBS_LEFT)) $SliderLinks = GUICtrlCreateSlider(15, 17, 34, 226, $TBS_VERT) $SliderRechts = GUICtrlCreateSlider(250, 17, 34, 226, BitOR($TBS_VERT, $TBS_TOP, $TBS_LEFT)) ;~ $SliderOben = GUICtrlCreateSlider(37, 0, 226, 32, 0) ;~ $SliderUnten = GUICtrlCreateSlider(37, 230, 226, 34, BitOR($TBS_TOP, $TBS_LEFT)) ;~ $SliderLinks = GUICtrlCreateSlider(15, 17, 34, 226, $TBS_VERT) ;~ $SliderRechts = GUICtrlCreateSlider(250, 17, 34, 226, BitOR($TBS_VERT, $TBS_TOP, $TBS_LEFT)) $Input1 = GUICtrlCreateInput("", 4, 400, 184, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY)) $Input2 = GUICtrlCreateInput("", 4, 420, 184, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY)) $Input3 = GUICtrlCreateInput("", 4, 440, 184, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY)) $Input4 = GUICtrlCreateInput("", 220, 400, 50, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY)) $Input5 = GUICtrlCreateInput("", 60, 270, 30, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT)) $Input6 = GUICtrlCreateInput("", 60, 325, 30, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT)) $Pixel = GUICtrlCreateUpdown($Input4) $Label1 = GUICtrlCreateLabel("Koordinaten:", 5, 380, 64, 17) $Label2 = GUICtrlCreateLabel('x - Achse = ', 10, 270, 48, 17) $Label3 = GUICtrlCreateLabel('y - Achse = ', 10, 325, 48, 17) $hPen = _GDIPlus_PenCreate() GUISetState(@SW_SHOW, $hGUI) GUICtrlSetState($Slider1, $GUI_DISABLE) GUICtrlSetLimit($Slider1, @DesktopWidth, 0) GUICtrlSetData($Slider1, $iX) GUICtrlSetState($Slider2, $GUI_DISABLE) GUICtrlSetLimit($Slider2, @DesktopHeight, 0) GUICtrlSetData($Slider2, $iY) GUICtrlSetLimit($SliderOben, 200, 0) GUICtrlSetData($SliderOben, 80) GUICtrlSetLimit($SliderUnten, 200, 0) GUICtrlSetData($SliderUnten, 120) GUICtrlSetLimit($SliderLinks, 200, 0) GUICtrlSetData($SliderLinks, 80) GUICtrlSetLimit($SliderRechts, 200, 0) GUICtrlSetData($SliderRechts, 120) $SliderObenPos = _GUICtrlSlider_GetPos($SliderOben) $SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten) $SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks) $SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts) ;GUISetState(@SW_SHOW, $hGUI) GUISetOnEvent($GUI_EVENT_CLOSE, "Beenden") GUICtrlSetOnEvent($menuexit, "Beenden") GUICtrlSetFont($Label1, 8, 400, 4, "MS Sans Serif") GUICtrlSetData($Input4, $PixelDat) $hLupe = GUICreate("", ($dist / 2), ($dist / 2), $Pos[0] + ($dist / 8), $Pos[1] + ($dist / 8), $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_STATICEDGE), $hGUI) GUICtrlSetBkColor(GUICtrlCreateLabel("", 0, 0, ($dist / 2), ($dist / 2)), 0xFF0000) GUICtrlSetBkColor(GUICtrlCreateLabel("", 2, 2, (($dist / 2) - $Border), (($dist / 2) - $Border)), 0xABCDEF) GUISetState() _GDIPlus_Startup() _WinAPI_SetLayeredWindowAttributes($hLupe, 0xABCDEF, 255) $hWnd_Desktop = _WinAPI_GetDesktopWindow() $hDC_Source = _WinAPI_GetDC($hWnd_Desktop) $hDC_Dest = _WinAPI_GetDC($hGUI) ;Backbuffer ?!? $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Schleife While GUIGetMsg(1) <> $GUI_EVENT_CLOSE Sleep(75) ;Mousposition abfragen $Pos = MouseGetPos() ; Winposition abfragen $aWinPos = WinGetPos($hLupe) $iX = $aWinPos[0] ; x $iY = $aWinPos[1] ; y $iW = $aWinPos[2] ; width $iH = $aWinPos[3] ; height ;Wenn sich Mausposition ändert If $Pos[0] <> $PosOld[0] Or $Pos[1] <> $PosOld[1] Then WinMove($hLupe, "", $Pos[0] + ($dist / 8), $Pos[1] + ($dist / 8)) $PosOld = $Pos $countLR = 0 $countHR = 0 GUICtrlSetData($Slider1, $iX) GUICtrlSetData($Slider2, $iY) GUICtrlSetData($Input5, $iX + ($iW / 2)) GUICtrlSetData($Input6, $iY + ($iH / 2)) EndIf ;Wenn Bewegungstaste gedrückt If _IsPressed('25', $dll) And $iX > $Sl1ScaleMin Then ;links gedrückt $countLR = $countLR + (-1) WinMove($hLupe, "", $iX - $Scale, $iY) GUICtrlSetData($Input5, $iX + ($iW / 2)) GUICtrlSetData($Slider1, $iX) _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) ElseIf _IsPressed('27', $dll) And ($iX + $iW) < $Sl1ScaleMax Then ;rechts gedrückt $countLR = $countLR + 1 WinMove($hLupe, "", $iX + $Scale, $iY) GUICtrlSetData($Input5, $iX + ($iW / 2)) GUICtrlSetData($Slider1, $iX) _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) ElseIf _IsPressed('26', $dll) And $iY > $Sl2ScaleMin Then ;hoch gedrückt $countHR = $countHR + (-1) WinMove($hLupe, "", $iX, $iY - $Scale) GUICtrlSetData($Input6, $iY + ($iH / 2)) GUICtrlSetData($Slider2, $iY) _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) ElseIf _IsPressed('28', $dll) And ($iY + $iH) < $Sl2ScaleMax Then ;runter gedrückt $countHR = $countHR + 1 WinMove($hLupe, "", $iX, $iY + $Scale) GUICtrlSetData($Input6, $iY + ($iH / 2)) GUICtrlSetData($Slider2, $iY) _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) EndIf ;InfoPost ToolTip(($aWinPos[0] + ($aWinPos[2] / 2)) & ', ' & ($aWinPos[1] + ($aWinPos[3] / 2)), $iX, $iY + $iH) GUICtrlSetData($Input1, 'Maus: x = ' & $Pos[0] & ' , y = ' & $Pos[1]) GUICtrlSetData($Input2, 'Auswahl: x = ' & $aWinPos[0] & ' , y = ' & $aWinPos[1]) GUICtrlSetData($Input3, 'Horizontal: ' & $countLR & ' , Vertikal: ' & $countHR) ;Pixelgrösse des zu kopierenden Objekts $PixelDat = 10 GUICtrlSetData($Input4, $PixelDat) ;Bild speichern If _IsPressed('10') Then $hBMP = _ScreenCapture_CaptureWnd(@DesktopDir & "\Image.jpg", $hLupe, $iX, $iY, $iX + $iW, $iY + $iH) _ScreenCapture_SaveImage(@DesktopDir & "\Image.jpg", $hBMP) EndIf If $SliderLinksPos > $SliderRechtsPos Then $Y = $SliderRechtsPos $height = $SliderLinksPos - $SliderRechtsPos Else $Y = $SliderLinksPos $height = $SliderRechtsPos - $SliderLinksPos EndIf If $SliderObenPos > $SliderUntenPos Then $X = $SliderUntenPos $width = $SliderObenPos - $SliderUntenPos Else $X = $SliderObenPos $width = $SliderUntenPos - $SliderObenPos EndIf ;Auswahl Slider $SliderObenPos = _GUICtrlSlider_GetPos($SliderOben) $SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten) $SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks) $SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts) If $SliderObenPos <> $PosSlOld[0] Or $SliderUntenPos <> $PosSlOld[1] Or $SliderLinksPos <> $PosSlOld[2] Or $SliderRechtsPos <> $PosSlOld[3] Then $PosSlOld[0] = $SliderObenPos $PosSlOld[1] = $SliderUntenPos $PosSlOld[2] = $SliderLinksPos $PosSlOld[3] = $SliderRechtsPos EndIf ; Bild per StretchBlt übertragen $Lupe = _WinAPI_StretchBlt( _ $hDC_Dest, 50, 30, 200, 200, _ $hDC_Source, $iX, $iY, $iW, $iH, _ $SRCCOPY) $SliderObenPos = _GUICtrlSlider_GetPos($SliderOben) $SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten) $SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks) $SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts) _GDIPlus_GraphicsDrawLine ($hGraphic, 50, 30 + $SliderLinksPos, 248, 30 + $SliderLinksPos, $hPen); oben _GDIPlus_GraphicsDrawLine ($hGraphic, 50, 30 + $SliderRechtsPos, 248, 30 + $SliderRechtsPos, $hPen); unten _GDIPlus_GraphicsDrawLine ($hGraphic, 50 + $SliderObenPos, 30, 50 + $SliderObenPos, 230, $hPen); links _GDIPlus_GraphicsDrawLine ($hGraphic, 50 + $SliderUntenPos, 30, 50 + $SliderUntenPos, 230, $hPen); rechts WEnd ;Funktionen Func _WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop) ; See _WinAPI_BitBlt Local $Ret = DllCall('gdi32.dll', 'int', 'StretchBlt', 'hwnd', $hDestDC, 'int', $iXDest, 'int', $iYDest, 'int', $iWidthDest, 'int', $iHeightDest, 'hwnd', $hSrcDC, 'int', $iXSrc, 'int', $iYSrc, 'int', $iWidthSrc, 'int', $iHeightSrc, 'dword', $iRop) If (@error) Or (Not IsArray($Ret)) Then Return SetError(1, 0, 0) EndIf Return 1 EndFunc ;==>_WinAPI_StretchBlt Func Beenden() Exit EndFunc ;==>Beenden You you release all the GDI+ stuff when closing the app. Gruß, UEZ1 point