Leaderboard
Popular Content
Showing content with the highest reputation on 02/26/2021 in all areas
-
#include <GUIToolTip.au3> #include <WinAPITheme.au3> #include <WinAPIGdiInternals.au3> HotKeySet("{ESC}", _Exit) Global $hFont = _WinAPI_CreateFont(40, 0) Example() Func Example() ToolTip("Tooltip Test", Default, Default, Default, 0, 1) Local $hWnd = WinWait("Tooltip Test") _WinAPI_SetWindowTheme($hWnd, "", "") _GUIToolTip_SetTipTextColor($hWnd, 0xFFFFFF) _GUIToolTip_SetTipBkColor($hWnd,0x000000) _WinAPI_SetFont(WinGetHandle('Tooltip Test'), $hFont) ToolTip("Tooltip Test", Default, Default, Default, 0, 1) While Sleep(50) $pos = MouseGetPos(0) $pos2 = MouseGetPos(1) WinMove($hWnd, "", $pos, $pos2+20) WEnd EndFunc ;==>Example Func _Exit() _WinAPI_DeleteObject($hFont) Exit EndFunc I figured out how to do. Thank you all. JSON.au3 translate.au33 points
-
Resize control
Dan_555 and 2 others reacted to pixelsearch for a topic
What a headache... Here are the cursor shapes & values as shown in the help file, when we run the example found at topic GUISetCursor The values seem to match the constants found in AutoItConstants.au3, except the strange $IDC_HAND = 32649 lost in this "0 to 15" range : ; Mouse Constants ; Indicates current mouse cursor Global Const $IDC_UNKNOWN = 0 ; Unknown cursor Global Const $IDC_APPSTARTING = 1 ; Standard arrow and small hourglass Global Const $IDC_ARROW = 2 ; Standard arrow Global Const $IDC_CROSS = 3 ; Crosshair Global Const $IDC_HAND = 32649 ; Hand cursor Global Const $IDC_HELP = 4 ; Arrow and question mark Global Const $IDC_IBEAM = 5 ; I-beam Global Const $IDC_ICON = 6 ; Obsolete Global Const $IDC_NO = 7 ; Slashed circle Global Const $IDC_SIZE = 8 ; Obsolete Global Const $IDC_SIZEALL = 9 ; Four-pointed arrow pointing N, S, E, and W Global Const $IDC_SIZENESW = 10 ; Double-pointed arrow pointing NE and SW Global Const $IDC_SIZENS = 11 ; Double-pointed arrow pointing N and S Global Const $IDC_SIZENWSE = 12 ; Double-pointed arrow pointing NW and SE Global Const $IDC_SIZEWE = 13 ; Double-pointed arrow pointing W and E Global Const $IDC_UPARROW = 14 ; Vertical arrow Global Const $IDC_WAIT = 15 ; Hourglass I wanted to understand why argumentum couldn't use _WinAPI_LoadCursor() to load the cursor he needed, with a handle returned = 0 when he used the variable $IDC_SIZENWSE, then _WinAPI_GetLastError() returning 1813 ("resource not found") So I decided to create a loop, from 0 to 32767 to test each and every value, hoping something will happen : Local $hCursor For $i = 0 To 32767 $hCursor = _WinAPI_LoadCursor(0, $i) If $hCursor <> 0 Then ConsoleWrite($i & " $hCursor = " & $hCursor & @crlf) ExitLoop EndIf Next Good surprise : 1st handle <> 0 appeared when $i = 100, which means that the cursor constants found in AutoItConstants.au3 are wrong... as noticed by a user 5 years ago in this link So there are 2 ranges of values (on my computer) where cursors are found : 100 to 116 and the 32000+ (as shown at msdn) 100 / 32512 => Arrow ( 2) 101 / 32513 => IBeam ( 5) 102 / 32514 => Wait (15) 103 / 32515 => Cross ( 3) 104 / 32516 => UpArrow (14) 105 / 32642 => SizeNWSE (12) for argumentum 106 / 32643 => SizeNESW (10) 107 / 32644 => SizeWE (13) 108 / 32645 => SizeNS (11) 109 / 32646 => SizeAll ( 9) 110 / 32648 => No ( 7) 111 / 32650 => AppStarting ( 1) 112 / 32651 => Help ( 4) 113 / 32631 => Pen ( ?) 114 / 32649 => Hand ( 0) 115 => TV (?) ( ?) 116 / 32663 => CD ( ?) / 32652 => North-South ( ?) / 32653 => West-East ( ?) / 32654 => 4 Dir ( ?) / 32655 => North ( ?) / 32656 => South ( ?) / 32657 => West ( ?) / 32658 => East ( ?) / 32659 => NW ( ?) / 32660 => NE ( ?) / 32661 => SW ( ?) / 32662 => SE ( ?) The list above indicates the correct constants on the left, with the corresponding erroneous AutoIt constants on the right. Here are the cursor shapes as found on my computer And the script for argumentum, using _WinAPI_LoadCursor() to load the SizeNWSE cursor #include <GUIConstants.au3> #include <WinAPI.au3> ; for _WinAPI_CreateWindowEx() #include <WinAPIRes.au3> ; for _WinAPI_LoadCursor() #include <WinAPISys.au3> ; for _WinAPI_SetClassLongEx() Opt("MustDeclareVars", 1) Global Const $SBS_SIZEBOX = 0x08 Global Const $SBS_SIZEGRIP = 0x10 Global $hGui, $hSizebox Example() Func Example() $hGui = GUICreate("Resize corner", 300, 200, -1, 300, $WS_OVERLAPPEDWINDOW) $hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, _ 300 - 20, 200 - 20, 20, 20, $hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP Local $hCursor = _WinAPI_LoadCursor(0, 32642) ; SizeNWSE _WinAPI_SetClassLongEx($hSizebox, $GCL_HCURSOR, $hCursor) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGui) _WinAPI_DestroyCursor($hCursor) Exit EndFunc ;==>Example Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $aSize = WinGetClientSize($hGui) WinMove($hSizebox, "", $aSize[0] - 20, $aSize[1] - 20) EndFunc ;==>WM_SIZE We finally made it3 points -
Resize control
Zedna and one other reacted to pixelsearch for a topic
@argumentum : the thread isn't new but I just found something that may be interesting, without the label and $GUI_EVENT_PRIMARYUP workaround. It works with _WinAPI_LoadCursorFromFile (let's hope someone will have it work with _WinAPI_LoadCursor too) . You need the external AutoIt .cur file (or .ani file) to run the script, I'm uploading them at the end of this post. #include <APISysConstants.au3> #include <GUIConstants.au3> #include <WinAPIRes.au3> #include <WinAPISysWin.au3> Opt("MustDeclareVars", 1) Global Const $SBS_SIZEBOX = 0x08 Global Const $SBS_SIZEGRIP = 0x10 Global $hGui, $hSizebox, $hCursor Example() Func Example() $hGui = GUICreate("Resize corner", 250, 100, -1, 300, $WS_OVERLAPPEDWINDOW) $hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, _ 300 - 20, 200 - 20, 20, 20, $hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP $hCursor = _WinAPI_LoadCursorFromFile(@ScriptDir & '\lens.cur') ; or horse.ani, dinosaur.ani etc... _WinAPI_SetClassLongEx($hSizebox, $GCL_HCURSOR, $hCursor) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGui) _WinAPI_DestroyCursor($hCursor) Exit EndFunc ;==>Example Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $aSize = WinGetClientSize($hGui) WinMove($hSizebox, "", $aSize[0] - 20, $aSize[1] - 20) EndFunc ;==>WM_SIZE Now we just gotta find a cursor file containing the $IDC_SIZENWSE cursor I'm joining below the .cur and 2 .ani files, as found in AutoIt folders Lens.cur horse.ani dinosaur.ani2 points -
Software Install with progress bar showing percentage
Sam2022 reacted to JLogan3o13 for a topic
@Sam2022 Look in the help file under ProgressOn, ProgressSet, and ProgressOff; there is your "simple" as each has examples. Start from there.1 point -
Great.... So what is the issue you have that you need help with? ....or do you want me to write it for you for a hefty fee? Jos1 point
-
ToolTip set style - (Moved)
ioa747 reacted to argumentum for a topic
#include <GUIToolTip.au3> #include <WinAPITheme.au3> #include <WinAPIGdiInternals.au3> HotKeySet("{ESC}", _Exit) Global $hFont = _WinAPI_CreateFont(40, 0) Example() Func Example() ToolTip("Tooltip Test", -100, -100, Default, 0, 1) ; hide it from view Local $pos, $hWnd = WinWait("Tooltip Test") _WinAPI_SetWindowTheme($hWnd, "", "") _GUIToolTip_SetTipTextColor($hWnd, 0xFFFFFF) _GUIToolTip_SetTipBkColor($hWnd, 0x000000) _WinAPI_SetFont($hWnd, $hFont) ToolTip("Tooltip Test", Default, Default, Default, 0, 1) While Sleep(50) $pos = MouseGetPos() ; this is faster WinMove($hWnd, "", $pos[0], $pos[1] + 20) WEnd EndFunc ;==>Example Func _Exit() _WinAPI_DeleteObject($hFont) ; this is needed Exit EndFunc ;==>_Exit1 point -
How can I add a function without it being part of GUICreate?
TalesFromTheScript reacted to Musashi for a topic
Apology accepted as well1 point -
WebDriver UDF - Help & Support (II)
ThomasBennett reacted to Danp2 for a topic
@NSearch Thanks for the offer, but I would suggest donating to this site instead.1 point -
How can I add a function without it being part of GUICreate?
TalesFromTheScript reacted to Melba23 for a topic
TalesFromTheScript, Apology accepted on behalf of those who responded to that thread. Patience is a great asset if you want to learn coding - keep on working at it! There is a "Donate" on the Home page at top right - evrey little helps pay the server costs. M231 point -
How can I add a function without it being part of GUICreate?
Musashi reacted to TalesFromTheScript for a topic
Sorry Melba23 I can't even work that out, it doesn't help that I have been awake for 20 minutes lol Yes it is all working now, I opened 3 instances of the GUI and it always saves properly, wherever the last one was closed GUICreate("MyGUI", 600, 400, $nIniXPos, $nIniYPos, Default, $WS_EX_TOPMOST) Sorry I was being an asshat yesterday but I just don't have any patience. I'm working on it. Melba23 let me know if there's a place I can donate $10 or something, either to you or the forum. It's not much but you have helped a great deal.1 point -
How can I add a function without it being part of GUICreate?
TalesFromTheScript reacted to Melba23 for a topic
TalesFromTheScript, Glad I could help. Now to the new question: It looks as if those coordinates are stored in an ini file - is that so that the GUI opens in the same position each time? And you want to store the position if the GUI is moved during run-time? If so, then you know how to read the values using IniRead - you then need to put those values into the correct parameters of the GUICreate call (left & top). If you want to check for any changes in position during run-time then a simple way is to use IniWrite to save the current position as the script exits. You would need to do something like this: Local $aWPos = WinGetPos($hWnd) If IsArray($aWPos) Then IniWrite($sMyIniLocation, 'MAINWINPOS', 'XPOS', $aWPos[0]) IniWrite($sMyIniLocation, 'MAINWINPOS', 'YPOS', $aWPos[1]) EndIf Now you will have stored the correct values in the ini file to be read the next time the app is run. All clear? M231 point -
How can I add a function without it being part of GUICreate?
TalesFromTheScript reacted to Melba23 for a topic
TalesFromTheScript, Your question has already been answered in the thread that was locked when you refused to believe the responses you received there. I will make one final attempt to get through to you. $WS_EX_TOPMOST is a "style" not a "function" - so I suggest you start by reading the Setting Styles tutorial in the Wiki so that you actually understand what you are dealing with. Next, in your attempts to use GUICreate in the other thread you were not correctly setting the parameters: GUICreate("My GUI", 600, 400, -1, -1, Default, $nIniXPos, $nIniYPos) Let us look at the Help file page for GUICreate: GUICreate ( "title" [, width [, height [, left = -1 [, top = -1 [, style = -1 [, exStyle = -1 [, parent = 0]]]]]]] ) Starting from the left we get: Parameter Correct Your version Comment The basics: Title string string Good Width value value Good Height value value Good x pos value default (-1) Good y pos value default (-1) Good Now we come to the tricky bits: style various style default Good values exstyle various exstyle Xpos value? Why? values parent handle of Ypos value? Why? parent GUI So as you can (I hope) see you were placing coordinate values retrieved from your Ini file into the parameter spaces reserved for extended style and parent GUI handle values. Little wonder that it did not work! What you need to do to add the $WS_EX_TOPMOST style to your GUI is to add the style to the default values - something like this: GUICreate("My GUI", 600, 400, -1, -1, Default, BitOR($WS_EX_WINDOWEDGE, $WS_EX_TOPMOST)) Now you will have the $WS_EX_TOPMOST style applied to your GUI. The tutorial I linked to earlier explains why you need to use BitOR - you did read it? Does that make the whole thing any clearer? M231 point -
Old version of DDE usage... $sURL = _OpenGetURL('Firefox') ConsoleWrite($sURL & @CRLF) Func _OpenGetURL($sServer, $sURL = "", $iWin = -1, $iRetType = 0, $iWait = 10000) Local $aRet, $uIdInst = DllStructCreate("int") Local $hServer[1], $hTopic[1], $hItem[1], $hConv[1], $hData[1], $sData[1] Local $sTopic = "WWW_OpenURL", $sItem = '"' & $sURL & '",,0x' & Hex($iWin) If $sURL = '' Then $sTopic = "WWW_GetWindowInfo" $sItem = "0x" & Hex($iWin) EndIf Local $hDll = DllOpen("user32.dll") If $hDll = -1 Then Return SetError(1, 0, "") ; Error to open Dll $aRet = DllCall($hDll, "int", "DdeInitialize", "ptr", DllStructGetPtr($uIdInst), "ptr", 0, "int", 0, "int", 0) If $aRet[0] Then Return SetError(2, $aRet[0], "") ; Error Initializing DDE $hServer = DllCall($hDll, "int", "DdeCreateStringHandle", "int", DllStructGetData($uIdInst, 1), "str", $sServer, "int", 1004) If $hServer[0] Then $hTopic = DllCall($hDll, "int", "DdeCreateStringHandle", "int", DllStructGetData($uIdInst, 1), "str", $sTopic, "int", 1004) If $hTopic[0] Then $hItem = DllCall($hDll, "int", "DdeCreateStringHandle", "int", DllStructGetData($uIdInst, 1), "str", $sItem, "int", 1004) If $hItem[0] Then $hConv = DllCall($hDll, "int", "DdeConnect", "int", DllStructGetData($uIdInst, 1), "int", $hServer[0], "int", $hTopic[0], "int", 0) If $hConv[0] Then $hData = DllCall($hDll, "int", "DdeClientTransaction", "ptr", 0, "int", 0, "int", $hConv[0], "int", $hItem[0], "int", 1, "int", 0x20B0, "int", $iWait, "ptr", 0) If $hData[0] Then $sData = DllCall($hDll, "str", "DdeAccessData", "int", $hData[0], "ptr", 0) EndIf EndIf EndIf EndIf $iErr = DllCall($hDll, "int", "DdeGetLastError", "int", DllStructGetData($uIdInst, 1)) If $hData[0] Then DllCall($hDll, "int", "DdeFreeDataHandle", "int", $hData[0]) If $hConv[0] Then DllCall($hDll, "int", "DdeFreeDataHandle", "int", $hConv[0]) If $hItem[0] Then DllCall($hDll, "int", "DdeFreeDataHandle", "int", $hItem[0]) If $hTopic[0] Then DllCall($hDll, "int", "DdeFreeDataHandle", "int", $hTopic[0]) If $hServer[0] Then DllCall($hDll, "int", "DdeFreeDataHandle", "int", $hServer[0]) If $iErr[0] Then Return SetError(3, $iErr[0], "") ; Other DDE Errors DllCall($hDll, "int", "DdeUninitialize", "int", DllStructGetData($uIdInst, 1)) DllClose($hDll) If StringRight($sData[0], 3) = ',""' Then $sData[0] = StringTrimRight($sData[0], 3) If $sURL = '' Then $sURL = StringRegExpReplace($sData[0], '^"([^"]*?)".*', '"\1"') If $iRetType = 1 Then Local $sRetTitle = StringReplace(StringTrimLeft($sData[0], StringLen($sURL) + 1), '\"', '"') Local $aRetArr[3] = [$sRetTitle, $sURL, StringReplace($sData[0], '\"', '"') ] Return $aRetArr EndIf Return $sURL EndFunc1 point
-
This assumption, as @Danp2 has already tried to explain to you with great patience, is nonetheless wrong. You pass the value $nIniXPos to parameter7=exStyle, and the value $nIniYPos to parameter8=parent. This may fulfill the syntactical requirements of the function, but definitely not the functional ones.1 point
-
@TalesFromTheScript No, it doesn't. The code you just posted reads from and updates the INI file. You don't need (or want) those two additional parameters on your GuiCreate because it could cause unexpected behavior.1 point
-
[Solved] Excel RangeRead Help with sheet name selection
AnonymousX reacted to water for a topic
It depends. On the size of the worksheet and the number of cells you need to process. Most of the time reading the full worksheet and then processing the returned array is faster.1 point -
The picture shows Rubik's Cube in the middle of a rotation, wherein the layer is rotated 90 degrees. New version for AutoIt 3.3.10 The scripts were flawed. Fixed in this update. 08-01-2013: First post In the Cubes menu there are six cubes from 2*2*2 to 7*7*7: Pocket Cube, Rubik's Cube, Rubik's Revenge, Professor's Cube, V-Cube 6 and V-Cube 7. See http://en.wikipedia.org/wiki/Rubik's_Cube. The Scramble menu scrambles the cube. In the input field in the statusbar you can set the number of scramble steps. The Solve menu automatically solves the cube. In this version it just plays back the undo log. The Build menu shows how the cubes are created. It also shows how the rotation of a layer is simulated. The Scramble, Solve and Build menus puts the program into a Scramble, Solve and Build mode. To leave the Scramble and Solve modes click the menu once more. To leave the Build mode uncheck the menu. The program mode or state appears in the statusbar. See the Help menu for more information about the menus. Rotating a layer in the cube Click an edge of the layer with the left mouse button and hold the button downMove the mouse in the direction you want to rotate the layerRelease the left mouse buttonThe rotating layer in the picture has probably been clicked somewhere on the blue edge. You can't rotate a layer in Scramble, Solve and Build modes. The mouse buttons can be switched in the Options. Rotating the entire cube Click in the window with the right mouse button and hold the button downMove the mouse in the direction you want the cube to rotateRelease the right mouse buttonThe description of the mouse rotations can be found in the Help menu. Using the keyboard Use the arrow keys or <A,a>, <W,w>, <S,s>, <Z,z> to rotate the cube. Use <Home> or <H,h> to place the cube in the start position. Use <Page Up> or <I,i> and <Page Down> or <O,o> to zoom in and out. Use Num 1-6 or 1-6 to show the 6 sides of the cube. The program Inspiration for the program is from this site: http://rubiksim.sourceforge.net/. The graphics is generated with old style OpenGL 1.1. Some OpenGL globals and functions are copied from this thread http://www.autoitscript.com/forum/index.php?showtopic=83581 by trancexx. Especially globals and functions for creating an OpenGL window and a rendering context. Zipfile The zipfile contains a number of files: RubiksCube.au3 - GUI and main loop, run this fileMenuFncs.au3 - implements the menu systemMenuWins.au3 - creates menu system windowsKeyboard.au3 - code for shortcut keysOGLconsts.au3 - OpenGL constantsOGLfuncs.au3 - OpenGL functionsCubes.au3 - creates the cubesTurnLayer.au3 - rotate a layerRotateCube.au3 - rotate the cubeScramble.au3 - scramble functionSolveCube.au3 - solve functionsBuild.au3 - build functionsUtilities.au3 - calculations(The files are edited with Notepad++ with a tabwidth of 2. This doesn't match the default settings in Scite.) 21-01-2013: Update #1 Fixed some errors in the Build menu. Added a log to see the colors of all sides at one time. See picture in post #5. RubiksCube3.3.10.7z Testet on XP 32 bit and Win 7 32/64 bit. Previous versions for AutoIt 3.3.81 point