Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/05/2023 in all areas

  1. You can use Run() or _RunDOS() functions to run the commands directly or even better use Registry functions to add/delete registries (RegWrite, RegDelete) since this is what your cmd file does. Check out these functions in help file.
    1 point
  2. Without #RequireAdmin it won't return all tasks. Basically it won't return tasks that have checked the option "Run with the highest privileges". I highly doubt about that. It would be a total non-sense for windows to let you access Tasks directory from System32 or TaskCache from registry without admin privileges.
    1 point
  3. I initially tried the return values from _GUICtrlButton_GetState, mainly $BST_PUSHED. This returns 4 but it did not fire the If statements. I then wrote the value of _GUICtrlButton_GetState to the console and when the button was pushed, the value was 620. I tried using that and it triggered everytime. I'm unsure why it returns that number, could be a few states added together like visible, focused etc. None of the values stated in the help file add up to that.
    1 point
  4. in SimpleCaptureTool that you have to turn it into a ;comment or delete it ;~ While 1 ;~ Sleep(10000) ;10 sec ;~ WEnd
    1 point
  5. #RequireAdmin #include <Array.au3> $aLogonTasks = GetLogonTasks() _ArrayDisplay($aLogonTasks) Func GetLogonTasks($sFolder = '\') Local $sResult Local $oScheduleService = ObjCreate('Schedule.Service') $oScheduleService.Connect() $oRoot = $oScheduleService.GetFolder($sFolder) $oCollection = $oRoot.GetTasks(0) For $oTask In $oCollection If StringInStr($oTask.XML, 'LogonTrigger') Then $sResult &= $oTask.Name & Chr(1) Next Return StringSplit(StringTrimRight($sResult, 1), Chr(1)) EndFunc Or something like this.
    1 point
  6. Here's something to consider, all of your includes should be at the top of your script, before you call any functions. Also, the order of your includes could matter. I don't think that the example you gave is something that you've tested, because that does work no problem for everyone here (myself included). How sure are you that the "missing" function is in fact included in your file? As long as it's there, there shouldn't be a reason why it would fail and not be able to find the file. Here's another topic on include file organization: Keep in mind also that even if you include everything into a script, that only means everything will (or should) work from that main script. You still need to make sure that none of your includes have references to things that exist outside of their own files. Otherwise when you include just a single file or two instead of the whole set of them, you can get undefined functions. I would recommend running the "SyntaxCheck Prod" tool in SciTE (Ctrl + F5) on each of your include files to make sure there's nothing missing in the includes itself.
    1 point
  7. Maybe this ? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListBox.au3> ; ListBox OwnerDrawn Colors Global Const $tagDRAWITEMSTRUCT = "uint CtlType;uint CtlID;uint itemID;uint itemAction;uint itemState;hwnd hwndItem;handle hDC;dword rcItem[4];ptr itemData" Global Const $ODA_DRAWENTIRE = 1 Global Const $ROW_HEIGHT = 24, $MARGIN = 4 Example() Func Example() GUICreate("Ownerdrawn Listbox", 300, 300) Local $idListBox = GUICtrlCreateList("", 4, 4, 292, 292, $WS_VSCROLL + $LBS_OWNERDRAWFIXED) _GUICtrlListBox_SetItemHeight($idListBox, $ROW_HEIGHT) For $i = 0 To 19 _GUICtrlListBox_AddString($idListBox, "") Next GUIRegisterMsg($WM_DRAWITEM, WM_DRAWITEM) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example Func WM_DRAWITEM($hWnd, $iMsg, $wParam, $lParam) Local $tDRAWITEMSTRUCT = DllStructCreate($tagDRAWITEMSTRUCT, $lParam) Switch $tDRAWITEMSTRUCT.itemAction Case $ODA_DRAWENTIRE Local $tRECT = DllStructCreate($tagRECT, DllStructGetPtr($tDRAWITEMSTRUCT, "rcItem")) Local $hBrush = _WinAPI_CreateSolidBrush(Mod($tDRAWITEMSTRUCT.itemID, 2) ? 0xFFFFFF : 0xE0E0E0) _WinAPI_FillRect($tDRAWITEMSTRUCT.hDC, $tRECT, $hBrush) Local $sItemText = "Line " & $tDRAWITEMSTRUCT.itemID $tRECT.Left += $MARGIN $tRECT.Top += $MARGIN _WinAPI_DrawText($tDRAWITEMSTRUCT.hDC, $sItemText, $tRECT, $DT_LEFT) _WinAPI_DeleteObject($hBrush) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_DRAWITEM
    1 point
  8. I'm going to use these menus. I've updated the UDF, ModernMenuRaw.au3. Of the posts it appears that Holger updated the code on a regular basis until May 2008. ProgAndy made some updates in August 2008. These updates were about the background color of the menubar, the ability to use icon handles, and better cleanup code on exit. The updates I've made are based on the UDF by ProgAndy attached to post 213. It's my intention to update the UDF to make it run under the current versions of AutoIt, and to get rid of errors. Especially already known errors, which can be fixed in a few lines of code. It's not my intention to add a lot of new code to the UDF. Updates 2014-10-18 This update is based on original code by Holger (first post) and updates by ProgAndy (posts 211 - 213). The update supports AutoIt 3.3.10 and later. Code relating to Windows versions not supported by 3.3.10 is deleted. WindowsConstants.au3 is included and double-defined global constants are commented out. Added an update to be able to use colored controls e.g. buttons with this UDF. Post 222. Update (one line) for x64 support. Post 266 by Holger. Added x64 support to functions by ProgAndy. Declared a few local variables. Updates 2014-10-19 Updates to pass Au3Check. (-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6) Updates 2015-01-24 Updates for tray menus suggested by nickston (posts 298, 299, 312) Most important is an update that makes it possible to use a flashing tray menu icon. There are also a few code optimizations. Updates 2021-11-12 Disabled $IDI_ global constants in ModernMenuRaw.au3. $IDI_ constants are included in AutoItConstants.au3. None of the updates above are script breaking. If you are using tray menus and want to compile your script, you should pay attention to posts 268 - 270. Note also that _TrayIconCreate creates a GUI to receive messages from tray icons. After calling this function you should probably use GUISwitch($hGui) or something. Post 227. In the top of ModernMenuRaw.au3 I've included commands.txt from the original zip by Holger. Two commands of ProgAndy to handle the background color of the menubar are added. I've also added an alphabetical list of functions, and a list of Windows messages (used with GUIRegisterMsg). Examples In order to make it easy the examples are included in the zip. The original examples by Holger are included with no changes at all. The 32 examples by AZJIO in the post above are also included with no changes. There are two versions of the examples: an english and a russian. The examples demonstrates the commands one by one and are named with the name of the command. Copied an example by AZJIO and renamed it to _TrayIconSetState-flashing.au3. Added one line of code to make the tray menu icon flash. Only an english version. A new example by nickston that demonstrates a flashing tray menu icon. The example shows how to turn flashing on and off. Two new examples _GUICtrlCreateODTopMenu.au3 and _GUIMenuBarSetBkColor.au3 that demonstrates the commands by ProgAndy to set the background color of the menubar. _GUIMenuBarSetBkColor.au3 is not working on Windows 7. A new example that shows how to use a bitmap from an image list as an icon in a menu item. The example shows also how to use icon handles. 7z-file ModernMenuRaw.au3 - update on 12.11.2021 ModernMenuRaw.au3 - all previous versions ExamplesAZJIO - 32 examples by AZJIO in english and russian versions ExamplesHolger - the original examples by Holger Examplesnickston - flashing tray menu icon ExampleszNew - three new examples Tested with AutoIt 3.3.10 on Windows 7 32/64 bit and Windows XP 32 bit. 2014-10-19: ModernMenuRaw.7z 2015-01-24: ModernMenuRaw.7z Tested with AutoIt 3.3.14.2/5 and beta 3.3.15.4 on Windows 7/10 32/64 bit. ModernMenuRaw.7z
    1 point
×
×
  • Create New...