Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/27/2020 in all areas

  1. Hi outthere here is my script-stuff to create ownerdrawn menuitems with icons and colors. It uses GUIRegisterMsg() and WM_DRAWITEM / WM_MEASUREITEM - messages proceeding. Holger Update 06.05.2008: !!! Warning: Script breaking !!! Please change the following commands to: _TrayCreateItem(Text, ...) _TrayCreateMenu(Text , ...) - Fixed: some old values (thanks to aGorilla) - Fixed: ..SetText() functions (thanks to MrCreatoR) - Added the following commands: _SetMenuIconBkGrdColor(Color) ; set icon background gradient color _SetTrayIconBkGrdColor(Color) ; set icon background gradient color New sidebar menu commands: _CreateSideMenu(MenuID) ; returns a SideMenuID/index _DeleteSideMenu(SideMenuID) ; delete a menu sidebar _SetSideMenuText(SideMenuID, Text) ; set a text for the sidebar _SetSideMenuColor(SideMenuID, Color) ; set text color _SetSideMenuBkColor(SideMenuID, Color) ; set text background color _SetSideMenuBkGradColor(SideMenuID, Color) ; set text background gradient color _SetSideMenuImage(SideMenuID, Bitmapfile [, Resourcename/number [, Expand/Compress Bitmap]]) Just take a look into the samples how to use them! At the moment there are some known issues: - missing 64bit compatibility (already in progress, to fully work with "AutoIt3_x64.exe") - moving the mouse cursor on the sidebar menu image/text also changes the current menu item selection - for sidebar menu image only bitmaps are supported at the moment (min.8bpp) Update 23.03.2008: !!! Warning: Please update all your scripts and add after _TrayIconCreate() the command _TrayIconSetState() - otherwise you will not see any tray icons!!! Also update your icon numbers like for GUI icons - Fixed: some things (thanks to nickston) - Changed: _TrayIconCreate() do not show automatically the icon - Changed: icon behaviour now more similar to GUI icons (I hope) - Added: command.txt - Removed: unicode macro History: CODEUpdate 21.03.2008: - Changed: dynamic array sizing of the saved menu items - Added: _TrayDeleteItem(menuID), _GUICtrlODMenuItemDelete($nID) - please delete menu (items) with these commands - Added: _TrayIconSetState() modes 4 and 8 for flashing and flashstopping of tray icons - Added: _SetFlashTimeOut([timeOut]) to set the flash timeout - Added: OnEvent sample Update 23.02.2008: - Fixed: GDI object overload while using bold font Update 22.02.2008: - Added: _TrayItemSetSelIcon(ItemID, IconFile, IconID) - set the icon if the item is selected - Added: _GUICtrlODMenuItemSetIcon(ItemID, IconFile, IconID) - set the icon of the item - Added: _GUICtrlODMenuItemSetSelIcon(ItemID, IconFile, IconID) - set the icon if the item is selected - Added: "ModernMenuRaw.au3" which only includes the unknown constants, should better work with 'Au3Check' now Update 12.01.2008-2: - Fixed: Missing underscore in "CreateMenuFontByName"-function (Font fallback function) (thanks to MsCreatoR and GEOSoft). - Changed: If a menuitem is disabled then the rect only is showing around the item - Added: Underscore in menutext only showing when pressing "Alt"-key Update 12.01.2008: - Changed: 'local' Dll calls to global DllOpen to speedup (some virusscanners sometimes slowdown the process cause of opening these Dll's again and again) - Added: Using of @Tab for accelerator showing/drawing Update 07.12.2007: - Changed: all stuff in only 1 ZIP file - Fixed: now works with 3.2.10.0 and 3.2.8.1 Update 03.08.2007 - Fixed: error in _TrayIconDelete() and new creation - Added: additional parameter to _TrayIconCreate(ToolTip, IconFile, IconID, Callback, Msg, hIcon) to use existing icon handles - Added: sample_Win2Tray: 'moves' all minimized windows to the tray Update 28.07.2007 - Fixed: wrong call of function CreateFont() - Thanks to SleepyExtreme for info - Changed: included samples to demonstrate using of icon clicks Update 26.07.2007 - Fixed: missing function: LoadIcon() Update 21.07.2007 - added bold item support - limited to menuitems only, menus are not supported Update 17.07.2007: - now you can also menu icons for the tray - added commands for Tray: _TrayIconCreate() _TrayCreateMenu() _TrayCreateItem() _TrayItemSetIcon() _TrayIconSetState() _TrayTip() So you can have more than 1 tray icon for 1 Autoit3-script. Update 01.07.2007: - now works with unicode (3.2.4.9) - new command: _GUICtrlODMenuItemSetText(ControlID, NewText) Update 21.08.2006: - delete 1 line in libs to work with current release 3.2.0.X (error: cannot redeclare constant...) - Thanks to Javascript_Freek for info Update 02.02.2006: - added Checked-state for normal menu items and radio menu items - added a like ModernMenuLib-script for easier create/use these menustuff (see sample in the ModernMenuLib-folder) ModernMenuLib_with_Tray.zip
    1 point
  2. This is an small script to Control Android Devices by USB using adb, you can use it with phones with a Cracked Screen or not working Touch Screen. What it Does: - Show your Android Screen on your Desktop. - Allow you to Swipe or Tap on the screen. - Allow you to send BACK button event. - Allow you to send WakeUp event. - Allow you to move in List Menu using Swipe gestures or Mouse Wheel Forward or Backward. - Refresh Screen with Wheel Click(Wheel Down)(To update your device screen on your desktop view). - Allow you to unlock your Device with Pattern only 3 points pattern for now. What it does not: - Complex Unlock Pattern not supported yet I'm working on that. - Complex Swipe gesture not supported yet, only straight lines. - PC Keyboard to write SMS or Email not Supported yet, I'm working on that. - Volume UP or Down not supported yet I will add it soon. - No configuration interface or file yet, keys and actions are pre set on script code. I will change that. What it Requires: - In order to Compile the Script you need 3 files: adb.exe, AdbWinApi.dll, AdbWinUsbApi.dll - In order to use the script without these files or without compile it you need to copy that files to user Temp Dir, or windows Temp dir I mean @TempDir. Keys Used and Notes: - Left Click will tap on the screen. - Keep Left Click down, move the mouse and release it with perform a Swipe operation.(Mouse Drag = Swipe). - Right Click will go back. - Enter on the keyboard will send WakeUp event(Power Button) - Wheel Down will Refresh the screen on your desktop, also F5.(Take last pictures of your android device screen) IMPORTANT: There is an $scale variable on the script that scale down your Phone screenshot image to a good resolution to show on your Desktop, I use 1.5 of scale factor because my phone resolution is 480x800 and my Desktop Screen is 1366x768 and that scale factor is good enough for me.(I will calculate that in the future to make it automatic). IMPORTANT 2: If you feel is very slow feel free to decrease Sleep() values from 400 to 200, that will be faster but you will need to Refresh with Wheel Click after you perform certain actions. Thanks and Credits: UDFs\MouseControl.au3 Base on Low Level Mouse Hook by @_Kurt all credits to him. UDFs\GUICtrlPicPNG.au3 Based on PNG work around by @UEZ from the help file, All credits to him. Kind Regards Alien. AndroidControl.zip
    1 point
  3. @hemal If you want to investigate the errors from the Chrome log, then I would recommend checking Google for similar errors. As far as logging goes, you probably can't output to the same file due to locking issues, so using a separate file is recommended. FYI, the most recent UDF release allows you to log to a file instead of the Scite console.
    1 point
  4. Recursion is the key of simplicity. #include <array.au3> #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> Local $aTV1[14][3] = [ _ ['1', 'Text 1', -1], _ ;-1 idicates it's an index item ['2', 'Text 2',-1], _ ['3', 'Text 3',-1], _ ['1-1', 'Text 1-1',0], _ ['1-2', 'Text 1-2',0], _ ['2-1', 'Text 2-1',0], _ ['2-2', 'Text 2-2',0], _ ['2-1-1', 'Text 2-1-1',0], _ ['2-1-2', 'Text 2-1-2',0], _ ['2-1-2-1', 'Text 2-1-2-1',0], _ ['2-1-2-1-1', 'Text 2-1-2-1-1',0], _ ['3-1', 'Text 3-1',0], _ ['3-1-1', 'Text 3-1-1',0], _ ['3-1-1-1', 'Text 3-1-1-1',0]] Local $Gui = GUICreate('TreeView Example', 500, 600) Local $tv = GUICtrlCreateTreeView(10, 30, 450, 550) _ArraySort($aTV1, 0, 0, 0, 0) ;------------------------- sort Ascending on column 0 ;_ArrayDisplay($aTV1) Local $idxroot = _GUICtrlTreeView_Add($tv, 0, "index") GUISetState() Global $iIdx = 0 Recurse($tv, $aTV1, $idxroot, "") _GUICtrlTreeView_Expand($tv) While 1 Switch GUIGetMsg() Case $gui_event_close Exit EndSwitch WEnd Func Recurse (ByRef $hTV, ByRef $array, $hParent, $sTxt) While $iIdx < UBound($array) And $sTxt = StringTrimRight($array[$iIdx][0],2) $hNew = _GUICtrlTreeView_AddChild($hTV, $hParent, $array[$iIdx][1]) $iIdx += 1 Recurse ($htv, $array, $hNew, $array[$iIdx-1][0]) WEnd EndFunc
    1 point
  5. There are multiple ways to skin the same cat. Local $s = "8cdb3" ; any non-empty Unicode string Local $a = StringToASCIIArray($s) Local $sOut = _ArrayToString($a, " ") $sOut = StringRegExpReplace($sOut, "(?<=^| )(\d\d)\b", "0$1") ConsoleWrite($sOut & @LF) Anyway, beware that Unicode characters > 0x3E7 will expand to 4 to 5 decimal digits. AscW('€') yields 8364 and AscW('fi') gives 64257.
    1 point
  6. or this one liner : $sTxt = "8cdb3" $sText = Execute(StringTrimRight(StringRegExpReplace($sTxt, "(.)", "stringFormat('%03i',asc('$1'))&' '&"),5)) MsgBox ($MB_SYSTEMMODAL,"",$sText)
    1 point
  7. aa2zz6 you're welcome, thanks for your "iconed buttons" in the script, very nice ! The following script gives the same result as the precedent one, though it doesn't register any message (because of the style you choosed for you child GUI's). It's a simpler approach which uses $WS_EX_MDICHILD as extended style for both child GUI's #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysInternals.au3> Global $hGUI_Child_Workforce, $hGUI_Child_Dashboard, $hGUI_Main = GUICreate("", 250, 300) $btnWorkforce = IconButton("Workforce", 15, 25, 140, 40, 30, @ScriptDir & "\workforce.ico") $btnDashboard = IconButton("Dashboard", 15, 80, 140, 40, 30, @ScriptDir & "\operations-dashboard.ico") _Create_Child($hGUI_Main) GUISetState(@SW_SHOW, $hGUI_Main) ;~ GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $btnWorkforce GUISetState(@SW_HIDE, $hGUI_Child_Dashboard) GUISetState(@SW_SHOW, $hGUI_Child_Workforce) Case $btnDashboard GUISetState(@SW_HIDE, $hGUI_Child_Workforce) GUISetState(@SW_SHOW, $hGUI_Child_Dashboard) EndSwitch WEnd ;====================================== Func IconButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $BIconSize, $BIDLL, $BIconNum = -1) GUICtrlCreateIcon($BIDLL, $BIconNum, $BIleft + 5, $BItop + (($BIheight - $BIconSize) / 2), $BIconSize, $BIconSize) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetState(-1, $GUI_DISABLE) $XS_btnx = GUICtrlCreateButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $WS_CLIPSIBLINGS) Return $XS_btnx EndFunc ;==>IconButton ;====================================== Func _Create_Child($hGUI_Main) Local $aGUI_Main_Pos = WinGetPos($hGUI_Main), $lnCount = 600 $hGUI_Child_Workforce = GUICreate("Follower 1", 800, $lnCount, -1, -1, _ BitOR($WS_POPUP, $WS_BORDER), $WS_EX_MDICHILD, $hGUI_Main) GUISetBkColor(0xCCFFCC) GUISetFont(11, 400, Default, "Arial") Local $text = GUICtrlCreateLabel("Workforce", 10, 10, 380, ($lnCount * 20) - 20) WinMove($hGUI_Child_Workforce, "", $aGUI_Main_Pos[0] + $aGUI_Main_Pos[2], $aGUI_Main_Pos[1]) $hGUI_Child_Dashboard = GUICreate("Follower 2", 800, $lnCount, -1, -1, _ BitOR($WS_POPUP, $WS_BORDER), $WS_EX_MDICHILD, $hGUI_Main) GUISetBkColor(0xCCFFCC) GUISetFont(11, 400, Default, "Arial") Local $text = GUICtrlCreateLabel("Dashboard", 10, 10, 380, ($lnCount * 20) - 20) WinMove($hGUI_Child_Dashboard, "", $aGUI_Main_Pos[0] + $aGUI_Main_Pos[2], $aGUI_Main_Pos[1]) EndFunc ;==>_Create_Child ;====================================== ;~ Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) ;~ If $hWnd <> $hGUI_Main And BitAND($wParam,0xFFF0) = 0xF010 Then Return False ; $SC_MOVE = 0xF010 ;~ Return $GUI_RUNDEFMSG ;~ EndFunc Now here is an interesting test you could do : please notice the commented lines in the precedent script : ;~ GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") ;~ Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) ;~ If $hWnd <> $hGUI_Main And BitAND($wParam,0xFFF0) = 0xF010 Then Return False ; $SC_MOVE = 0xF010 ;~ Return $GUI_RUNDEFMSG ;~ EndFunc Actually you don't need them because your 2 child GUI's got this style : BitOR($WS_POPUP, $WS_BORDER) Which means you can't drag the child GUI's by themselves as they got no title bar... but what would happen if your child GUI's got a title bar ? Just test it, change the style of one of your child GUI from BitOR($WS_POPUP, $WS_BORDER) to -1 and see what happens now that a child GUI got a title bar : * If you keep the lines commented (WM_SYSCOMMAND) then you can drag the child GUI by its title bar, bad ! * If you uncomment the lines, (registering WM_SYSCOMMAND), then you can't drag the child GUI, great ! So in case you use this last script, it's not a bad idea to keep the commented lines within the script, maybe they will be useful one day ? Both icons required to run the script are downloadable at the end of the precedent message. Happy scripting
    1 point
  8. @Jos thank you very much the last example is working successFully Merci beaucoup #RequireAdmin #include <WinAPIProc.au3> $list = ProcessList("CMD.exe") if not @Error then for $i = 1 to $list[0][0] if _WinAPI_IsElevated_pid($list[$i][1]) then MSGBox(64, "", 1) else MSGBox(64, "", 0) endIf next endIf ; #FUNCTION# ==================================================================================================================== ; Author.........: Yashied ; Modified.......: jpm. Jos ; =============================================================================================================================== Func _WinAPI_IsElevated_pid($iPID=0) Local $aAdjust, $hToken, $iElev, $aRet, $iError = 0 ; Enable "SeDebugPrivilege" privilege for obtain full access rights to another processes Local $hToken = _WinAPI_OpenProcessToken(BitOR($TOKEN_ADJUST_PRIVILEGES, $TOKEN_QUERY)) _WinAPI_AdjustTokenPrivileges($hToken, $SE_DEBUG_NAME, $SE_PRIVILEGE_ENABLED, $aAdjust) If $iPID <> 0 then Local $hProcess = DllCall('kernel32.dll', 'handle', 'OpenProcess', 'dword', (($__WINVER < 0x0600) ? 0x00000400 : 0x00001000), _ 'bool', 0, 'dword', $iPID) If @error Or Not $hProcess[0] Then Return SetError(@error + 20, @extended, 0) $hToken = _WinAPI_OpenProcessToken(0x0008, $hProcess[0]) Else $hToken = _WinAPI_OpenProcessToken(0x0008) EndIf If Not $hToken Then Return SetError(@error + 10, @extended, False) Do $aRet = DllCall('advapi32.dll', 'bool', 'GetTokenInformation', 'handle', $hToken, 'uint', 20, 'uint*', 0, 'dword', 4, _ 'dword*', 0) ; TOKEN_ELEVATION If @error Or Not $aRet[0] Then $iError = @error + 10 ExitLoop EndIf $iElev = $aRet[3] $aRet = DllCall('advapi32.dll', 'bool', 'GetTokenInformation', 'handle', $hToken, 'uint', 18, 'uint*', 0, 'dword', 4, _ 'dword*', 0) ; TOKEN_ELEVATION_TYPE If @error Or Not $aRet[0] Then $iError = @error + 20 ExitLoop EndIf Until 1 DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hToken) If $iError Then Return SetError($iError, 0, False) Return SetExtended($aRet[0] - 1, $iElev) EndFunc ;==>_WinAPI_IsElevated_pid
    1 point
  9. Indeed it is about the current process elevation level. I couldn't find an already made UDF so made a copy of the UDF and added the option for a PID. Just have a try with this _WinAPI_IsElevated_pid($iPID) version: #RequireAdmin #include <WinAPIProc.au3> ConsoleWrite('Current process = ' & _WinAPI_IsElevated_pid() & ' >Error code: ' & @error & @CRLF) ;### Debug Console ; Display a list of Notepad processes returned by ProcessList. Local $aProcessList = ProcessList() For $i = 1 To $aProcessList[0][0] ConsoleWrite($aProcessList[$i][0] & ' = ' & _WinAPI_IsElevated_pid($aProcessList[$i][1]) & ' >Error code: ' & @error & @CRLF) ;### Debug Console Next ; #FUNCTION# ==================================================================================================================== ; Author.........: Yashied ; Modified.......: jpm. Jos ; =============================================================================================================================== Func _WinAPI_IsElevated_pid($iPID=0) Local $aAdjust, $hToken, $iElev, $aRet, $iError = 0 ; Enable "SeDebugPrivilege" privilege for obtain full access rights to another processes Local $hToken = _WinAPI_OpenProcessToken(BitOR($TOKEN_ADJUST_PRIVILEGES, $TOKEN_QUERY)) _WinAPI_AdjustTokenPrivileges($hToken, $SE_DEBUG_NAME, $SE_PRIVILEGE_ENABLED, $aAdjust) If $iPID <> 0 then Local $hProcess = DllCall('kernel32.dll', 'handle', 'OpenProcess', 'dword', (($__WINVER < 0x0600) ? 0x00000400 : 0x00001000), _ 'bool', 0, 'dword', $iPID) If @error Or Not $hProcess[0] Then Return SetError(@error + 20, @extended, 0) $hToken = _WinAPI_OpenProcessToken(0x0008, $hProcess[0]) Else $hToken = _WinAPI_OpenProcessToken(0x0008) EndIf If Not $hToken Then Return SetError(@error + 10, @extended, False) Do $aRet = DllCall('advapi32.dll', 'bool', 'GetTokenInformation', 'handle', $hToken, 'uint', 20, 'uint*', 0, 'dword', 4, _ 'dword*', 0) ; TOKEN_ELEVATION If @error Or Not $aRet[0] Then $iError = @error + 10 ExitLoop EndIf $iElev = $aRet[3] $aRet = DllCall('advapi32.dll', 'bool', 'GetTokenInformation', 'handle', $hToken, 'uint', 18, 'uint*', 0, 'dword', 4, _ 'dword*', 0) ; TOKEN_ELEVATION_TYPE If @error Or Not $aRet[0] Then $iError = @error + 20 ExitLoop EndIf Until 1 DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hToken) If $iError Then Return SetError($iError, 0, False) Return SetExtended($aRet[0] - 1, $iElev) EndFunc ;==>_WinAPI_IsElevated_pid EDIT: Updated the code after some more testing. Obviously you need to run this elevated to get info from elevated processes. Jos
    1 point
  10. The issue is fixed in the updates in post 289.
    1 point
  11. Meet the line continuation character "_" $string = 'This is line 1' & @CRLF & _ 'This' & _ ' is line 2' & @CRLF & _ 'This is line 3' ConsoleWrite($string & @CRLF) Now you can have the line to suit your editor width which will be easier for you to manage to type and read.
    1 point
×
×
  • Create New...