Jump to content

water

MVPs
  • Posts

    26,705
  • Joined

  • Last visited

  • Days Won

    204

water last won the day on March 1

water had the most liked content!

About water

Recent Profile Visitors

12,515 profile views

water's Achievements

  1. You could grab the event sent by Excel before a workbook gets closed. Something like this: #include <Excel.au3> HotKeySet("+!e", "_Exit") ;Shift-Alt-E to Exit the script MsgBox(64, "Excel UDF: Events Example", "Hotkey to exit the script: 'Shift-Alt-E'!") ; Create application object and open a workbook Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookNew($oExcel) ObjEvent($oWorkbook, "Workbook_") While 1 Sleep(10) WEnd Exit Func Workbook_BeforeClose() MsgBox(0, "WorkbookBeforeClose", "Name: " & $oWorkbook.Name) _Excel_Close($oExcel) _Exit() EndFunc ;==>Workbook_BeforeClose Func _Exit() Exit EndFunc ;==>_Exit This example works for the workbook opened by this script. If the user opens and closes another workbook nothing will happen.
  2. That is because your script still holds a reference to the Excel application until you call _Excel_Close.
  3. I use the following approach: use the windows calculator to translate -2147023170 (decimal) to 800706BE (hex) use Google to search for "hresult 0x800706BE Excel" Result is something like this: https://www.google.de/search?q=hresult+0x800706BE+Excel
  4. Which version of Autoit do you run? WinAPISys.au3, WinAPIProc.au3 and WinAPIHObj.au3 exist in folder C:\Program Files (x86)\AutoIt3\Include of version 3.3.16.1 I'm running
  5. Your modified version works like a champ! No re-download of the AutoItObject UDF was necessary. Thanks!
  6. I use InireadSection and IniwriteSection to handle Ini-Files. Each section holds all keys/values belonging to the same "class". It only takes a single command to read all keys/values to a 2D array. Works perfectly here
  7. I just downloaded your script and AutoItObject 1.2.8.2. I'm running Autoit 3.3.16.1 on Windows 11. When running your script I get the following error: Did I miss something?
  8. Have a look at the source of the Word UDF, function _Word_DocFindReplace to see how it works
  9. Toolstips can work this way. Hover over the header of the Tab control. #include <AutoItConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Launch Spice", 485, 220, 201, 136) $Tab1 = GUICtrlCreateTab(16, 16, 457, 140, BitOR($TCS_FOCUSONBUTTONDOWN, $TCS_TOOLTIPS)) GUICtrlCreateTabItem("Single") ; TOOLTIP for TAB 0 GUICtrlSetStyle(-1, $TCS_TOOLTIPS) GUICtrlSetTip(-1, " Tip for Tab 'Single'", "Testtitel", $TIP_INFOICON, $TIP_CENTER) $Label1 = GUICtrlCreateLabel("Single VM", 181, 40, 194, 33) GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif") $Input1 = GUICtrlCreateInput("", 96, 95, 297, 28, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NOHIDESEL)) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateTabItem("Multi") $Label2 = GUICtrlCreateLabel("Multiple VMs", 170, 40, 194, 33) GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif") $Input2 = GUICtrlCreateInput("", 96, 95, 297, 28, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NOHIDESEL)) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateTabItem("Lookup") $Label3 = GUICtrlCreateLabel("Lookup VM", 170, 40, 194, 33) GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif") $Input3 = GUICtrlCreateInput("", 96, 95, 297, 28, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NOHIDESEL)) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateTabItem("") $Button1 = GUICtrlCreateButton("Deploy", 186, 165, 113, 41) ; GUICtrlSetState ( -1, $GUI_DISABLE ) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetCursor(-1, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0, "Test", "Tab " & GUICtrlRead($Tab1) & " selected.") EndSwitch WEnd
  10. Yes there is GUICtrlRead($Tab1) returns the index of the selected tabitem (0-based). Example: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Launch Spice", 485, 220, 201, 136) $Tab1 = GUICtrlCreateTab(16, 16, 457, 140, BitOR($TCS_FOCUSONBUTTONDOWN,$TCS_TOOLTIPS)) GUICtrlCreateTabItem("Single") $Label1 = GUICtrlCreateLabel("Single VM", 181, 40, 194, 33) GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif") $Input1 = GUICtrlCreateInput("", 96, 95, 297, 28, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NOHIDESEL)) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateTabItem("Multi") $Label2 = GUICtrlCreateLabel("Multiple VMs", 170, 40, 194, 33) GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif") $Input2 = GUICtrlCreateInput("", 96, 95, 297, 28, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NOHIDESEL)) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateTabItem("Lookup") $Label3 = GUICtrlCreateLabel("Lookup VM", 170, 40, 194, 33) GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif") $Input3 = GUICtrlCreateInput("", 96, 95, 297, 28, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NOHIDESEL)) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateTabItem("") $Button1 = GUICtrlCreateButton("Deploy", 186, 165, 113, 41) ; GUICtrlSetState ( -1, $GUI_DISABLE ) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetCursor (-1, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0, "Test", "Tab " & Guictrlread($Tab1) & " selected.") EndSwitch WEnd
  11. Gladyou like the UDF The thanks for this function go to the author of the original code: mLipok. I just stripped it down to it's current size
  12. I would start with collecting information about the document and adding error checking. Something like: Consolewrite("Number of Stories:" & $oDoc.StoryRanges & @CRLF) For $oStoryRange In $oDoc.StoryRanges Consolewrite(@CRLF & "Type of Story:" & $oStoryRange.StoryType & @CRLF) ; For $Loop = 1 to 1 ; Not needed at the moment _Word_DocFindReplace($oDoc, "FIRSTNAME", $FirstName, Default, $oStoryRange) Consolewrite("@error of Replace1: " & @error & @CRLF) _Word_DocFindReplace($oDoc, "SECONDNAME", $Surname, Default, $oStoryRange) Consolewrite("@error of Replace2: " & @error & @CRLF) _Word_DocFindReplace($oDoc, "BUILDINGNAME", $Building, Default, $oStoryRange) Consolewrite("@error of Replace3: " & @error & @CRLF) _Word_DocFindReplace($oDoc, "000000000", $ID, Default, $oStoryRange) Consolewrite("@error of Replace4: " & @error & @CRLF) ; Next Next The wdstorytype enumeration can be found here: https://learn.microsoft.com/en-us/office/vba/api/word.wdstorytype
  13. I would simply use the constant $SBARS_SIZEGRIP.
  14. I'm not sure this is what you are asking for. But I'll give it a try. I use the following function (written by Melba23) to remove style settings from controls: ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name ..........: __Remove_Style ; Description ...: Remove a style from a single or multiple GUI controls. ; Syntax ........: __Remove_Style($iStyleToRemove, $id1[, $id2 = 0[, $id3 = 0[, $id4 = 0[, $id5 = 0[, $id6 = 0[, $id7 = 0[, $id8 = 0[, $id9 = 0[, $id10 = 0]]]]]]]]]) ; Parameters ....: $iStyleToRemove - integer value of the style to remove. ; $id1 - ControlID to remove the style from. ; $id2 to $id10 - [optional] additional ControlIDs to remove the style from. ; Return values .: Success - 0 ; Failure - None ; Author ........: Melba23 ; Modified ......: ; Remarks .......: Code taken from: https://www.autoitscript.com/forum/topic/209900-ignore-control-in-taborder/?tab=comments#comment-1515251 ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func __Remove_Style($iStyleToRemove, $id1, $id2 = 0, $id3 = 0, $id4 = 0, $id5 = 0, $id6 = 0, $id7 = 0, $id8 = 0, $id9 = 0, $id10 = 0) #forceref $id1, $id2, $id3, $id4, $id5, $id6, $id7, $id8, $id9, $id10 Local $hControl, $iStyle For $i = 1 To @NumParams - 1 ; @NumParams must be between 2 and 11. The 1st parameter will always be the style to remove. $hControl = GUICtrlGetHandle(Eval("id" & $i)) $iStyle = _WinAPI_GetWindowLong($hControl, $GWL_STYLE) If BitAND($iStyle, $iStyleToRemove) = $iStyleToRemove Then _ _WinAPI_SetWindowLong($hControl, $GWL_STYLE, BitXOR($iStyle, $iStyleToRemove)) Next EndFunc ;==>__Remove_Style
×
×
  • Create New...