Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/18/2024 in all areas

  1. I think that there are many types of first file. I think you need to specify the type of sorting you require then we can determine the first file sorted in such a way.
    2 points
  2. How can you be so sure, "findDuck" and translating the Vietnamese "Mother Duck has been found" and "Mother duck could not be found", but the code doesnt include any ducks to be found, it looks with pixelsearch to find some Ducks somewhere else.
    1 point
  3. @rsnYou are right! Running my test with your tip, I used the wrong working directory. That's why it was failing. Rerunning the test with your piece of code succesfully, I decided to look at my code and find out that @tempdir was not working in my code I can now finish my "restart print spooler" tool for my users. Thanks for your help (and ofcourse all others who pitched in)
    1 point
  4. @Jemboy The user you created and assigned permissions to control the spooler doesn't have to be in the administrators group. By not being in that group it adds the advantage of not being able to control any other service or admin level processes. And your script wouldn't need #RequireAdmin either. I'll run a couple extra tests today just in case I'm talking out of my butt I ran some tests. I created a local non-admin user and assigned Full Control to the spooler: Then ran the following: #include <AutoItConstants.au3> RunAs ( "testuser" , "." , "password" , $RUN_LOGON_NOPROFILE , @ComSpec & " /k sc.exe stop spooler" , "C:\windows\system32" , @SW_SHOWDEFAULT ) And the service stopped You can use any method you want but I chose SC.exe for simplicity in this example.
    1 point
  5. Make a server ? ( https://www.autoitscript.com/forum/topic/201673-json-http-post-serverlistener/page/2/#comment-1447447 ) Then with your own API do as you please. The server runs with your full admin rights. That would solve your problem.
    1 point
  6. Or you may want to try with WMI : #RequireAdmin #include <Constants.au3> #include <Array.au3> ; https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-service Opt("MustDeclareVars", 1) CheckService(@ComputerName, "Spooler") ; or replace with name of computer you can remotely access Func CheckService($sName, $sService) Local $oWMIService = ObjGet("winmgmts:\\" & $sName & "\root\CIMV2") Local $oItems = $oWMIService.ExecQuery('SELECT * FROM Win32_Service WHERE Name = "' & $sService & '"') If Not IsObj($oItems) Then Exit MsgBox($MB_OK, "Error", "Not an object") If Not $oItems.count Then Exit MsgBox($MB_OK, "Error", "Service not found") Local $aService[$oItems.count][5], $i = 0 For $oItem In $oItems $aService[$i][0] = $oItem.Caption $aService[$i][1] = $oItem.Started $aService[$i][2] = $oItem.StartMode $aService[$i][3] = $oItem.State $aService[$i][4] = $oItem.Status $i += 1 Next _ArrayDisplay ($aService) Local $oService = $oItems.itemIndex(0) ;$oService.StopService() ;$oService.StartService () EndFunc ;==>_CheckService
    1 point
  7. The following script, thanks largely to @UEZ, displays the attached PNG image on the Windows Desktop. It perfectly renders the sticky note's shadow over whatever's in the background. But here's the catch: I would like to add a line of text, fetched from a variable and using a font of my choice, atop the sticky note. It needs to be part of the same GUI because the sticky note can be dragged and placed anywhere on the screen. Will someone here show me how to add just the additional code needed to accomplish my goal? I have tried sporadically for two years to merge in code from scripts that use GDI+ calls to display text over alpha channels but the challenge has proven beyond me. #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> #include <StructureConstants.au3> #include <WinAPIConstants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> _GDIPlus_Startup() Global Const $SC_DRAGMOVE = 0xF012 Global $iW, $iH, $hImage, $hBitmap, $hGUI $hImage = _GDIPlus_BitmapCreateFromFile("Using-Note.png") $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate("", $iW, $iH, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOPMOST)) GUISetState() _WinAPI_BitmapDisplayTransparentInGUI($hBitmap, $hGUI) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hBitmap) _GDIPlus_BitmapDispose($hImage) _GDIPlus_Shutdown() GUIDelete() Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $bReleaseGDI = True) If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0) Local $tDim = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap) Return True EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN
    1 point
  8. Hello dunk6! In order to find the first file, use the command FileFindFirstFile. Here is the AutoIT Help Example : ; Shows the filenames of all files in the current directory. $search = FileFindFirstFile("*.*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop MsgBox(4096, "File:", $file) WEnd ; Close the search handle FileClose($search) Also, you might check this.
    1 point
×
×
  • Create New...