Leaderboard
Popular Content
Showing content with the highest reputation on 02/07/2012 in all areas
-
Secure file deletion desktop toy
jvanegmond reacted to Skitty for a topic
So I was getting into GDI and found a lot of examples that I really liked, one of them caught my eye which was a smiley face that would go in circles that I got from martin I wanted to make a sort of "black hole" on my desktop where I can drag and drop files and have them securely deleted and came up with this with a lot of help from UEZ, Werty and other people from who I took code from and liked it so much I thought I'd share it since I haven't seen something like this on here yet. You are going to need to install the ImageMagick COM object if you do not already have it, the script will tell you where you can get it and how to install it if you don't already have it. A lot of copy pasta lead to this script. Now for the script. #NoTrayIcon #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=blackhole.ico #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Comment=Graphical Trash Bin #AutoIt3Wrapper_Res_Description=Secure Delete Toy #AutoIt3Wrapper_Res_Fileversion=1.0.0.58 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3" #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/so #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <GDIPlus.au3> #include <GDIp.au3> #include <SD.au3>; wraithdu Secure Delete UDF http://www.autoitscript.com/forum/topic/82954-securely-overwrite-files/ HotKeySet("{ESC}", "close") OnAutoItExitRegister("close") Global $aM_Mask, $hwnd Global Const $IMAGE_BITMAP = 0 Global Const $STM_SETIMAGE = 0x0172 Global $gaDropFiles[1] Global $Img = @TempDir & "\test.png"; The image used for the effects processing Global $ImgMgc = ObjCreate("ImageMagickObject.MagickImage.1"); Create the Image Majic Com object if installed If Not IsObj($ImgMgc) Then Global $Over = False, $SEC = @SEC, $Pos, $Msg, $Label, _ $Adv = GUICreate("Error!", 297, 93, 371, 313, BitOR($WS_CAPTION, $WS_POPUPWINDOW, $DS_SETFOREGROUND), -1), _ $h = ControlGetHandle($Adv, '', $Label), _ $Ok = GUICtrlCreateButton("OK", 107, 58, 77, 23) GUICtrlCreateIcon(@SystemDir & "\user32.dll", -2, 10, 10, 32, 32) GUICtrlCreateLabel("You need to install the ", 60, 20, 110, 17) $Label = GUICtrlCreateLabel("ImageMagick COM object!", 169, 20, 124, 17) GUICtrlSetFont($Label, 8.5) GUICtrlSetCursor($Label, 0) GUISetState() While 1 $Pos = _WinAPI_GetMousePos() $Msg = GUIGetMsg() Switch $Msg Case -3 close() Case $Ok close() Case $Label ShellExecute("http://www.imagemagick.org/script/binary-releases.php#windows") Sleep(8000) MsgBox(48,"Info",'The download we'&"'"&'re looking for is the "ImageMagick-6.x.x-3-Q16-windows-dll.exe" release binary...' & @CR & @CR & _ 'After downloading and running, in the "Select Additional Tasks" section, deselect everything' & @CR & _ 'and select only "Install ImageMagickObject OLE Control for VBscript, Visual Basic, and WSH".') EndSwitch Switch _WinAPI_WindowFromPoint($Pos) Case $h If Not $Over Then GUICtrlSetFont($Label, -1, -1, 4) GUICtrlSetColor($Label, 0x0000ff) $Over = 1 EndIf Case Else If $Over And (@SEC <> $SEC) Then GUICtrlSetFont($Label, 8.5) GUICtrlSetColor($Label, 0x000000) $Over = 0 $SEC = @SEC ElseIf Not $Over And ($SEC <> @SEC) Then GUICtrlSetFont($Label, -1, -1, 4) GUICtrlSetColor($Label, 0x0000ff) $Over = 1 $SEC = @SEC EndIf EndSwitch WEnd close() EndIf Init(); Start all the fun stuff :) Func Init() _GDIPlus_Startup() Local $hwnd = GUICreate("Black Hole", 300, 300, -1, -1, $WS_POPUP, $WS_EX_ACCEPTFILES, GUICreate("ghost"));$WS_EX_TOPMOST Local $Pic = GUICtrlCreatePic("", 0, 0, 400, 400, -1, $GUI_WS_EX_PARENTDRAG); only for enable dragging of the gui GUICtrlSetState($Pic, $GUI_DROPACCEPTED) GUISetBkColor(0x000000, $hwnd) $Img = CreateImg($hwnd, $Img, 0.50); Create the magic image If IsObj($ImgMgc) Then $ImgMgc.Convert($Img, "-implode", "-15", $Img); Give the image a lense effect EndIf GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES_FUNC") Local $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) Local $bitmap = _GDIPlus_BitmapCreateFromGraphics(300, 300, $graphics) Local $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) Local $Pos = WinGetPos($hwnd) Local $TmpPos = $Pos Local $image = _GDIPlus_ImageLoadFromFile($Img) Local $matrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($matrix, 150, 150);True) _GDIPlus_GraphicsSetTransform($backbuffer, $matrix) _GDIPlus_GraphicsDrawImageRect($backbuffer, $image, -150, -150, 300, 300);-150,-150) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, 300, 300) setTrans($hwnd); make the GUI circular GUISetState() Local $Msg, $Files, $SEC = @SEC While 1 Sleep(20) $Msg = GUIGetMsg($hwnd) Switch $Msg Case $GUI_EVENT_DROPPED $Files = '' For $i = 0 To UBound($gaDropFiles) - 1 $Files &= $gaDropFiles[$i] & @CR Next Switch MsgBox(4 + 48 + 256 + 262144, "Advisory!", "Are you sure you wish to permanantly delete these files?" & @CRLF & $Files) Case 6 For $i = 0 To UBound($gaDropFiles) - 1 _SecureFileDelete($gaDropFiles[$i], False, True, False) Next EndSwitch Case $Pic $Pos = WinGetPos($hwnd) If ($Pos[0] <> $TmpPos[0]) Or ($Pos[1] <> $TmpPos[1]) Then; check if GUI was relocated GUISetState(@SW_HIDE) _GDIPlus_BitmapDispose($image) Sleep(100);for some reason the GUI is still caught in the image if we don't wait :/ CreateImg($hwnd, $Img, 0.50) If IsObj($ImgMgc) Then Switch Random(1,2,1) Case 1 $ImgMgc.Convert($Img, "-implode", "-1", "-swirl", "1000", $Img) Case 2 $ImgMgc.Convert($Img, "-implode", "-15", $Img) EndSwitch EndIf $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) $bitmap = _GDIPlus_BitmapCreateFromGraphics(300, 300, $graphics) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) $image = _GDIPlus_ImageLoadFromFile($Img) $matrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($matrix, 150, 150);True) GUISetState(@SW_SHOW) $Pos = WinGetPos($hwnd) $TmpPos = $Pos EndIf EndSwitch If @SEC <> $SEC Then ;_GDIPlus_MatrixRotate($matrix, -0.01); uncomment to slowley rotate the image at an intervail _GDIPlus_GraphicsSetTransform($backbuffer, $matrix) _GDIPlus_GraphicsDrawImageRect($backbuffer, $image, -150, -150, 300, 300);-150,-150) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, 300, 300) $SEC = @SEC EndIf WEnd close() EndFunc ;==>Init Func CreateImg($hGui, $ImgPath, $fArea); Thanks UEZ! If Not IsHWnd($hGui) Then Exit MsgBox(0, "", "error") EndIf Local $iWidth = 300 Local $iHeight = 300 Local $iSize = 300 Local $hBmp = _ScreenCapture_CaptureWnd("", $hGui, 0, 0, $iWidth, $iHeight, False) Local $hBGBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) Local $hBrush = _CreateBrush($iSize, $fArea) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBGBitmap) _GDIPlus_GraphicsFillRect($hContext, 0, 0, $iSize, $iSize, $hBrush) _GDIPlus_ImageSaveToFile($hBGBitmap, $ImgPath) _WinAPI_DeleteObject($hBmp) _GDIPlus_BitmapDispose($hBGBitmap) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBGBitmap) Return $ImgPath EndFunc ;==>CreateImg Func _CreateBrush($iSize, $fArea) Local $fTmp = $iSize * $fArea * 1.20 Local $hPath = _GDIPlus_PathCreate() ;_GDIPlus_PathAddEllipse($hPath, $fTmp, $fTmp, $iSize - $fTmp * 2, $iSize - $fTmp * 2) _GDIPlus_PathAddEllipse($hPath, $fTmp - 25, $fTmp - 25, -10, -10) Local $hBrush = _GDIPlus_PathBrushCreateFromPath($hPath) _GDIPlus_PathBrushSetCenterColor($hBrush, 0xFF000000) Local $aColor[2] = [1, 0x00000000] _GDIPlus_PathBrushSetSurroundColorsWithCount($hBrush, $aColor) _GDIPlus_PathBrushSetFocusScales($hBrush, 0.5, 0.5) _GDIPlus_PathBrushSetGammaCorrection($hBrush, True) _GDIPlus_PathDispose($hPath) Return $hBrush EndFunc ;==>_CreateBrush Func WM_DROPFILES_FUNC($hwnd, $msgID, $wParam, $lParam) Local $nSize, $pFileName Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255) For $i = 0 To $nAmt[0] - 1 $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $nSize = $nSize[0] + 1 $pFileName = DllStructCreate("char[" & $nSize & "]") DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize) ReDim $gaDropFiles[$i + 1] $gaDropFiles[$i] = DllStructGetData($pFileName, 1) $pFileName = 0 Next Binary($hwnd + $msgID + $lParam);just to prevent unused var errors -_- EndFunc ;==>WM_DROPFILES_FUNC Func close() _GDIPlus_Shutdown() Exit EndFunc ;==>close Func setTrans($hW) Local $x, $Startx, $Endx $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460) For $y = 0 To 300 $x = Abs((150 * 150 - (150 - $y) * (150 - $y)) ^ 0.5) $Startx = 150 + $x $Endx = 300 addRegion($Startx, $y, $Endx, $y) $Startx = 0 $Endx = 150 - $x addRegion($Startx, $y, $Endx, $y) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hW, "long", $aM_Mask[0], "int", 1) EndFunc ;==>setTrans Func addRegion($a, $b, $c, $d) Local $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $a, "long", $b, "long", $c + 1, "long", $d + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3) EndFunc ;==>addRegion Download Black Hole Desktop Toy.htm Download Since I'm not exactly a pro at this GDI stuff, the script is a little buggy, in example, I have the GUI redrawn every second since when another window is hovered above it it will be painted black and will look ugly. Updated: I removed my fail attempt at creating a portable version of the ImageMagick COM interface, if you don't have it, it'll advise you as to where you can get it. Here is a version that does not need the ImageMagick COM object thanks to UEZ. Although, when dropping files into it, it takes about 20-30 seconds to respond which is a fault on my side due to my scripting abilities... You will need the UDF & the UDF. #include <GDIP.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <SD.au3>; Secure Delete UDF HotKeySet("{ESC}", "_Exit") _GDIPlus_Startup() Global $aM_Mask Global $iWidth = 300 Global $iHeight = 300 Global $iSize = 301 Global $fArea = 0.25 Global $gaDropFiles[1] Global $hGui = GUICreate("Black Hole", $iWidth, $iHeight, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW,$WS_EX_ACCEPTFILES)) GUISetBkColor(0xABCDEF) Local $Pic = GUICtrlCreatePic("", 0, 0, 400, 400, -1, $GUI_WS_EX_PARENTDRAG); only for enable dragging of the gui GUICtrlSetState($Pic, $GUI_DROPACCEPTED) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES_FUNC") setTrans($hGui) _WinAPI_SetLayeredWindowAttributes($hGui, 0xABCDEF, 255, 0x1) Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) Global $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) Global $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer) _GDIPlus_GraphicsSetSmoothingMode($hGfxBuffer, 2) _GDIPlus_GraphicsClear($hGfxBuffer, 0xFFABCDEF) Global $hBrush = _CreateBrush(300, $fArea) GUIRegisterMsg($WM_PAINT, "WM_PAINT") GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND") ;_WinAPI_ShowCursor(False) GUISetState() Global $Msg, $Files While 1 _Draw() Sleep(100) $Msg = GUIGetMsg($hGui) Switch $Msg Case $GUI_EVENT_DROPPED $Files = '' For $i = 0 To UBound($gaDropFiles) - 1 $Files &= $gaDropFiles[$i] & @CR Next Switch MsgBox(4 + 48 + 256 + 262144, "Advisory!", "Are you sure you wish to permanantly delete these files?" & @CRLF & $Files) Case 6 For $i = 0 To UBound($gaDropFiles) - 1 _SecureFileDelete($gaDropFiles[$i], False, True, False) Next EndSwitch EndSwitch WEnd Func _Draw() _GDIPlus_GraphicsClear($hGfxBuffer, 0xFFABCDEF) ; Local $hBmp = _ScreenCapture_Capture("", $aPos[0], $aPos[1], $aPos[0] + $iSize, $aPos[1] + $iSize, False) Local $hBmp = _ScreenCapture_CaptureWnd("",$hGui,0,0) Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) _WinAPI_DeleteObject($hBmp) Local $hTexture = _GDIPlus_TextureCreate($hBitmap) _GDIPlus_BitmapDispose($hBitmap) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iSize, $iSize, $hGraphics) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $fScale = 1 Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_GraphicsFillEllipse($hContext, 0, 0, $iSize, $iSize, $hTexture) _GDIPlus_GraphicsSetSmoothingMode($hContext, 2) Local $fTmp = 0 For $i = 2 To Floor($iSize / 2) $fTmp = $i * ($iSize * $fArea) / ($iSize / 2) * 2.6 $fScale = (($iSize - $fTmp) / ($iSize - $i * 2)) _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0) _GDIPlus_MatrixTranslate($hMatrix, $iSize / 2, $iSize / 2) _GDIPlus_MatrixScale($hMatrix, $fScale, $fScale) _GDIPlus_MatrixRotate($hMatrix, $fScale) _GDIPlus_MatrixTranslate($hMatrix, -$iSize / 2, -$iSize / 2) _GDIPlus_GraphicsSetTransform($hContext, $hMatrix) _GDIPlus_GraphicsFillEllipse($hContext, $i, $i, $iSize - $i * 2, $iSize - $i * 2, $hTexture) Next _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0) _GDIPlus_GraphicsSetTransform($hContext, $hMatrix) _GDIPlus_GraphicsFillRect($hContext, 0, 0, $iSize, $iSize, $hBrush) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_BrushDispose($hTexture) _GDIPlus_GraphicsDrawImage($hGfxBuffer, $hBitmap, -1, -1) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) EndFunc ;==>_Draw Func WM_DROPFILES_FUNC($hwnd, $msgID, $wParam, $lParam) Local $nSize, $pFileName Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255) For $i = 0 To $nAmt[0] - 1 $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $nSize = $nSize[0] + 1 $pFileName = DllStructCreate("char[" & $nSize & "]") DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize) ReDim $gaDropFiles[$i + 1] $gaDropFiles[$i] = DllStructGetData($pFileName, 1) $pFileName = 0 Next Binary($hwnd + $msgID + $lParam);just to prevent unused var errors -_- EndFunc ;==>WM_DROPFILES_FUNC Func _CreateBrush($iSize, $fArea) Local $fTmp = $iSize * $fArea * 1.20 Local $hPath = _GDIPlus_PathCreate() _GDIPlus_PathAddEllipse($hPath, $fTmp, $fTmp, $iSize - $fTmp * 2, $iSize - $fTmp * 2) Local $hBrush = _GDIPlus_PathBrushCreateFromPath($hPath) _GDIPlus_PathBrushSetCenterColor($hBrush, 0xFF000000) Local $aColor[2] = [1, 0x00000000] _GDIPlus_PathBrushSetSurroundColorsWithCount($hBrush, $aColor) _GDIPlus_PathBrushSetFocusScales($hBrush, 0.5, 0.5) _GDIPlus_PathBrushSetGammaCorrection($hBrush, True) _GDIPlus_PathDispose($hPath) Return $hBrush EndFunc ;==>_CreateBrush Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) Return $GUI_RUNDEFMSG EndFunc ;==>WM_PAINT Func WM_ERASEBKGND($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) Return True EndFunc ;==>WM_ERASEBKGND Func setTrans($hW) Local $x, $Startx, $Endx $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460) For $y = 0 To 300 $x = Abs((150 * 150 - (150 - $y) * (150 - $y)) ^ 0.5) $Startx = 150 + $x $Endx = 300 addRegion($Startx, $y, $Endx, $y) $Startx = 0 $Endx = 150 - $x addRegion($Startx, $y, $Endx, $y) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hW, "long", $aM_Mask[0], "int", 1) EndFunc ;==>setTrans Func addRegion($a, $b, $c, $d) Local $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $a, "long", $b, "long", $c + 1, "long", $d + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3) EndFunc ;==>addRegion Func _Exit() ;_WinAPI_ShowCursor(True) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfxBuffer) _GDIPlus_BitmapDispose($hBmpBuffer) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit1 point -
I have to agree with the points made by Tiem above. I personally use 3 different file listing functions that I wrote a few years ago. The first is is a slightly modified version of AutoIts built in _FileListToArray which I use when I only need to search a single folder. The second is a recursive version that only uses a simple match pattern e.g. *.txt The third is similar to RecFileListToArray in that it allows very complex searches based on a number of parameters using positive patterns as the first match and then doing a second test against another set of parameters to check if it should be excluded. The point is that there is not one solution and speed is not always the primary reason for choosing other things such as convenience are more important. Another area where prior knowledge of your data can be useful is in choosing which sorting algorithm to use. Most people use the Quick sort algorithm all the time and where you have no prior knowled it's probaly the best choice. But for example if you are adding a few values to an already sorted list then an insertion sort is much quicker algorithm to resort the list. Several posters have commented that some functions user fewer lines of code than another with the implication that fewer lines of code is better. This is a fallacy, it's using the correct logic that is important. Having a longer function with serperate sections of code to handle different situation rather than trying to cram all the logic into only a few lines is usually quicker.1 point
-
RunAsWait not seeing WinWait
carlosrapa reacted to BrewManNH for a topic
If you want any other commands to work on the program that you're running, you'd be much better off using RunAs instead. You're using ProcessWaitClose after the Control* commands so it won't go past that point until that program has closed. You have no need to to use RunAsWait anyways because WinWait will pause the script until that window exists, ProcessWaitClose will also pause it until the process doesn't exist.1 point -
address, This produces as many "blocks" as there are lines in the file and inserts random non-repeating lines from the file into the blocks at random: #include <File.au3> #include <Array.au3> Global $aArray, $sFile = @ScriptDir & "files.txt" ; Read the file into the array _FileReadToArray($sFile, $aArray) $iCount = 0 $iMax_Index = $aArray[0]; How many lines are in the file - this is set when we read the file ; Now we run through the loop For $i = 1 To $aArray[0] ; Choose a random index If $aArray[0] = 1 Then ; We need this as Random(1, 1) returns 0 $iIndex = 1 Else $iIndex = Random(1, $aArray[0], 1) EndIf ; Write the static lines ConsoleWrite("Static 1" & @CRLF) ; Line 1 ConsoleWrite("Static 2" & @CRLF) ; Line 2 ; Write the line randomly If Random() > 0.5 Then ConsoleWrite($aArray[$iIndex] & @CRLF) ; Line 3 is a random line ; Delete that line from the array _ArrayDelete($aArray, $iIndex) ; Reduce the count $aArray[0] -= 1 EndIf ; Write the final static line ConsoleWrite("Static 4" & @CRLF & @CRLF) ; Line 4 Next Are we getting close yet? M231 point
-
New email notification
enaiman reacted to somdcomputerguy for a topic
This 'new email notifier' will run an executable on event.. PopTray Mail Notifier.1 point -
Radio and Checkbox Validation
carlosrapa reacted to Melba23 for a topic
carlosrapa, Put the returned ControlIDs in each group into an array and then loop through it to check if one of them is checked. M231 point -
ComboBox Max List Items?
carlosrapa reacted to Melba23 for a topic
carlosrapa, Here you go - a bit of an improvement: #include <GUIConstantsEx.au3> #include <GUIComboBox.au3> $hGUI = GUICreate("Test", 500, 500) ; Create combo empty $cmbBranch = GUICtrlCreateCombo("", 170, 40, 160, 25) ; Now add data GUICtrlSetData(-1, "000 - St. Louis/HQ|002 - East Peoria|003 - Sikeston|004 - Decatur|005 - Columbia|006 - LaSalle|008 - Mt. Vernon|009 - Hannibal|011 - CAT/East Peoria|012 - CAT/Mossville|014 - CAT/Joliet|016 - CAT/Aurora|017 - CAT/Decatur|031 - Memphis|033 - Tupelo|034 - Jackson|035 - Jonesboro|037 - Little Rock|038 - Springdale|039 - Ft. Smith|040 - Kansas City|041 - Springfield|042 - Joplin|043 - Wichita|044 - St. Joseph|060 - Indianapolis|061 - Ft. Wayne|062 - Lafayette|063 - Muncie|065 - Terre Haute|069 - Columbus|Feitek|Global") ; Now set the edit text - this way it is not one of the possible selections _GUICtrlComboBox_SetEditText($cmbBranch, "Please Select Your Branch") ; And now limit the number of items to show to 15 GUICtrlSendMsg($cmbBranch, $CB_SETMINVISIBLE, 15, 0) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndNote that $CB_SETMINVISIBLE actually sets the MAX visible - blame Bill Gates, not me! Please ask if you have any questions. M231 point