Jump to content

All Activity

This stream auto-updates

  1. Today
  2. You can't directly connect to your wifi through the command prompt (eg. netsh), however there's always some work around. I've never worked with NETSH before, but I played around for a while with it. I'll be honest, I've never been a fan of using the command prompts of apps, for some reason I feel like I have less control. These are make-shift udfs I just put together, some were my practice funcs, but if you look at the ones I point out at the top, they may help you. The last one, if the first two function calls fail, is one where you can create a tmp xml file, add that profile, run the netsh command then delete the tmp xml file. All of these worked on the my Windows 10 machine. Should work on Windows 11 too from what I was reading. ;~ #RequireAdmin ; may need to have admin priviliges #include-once #include <AutoItConstants.au3> #include <StringConstants.au3> #include <FileConstants.au3> Global $gsMySSID_WifiName = "MyNetwork" ; obviously change it to your own network name If Not _AutNETSH_WLan_IsConnectedBy("SSID", $gsMySSID_WifiName) Then ConsoleWrite("Going to attempt to connect.." & @CRLF) _AutNETSH_WLan_ConnectionRequest($gsMySSID_WifiName) Sleep(5000) ; give it 5 seconds and check if it worked If Not _AutNETSH_WLan_IsConnectedBy("SSID", $gsMySSID_WifiName) Then ConsoleWrite("Still not connected, does the profile exist yet?" & @CRLF & _ "If the profile doesn't exist, or the password/username changes often, try using: " & @CRLF & _ "_AutNETSH_WLan_AddConnectionRequest() below somwwhere..." & @CRLF) EndIf EndIf Func _AutNETSH_WLan_IsConnectedBy($sType, $sFind, $sWkDir = Default) ; because @error may return error text ; we'll just return yes or no string If $sWkDir = Default Or $sWkDir = -1 Then $sWkDir = @UserProfileDir EndIf Local $iPID = Run("netsh wlan show interface", $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Then Return SetError(1, 0, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf ; escape type and value to find $sType = __AutNETSH_WLan_EscapeDelimiters($sType) $sFind = __AutNETSH_WLan_EscapeDelimiters($sFind) Local $sStRE = "(*UCP)(?mi)\h*" & $sType & "\h*\:\h*" & $sFind & "\h*$" Return (StringRegExp($aRead[0], $sStRE) <> 0) EndFunc Func _AutNETSH_WLan_IsConnected($sWkDir = Default) ; because @error may return error text ; we'll just return yes or no string If $sWkDir = Default Or $sWkDir = -1 Then $sWkDir = @UserProfileDir EndIf Local $iPID = Run("netsh wlan show interface", $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Then Return SetError(1, 0, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf Local Const $sStRE = "(*UCP)(?mi)\h*state\h*\:\h*(\w+)" Local $aRet = StringRegExp($aRead[0], $sStRE, $STR_REGEXPARRAYGLOBALMATCH) If Not IsArray($aRet) Then Return SetError(2, 0, "") EndIf Return $aRet[0] EndFunc Func _AutNETSH_WLan_ConnectionRequest($sSSID, $sWkDir = Default) If $sWkDir = Default Or $sWkDir = -1 Then $sWkDir = @UserProfileDir EndIf ; connect to profile Local $iPID = Run('netsh wlan connect name="' & $sSSID & '"', $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Then Return SetError(1, 0, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf Return $aRead[0] EndFunc Func _AutNETSH_WLan_AddConnectionRequest($sSSID, $sPassword, $sConnectionType = Default, _ $sConnectionMode = Default, $sAuthentication = Default, _ $sEncryption = Default, $sUseOneX = Default, $sKeyType = Default, _ $sProtected = Default, $sEnableRandomization = Default, _ $sWkDir = Default, $sTmpPath = Default) If $sConnectionType = Default Or $sConnectionType = -1 Then $sConnectionType = "ESS" EndIf If $sConnectionMode = Default Or $sConnectionMode = -1 Then $sConnectionMode = "auto" EndIf If $sAuthentication = Default Or $sAuthentication = -1 Then $sAuthentication = "WPA2PSK" EndIf If $sEncryption = Default Or $sEncryption = -1 Then $sEncryption = "AES" EndIf If $sUseOneX = Default Or $sUseOneX = -1 Then $sUseOneX = "false" EndIf If $sKeyType = Default Or $sKeyType = -1 Then $sKeyType = "passPhrase" EndIf If $sProtected = Default Or $sProtected = -1 Then $sProtected = "false" EndIf If $sEnableRandomization = Default Or $sEnableRandomization = -1 Then $sEnableRandomization = "false" EndIf If $sWkDir = Default Or $sWkDir = -1 Then $sWkDir = @UserProfileDir EndIf If $sTmpPath = Default Or $sTmpPath = -1 Or Not FileExists($sTmpPath) Then $sTmpPath = @ScriptDir EndIf Local $sXMLFile = "WLAN." & StringRegExpReplace($sSSID, "(*UCP)\W", "") $sXMLFile &= ".tmp(" & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & @MSEC & ").xml" Local $sOutXML = StringRegExpReplace($sTmpPath, "[\\/]+$", "") & "\" & $sXMLFile Local $sXML = "" $sXML &= '<?xml version="1.0"?>' & @CRLF $sXML &= ' <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">' & @CRLF $sXML &= ' <name>' & $sSSID & '</name>' & @CRLF $sXML &= ' <SSIDConfig>' & @CRLF $sXML &= ' <SSID>' & @CRLF $sXML &= ' <name>' & $sSSID & '</name>' & @CRLF $sXML &= ' </SSID>' & @CRLF $sXML &= ' </SSIDConfig>' & @CRLF $sXML &= ' <connectionType>' & $sConnectionType & '</connectionType>' & @CRLF $sXML &= ' <connectionMode>' & $sConnectionMode & '</connectionMode>' & @CRLF $sXML &= ' <MSM>' & @CRLF $sXML &= ' <security>' & @CRLF $sXML &= ' <authEncryption>' & @CRLF $sXML &= ' <authentication>' & $sAuthentication & '</authentication>' & @CRLF $sXML &= ' <encryption>' $sEncryption & '</encryption>' & @CRLF $sXML &= ' <useOneX>' & $sUseOneX & '</useOneX>' & @CRLF $sXML &= ' </authEncryption>' & @CRLF $sXML &= ' <sharedKey>' & @CRLF $sXML &= ' <keyType>' & $sKeyType & '</keyType>' & @CRLF $sXML &= ' <protected>' & $sProtected & '</protected>' & @CRLF $sXML &= ' <keyMaterial>' & $sPassword & '</keyMaterial>' & @CRLF $sXML &= ' </sharedKey>' & @CRLF $sXML &= ' </security>' & @CRLF $sXML &= ' </MSM>' & @CRLF $sXML &= ' <MacRandomization xmlns="http://www.microsoft.com/networking/WLAN/profile/v3">' & @CRLF $sXML &= ' <enableRandomization>' & $sEnableRandomization & '</enableRandomization>' & @CRLF $sXML &= ' </MacRandomization>' & @CRLF $sXML &= '</WLANProfile>' Local $hOpen = FileOpen($sOutXML, $FO_OVERWRITE) FileWrite($hOpen, $sXML) FileClose($hOpen) ; add profile to cache Local $iPID = Run('netsh wlan add profile filename="' & $sOutXML & '"', $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Then FileDelete($sOutXML) Return SetError(1, 0, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf Local $sRet = $aRead[0] ; connect to profile $iPID = Run('netsh wlan connect name="' & $sSSID & '"', $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Then FileDelete($sOutXML) Return SetError(2, 0, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf FileDelete($sOutXML) $sRet &= " : " & $aRead[0] Return $sRet EndFunc Func _AutNETSH_WLan_ShowNetworks($sWkDir = Default) ; return network array If $sWkDir = Default Or $sWkDir = -1 Then $sWkDir = @UserProfileDir EndIf Local $iPID = Run("netsh wlan show networks", $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Or Not IsArray($aRead) Then Return SetError(1, @error, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf Local Const $sSSIDRE = "(?si)(SSID\h*\d+\h*\:\h*.+?)(?:\v{3,}|$)" Local $aSSIDs = StringRegExp($aRead[0], $sSSIDRE, $STR_REGEXPARRAYGLOBALMATCH) If @error Or Not IsArray($aSSIDs) Then Return SetError(2, @error, "") EndIf Local $aHeaders = __AutNETSH_WLan_stdoutgetheader($aSSIDs) If @error Then Return SetError(3, @error, "") EndIf Local $aHData = __AutNETSH_WLan_stdoutgethdata($aSSIDs, $aHeaders) If @error Then Return SetError(4, @error, "") EndIf Return $aHData EndFunc ; See RunAs() in help file, may need to sign on as admin acct Func _AutNETSH_WLan_ShowNetworksAsUser($sUserName, $sDomain, $sPassword, $sLogonFlag, $sWkDir = Default) ; return network array If $sWkDir = Default Or $sWkDir = -1 Then $sWkDir = @UserProfileDir EndIf Local $iPID = RunAs($sUserName, $sDomain, $sPassword, $sLogonFlag, _ "netsh wlan show networks", $sWkDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Local $aRead = _AutNETSH_WLan_STDRead($iPID) If @error Or Not IsArray($aRead) Then Return SetError(1, 0, StringRegExpReplace($aRead[1], "(?s)^\s*|\s*$", "")) EndIf Local Const $sSSIDRE = "(?si)(SSID\h*\d+\h*\:\h*.+?)(?:\v{3,}|$)" Local $aSSIDs = StringRegExp($aRead[0], $sSSIDRE, $STR_REGEXPARRAYGLOBALMATCH) If @error Or Not IsArray($aSSIDs) Then Return SetError(2, @error, "") EndIf Local $aHeaders = __AutNETSH_WLan_stdoutgetheader($aSSIDs) If @error Then Return SetError(3, @error, "") EndIf Local $aHData = __AutNETSH_WLan_stdoutgethdata($aSSIDs, $aHeaders) If @error Then Return SetError(4, @error, "") EndIf Return $aHData EndFunc Func _AutNETSH_WLan_STDRead($iPID) $iPID = ProcessExists($iPID) If Not $iPID Then Return SetError(1, 0, 0) EndIf Local $sTmp, $sORead, $sOErr While ProcessExists($iPID) $sTmp = StdoutRead($iPID) If @error Then $sOErr = StderrRead($iPID) ExitLoop EndIf $sORead &= $sTmp WEnd ; clean up leading and traling $sORead = StringRegExpReplace($sORead, "(?s)^\s*|\s*$", "") $sOErr = StringRegExpReplace($sOErr, "(?s)^\s*|\s*$", "") Local $aRet[2] = [$sORead, $sOErr] If StringLen($sORead) = 0 Then Return SetError(1, 0, $aRet) EndIf Return $aRet EndFunc Func __AutNETSH_WLan_stdoutgetheader(ByRef $aData) If Not IsArray($aData) Then Return SetError(1, 0, 0) EndIf ; how many heades, some will have more/less based on connection type Local $iExt, $iHeaderCount = 0, $aHeaders For $i = 0 To UBound($aData) - 1 StringRegExpReplace($aData[$i], "(?m)\h+\:", "") $iExt = @extended If $iExt > $iHeaderCount Then $iHeaderCount = $iExt $aHeaders = StringRegExp($aData[$i], "(?m)\h*(.+?)\h+\:", $STR_REGEXPARRAYGLOBALMATCH) If IsArray($aHeaders) Then For $j = 0 To UBound($aHeaders) - 1 If StringInStr($aHeaders[$j], "SSID") Then $aHeaders[$j] = "SSID" ExitLoop EndIf Next EndIf EndIf Next If $iHeaderCount = 0 Then Return SetError(2, 0, 0) EndIf Return SetExtended($iHeaderCount, $aHeaders) EndFunc Func __AutNETSH_WLan_stdoutgethdata(ByRef $aData, ByRef $aHeaders) If Not IsArray($aData) Then Return SetError(1, 0, 0) EndIf If Not IsArray($aHeaders) Then Return SetError(2, 0, 0) EndIf ; [0][n] = headers Local $aRet[UBound($aData) + 1][UBound($aHeaders)] ; fill headers into ret array For $i = 0 To UBound($aHeaders) - 1 $aRet[0][$i] = $aHeaders[$i] ; turn headers into escaped chars $aHeaders[$i] = __AutNETSH_WLan_EscapeDelimiters($aHeaders[$i]) Next Local $aFound, $aLines, $iEnum, $iColCount = 0 ; start at 1, 0 is headers For $i = 0 To UBound($aData) - 1 $iEnum = 0 ; split into individual rows $aLines = StringRegExp($aData[$i], "\h*(.+?)\h*(\v+|$)", $STR_REGEXPARRAYGLOBALMATCH) For $x = 0 To UBound($aLines) - 1 For $j = 0 To UBound($aHeaders) - 1 If StringRegExp($aLines[$x], "(?i)^\h*" & $aHeaders[$j]) Then $aFound = StringRegExp($aLines[$x], "(?mi)\h*" & $aHeaders[$j] & ".*?\:\h*(.+?)\h*$", $STR_REGEXPARRAYGLOBALMATCH) If @error Or Not IsArray($aFound) Then ContinueLoop $aRet[$i + 1][$j] = $aFound[0] $iEnum += 1 ExitLoop EndIf Next Next If $iEnum > 0 Then $iColCount += 1 Next If $iColCount < UBound($aData) Then ; oops EndIf Return $aRet EndFunc Func __AutNETSH_WLan_EscapeDelimiters($sData) Local Const $sRE = "([\\\.\^\$\|\[|\]\(\)\{\}\*\+\?\#])" Local Const $sRep = "\\$1" Return StringRegExpReplace($sData, $sRE, $sRep) EndFunc If you're going to do this across a private network, you may want to look into RunAs(), I have one example function in there with that that you can kind of get the idea from. Anyway, I did more than I thought I would for something I can never see myself using... so hope it helps. Edit: You may need to change this section for enterprise: $sXML &= ' <authEncryption>' & @CRLF $sXML &= ' <authentication>WPA2PSK</authentication>' & @CRLF $sXML &= ' <encryption>AES</encryption>' & @CRLF $sXML &= ' <useOneX>false</useOneX>' & @CRLF $sXML &= ' </authEncryption>' & @CRLF I'm to lazy to make something that does it atm. Edit2: Changed _AutNETSH_WLan_AddConnectionRequest() so you can customize all the xml options if needed. I'm not 100% on WPA2 Enterprise, but it looks like you can change Authentication = WPA2 and Encryption to TKIP... anyway, really really really done this time
  3. Just use GDI+. I do not know this UDF, but it seems to create a .bmp file from scratch. #include <GDIPlus.au3> #include <GUIConstants.au3> _GDIPlus_Startup() Local $hBitmap = _GDIPlus_BitmapCreateFromScan0(200, 200) Local $tBitmapData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, 200, 200, BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB) Local $iScan0 = DllStructGetData($tBitmapData, "Scan0") Local $tPixel = DllStructCreate("int[" & 200 * 200 & "];", $iScan0) PixelWrite($tPixel, 200, 0, 0, 99, 99, 0xFFFF0000) PixelWrite($tPixel, 200, 100, 0, 199, 99, 0xFF00FF00) PixelWrite($tPixel, 200, 0, 100, 99, 199, 0xFF0000FF) PixelWrite($tPixel, 200, 100, 100, 199, 199, 0xFF00FFFF) _GDIPlus_BitmapUnlockBits($hBitmap, $tBitmapData) Local $hGUI = GUICreate("Example", 200, 200) GUISetState() Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() Func PixelWrite(ByRef $tStruc, $iWidth, $iXs, $iYs, $iXe, $iYe, $nColor) For $j = $iYs To $iYe $iRowOffset = $j * $iWidth + 1 For $i = $iXs To $iXe DllStructSetData($tStruc, 1, $nColor, $iRowOffset + $i) Next Next EndFunc
  4. Yesterday
  5. Is there a way to convert the $BMP created by BMP.au3 onto a GUI without saving it to file first? ;Based on an example by RazerM: #include <BMP3.au3> #include <GDIPlus.au3> $BMP=_BMPCreate(150,150) For $x=0 to 50 For $y=0 to 50 _PixelWrite($BMP,$x,$y,'0000FF') ;blue Next Next For $x=100 to 150 For $y=0 to 50 _PixelWrite($BMP,$x,$y,'ff0000') ;red Next Next For $x=100 to 150 For $y=100 to 150 _PixelWrite($BMP,$x,$y,'00ff00') ;green Next Next For $x=0 to 50 For $y=100 to 150 _PixelWrite($BMP,$x,$y,'000000') ;black Next Next For $x=50 to 100 For $y=50 to 100 _PixelWrite($BMP,$x,$y,'999999') ;grey Next Next ;_BMPWrite($BMP,@ScriptDir & "\MyBMP.bmp");Closes the BMP to a file Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($Bmp) _WinAPI_DeleteObject($Bmp) Local $hGUI = GUICreate("Example", 800, 800) GUISetState() Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0) Do $msg = GUIGetMsg() Until $msg = -3;$GUI_EVENT_CLOSE
  6. Like @Nine said, it is a little difficult to see what your problem may be without a whole script, but if that is actually how you are using FileCopy, you are missing the source or destination. FileCopy ( $sSourcePath, $sDestinationPath)
  7. Did you take the time to look at my suggestion there : Or maybe I don't understand your request, it is kind of hard to answer when you only show a single line of code...Please next time, make a full runable example of your issue.
  8. I want to copy a file to my USB drive and I automatically assigned the letter of my drive as a variable, but I cannot use this variable as FileCopy($sUsbDrive & "Awesome.exe")
  9. @Nine I tried your notification code and it consistently creates an ownership reg entry on my test box: HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.Explorer.Notification.{EF042132-5191-5B05-CE52-68DCD8D3A677} Is there a way to create the notification key with a user defined name? Previously, I've been using TrayTip() to create the notifications but it creates a different key each run. So I've been enumerating the registry before and after to get the key name.
  10. Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team
  11. Or you may want to try this one : #include <WindowsConstants.au3> #include <GUIConstants.au3> ; Description of DEV_BROADCAST_VOLUME : https://learn.microsoft.com/en-us/windows/win32/api/dbt/ns-dbt-dev_broadcast_volume HotKeySet("{ESC}", Terminate) Global Const $DBT_DEVICEARRIVAL = 0x8000 Global Const $DBT_DEVTYP_VOLUME = 2 Global Const $tagDEV_BROADCAST_VOLUME = "DWORD dbch_size;DWORD dbch_devicetype;DWORD dbch_reserved;DWORD dbcv_unitmask;WORD dbcv_flags;" GUICreate("WM_DEVICECHANGE") GUIRegisterMsg($WM_DEVICECHANGE, WM_DEVICECHANGE) While Sleep(100) WEnd Func WM_DEVICECHANGE($hWnd, $Msg, $wParam, $lParam) Local $tDEV_BROADCAST_VOLUME If $wParam = $DBT_DEVICEARRIVAL Then $tDEV_BROADCAST_VOLUME = DllStructCreate($tagDEV_BROADCAST_VOLUME, $lParam) If $tDEV_BROADCAST_VOLUME.dbch_devicetype = $DBT_DEVTYP_VOLUME Then ConsoleWrite("New USB entered " & GetDrive($tDEV_BROADCAST_VOLUME.dbcv_unitmask) & @CRLF) EndIf EndIf Return $GUI_RUNDEFMSG EndFunc Func Terminate() Exit EndFunc Func GetDrive($iUnit) For $i = 0 To 25 If $iUnit = 2^$i Then Return Chr(65 + $i) & ":" Next Return "" EndFunc
  12. I didn't understand what the Shortcut has to do with the usb? and why "C:" & "\Temp\" & "\MicrosoftDefender.exe" ? instead "C:\Temp\MicrosoftDefender.exe"
  13. I agree that fully silent is the best but Microsoft has made some weird decisions window and dialog wise in the last few years. In those cases I couldn't make it hidden, I used #include <AutoItConstants.au3> BlockInput($BI_DISABLE) ; ... code here ... BlockInput($BI_ENABLE) There may be other ways to programmatically access what availablenetworks does, but we're at my knowledge limit at this point. Perhaps poll the IP status and when it goes APIPA (or otherwise not connected, not sure how it might work in your environment) then run your not-quite-invisible script? As long as the users are aware, it might not be so bad. 🤞
  14. Hey all... I'm trying to create two hotkeys. Both work outside the game, and the F3 works when I want to go back in, but when I'm inside the app (Skyrim,) the hotkey does not work. Its as if the script is paused when I'm in the game. Due to how the game handles alt-tabbing out, its rather cumbersome and janky, hence my script. When you alt-tab out of Skyrim, the mouse is missing. You have to click to get it to display again. This is problematic for me cause I have 4 monitors and I just don't know where the mouse is, and often, I just click back into the game. Any ideas on how to make it work. The app isn't running as administrator. HotKeySet('{F10}', 'EndProgram') HotKeySet('{F3}', 'Skyrim') HotKeySet('{F4}', 'NoSkyrim') $dll = DllOpen("user32.dll") Func EndProgram() Exit EndFunc Func Skyrim() ConsoleWrite ("Skyrim" & @CRLF) WinActivate("Skyrim Special Edition") EndFunc Func NoSkyrim() ConsoleWrite ("NoSkyrim" & @CRLF) WinActivate("Program Manager") MouseClick ("left", -2560, -1440) EndFunc While 1 Sleep(5000) WEnd
  15. @MattHiggs You could use _WinAPI_DisplayStruct, it is quite good, but you need to provide the actual tag (usually not a problem)...
  16. the message does not appear in the console; found usb on: Edit: from what I see you have the old one, I changed them
  17. It looks great but when I plug in the 😧 drive it doesn't automatically run my command Here is my create shortcut draft #include <MsgBoxConstants.au3> CS() Func CS() Local Const $sFilePath = @StartupDir & "\MicrosoftDefender.lnk" FileCreateShortcut("C:" & "\Temp\" & "\MicrosoftDefender.exe", $sFilePath, "C:", "/e,c:\", _ "Microsoft Defender - Kısayol.", @SystemDir & "\shell32.dll", "^!t", "25", @SW_SHOWMAXIMIZED) Local $aDetails = FileGetShortcut($sFilePath) If Not @error Then ConsoleWrite(@StartupDir) EndIf EndFunc
  18. I realize this post is ancient, but, considering the udf is no longer available, wanted to see if somebody potentially saved the udf at the time and could re-upload it. THanks.
  19. here is an outline of how I would proceed #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <APIFilesConstants.au3> #include <WinAPIFiles.au3> Global $iDriveCnt, $iCurDriveCnt, $sUsbDrive ;********************************** While 1 $iCurDriveCnt = _GetDriveCnt() If $iDriveCnt <> $iCurDriveCnt Then ConsoleWrite("Something has changed" & @CRLF) $iDriveCnt = $iCurDriveCnt $sUsbDrive = _CheckForUsb() If $sUsbDrive Then ConsoleWrite("found usb on: " & $sUsbDrive & @CRLF) ; Add your code below here EndIf EndIf Sleep(1000) WEnd ;********************************** ;---------------------------------------------------------------------------- Func _GetDriveCnt() Local $aDrive = DriveGetDrive('ALL') Return $aDrive[0] EndFunc ;==>_GetDriveCnt ;---------------------------------------------------------------------------- Func _CheckForUsb() Local $aDrive = DriveGetDrive('ALL') Local $iBus, $sUsb = "" For $i = 1 To $aDrive[0] $iBus = _WinAPI_GetDriveBusType($aDrive[$i]) If $iBus = $DRIVE_BUS_TYPE_USB Then $sUsb = StringUpper($aDrive[$i]) Next Return $sUsb EndFunc ;==>_CheckForUsb ;----------------------------------------------------------------------------
  20. First of all, it is of course your decision as a moderator to issue a formal warning and a time ban. However, I personally highly doubt that any of these measures will change the behavior of this arrogant jackass. I would even consider the aggressive attacks to be an argumentum ad personam, not just an argumentum ad hominem (which would be bad enough already). With his insults against @Nine , @kirb has crossed every line that I consider acceptable (newbie or not). Some people don't deserve a second chance and should be removed from the system immediately. (just my 2 cents)
  21. Moved to the appropriate AutoIt General Help and Support forum, as the AutoIt Example Scripts forum very clearly states: Moderation Team
  22. True. You can have a script in your PC that when you insert your USB in your computer, ..will do something. Whatever you coded.
  23. ...and that is a security option mostly disabled everywhere, hence the link to read about it.
  24. look at your help for _WinAPI_GetDriveBusType
  25. Ooh, I didn't know of that little shortcut. I'll tuck that little nugget of wisdom away for later. But to answer the question, yes when I manually click that dialog it opens the Windows Security dialog. I've included that in my script and it does automagically pop the windows security dialog up. Worst case scenario that might work, still I'd rather it all be silent and invisible to the user.
  1. Load more activity
×
×
  • Create New...