Leaderboard
Popular Content
Showing content with the highest reputation on 09/08/2015 in all areas
-
View the Project at GitHub: https://github.com/BetaLeaf/False-Positive-Reporter Download False Positive Reporter: https://github.com/BetaLeaf/False-Positive-Reporter/releases Wiki: https://github.com/BetaLeaf/False-Positive-Reporter/wiki Thanks Jos for your Example Script involving Emailing attachments. Thanks JohnOne for helping me figure out the Run as Non-Admin Issue. Thanks Chiron at http://www.techsupportalert.com/content/how-report-malware-or-false-positives-multiple-antivirus-vendors.htm for your wonderful post. Disclaimer: This script is meant for submitting false positives to AntiVirus Vendors so you can deploy your scripts faster. I am not responsible for your misuse of this script.1 point
-
Process UDF, Get both the output & the exit code!
user4157124 reacted to TheDcoder for a topic
Hello Everyone , Are you tired of searching the forum for getting both the exit code & the stdout output? Then you are in the right place! With this UDF you can get the both output & exit code of the command or the console app! Or you can get the exit code of another process without having to use RunWait... Features: 1. Simple & Lightweight (15 KB) 2. Detailed comments & description 3. Flexible functions with many optional parameters A BIG THANKS TO PsaltyDS for the functions! 2 of the (main) functions in the UDF are his work List of functions: Downloads: Grab the latest (in development) code from GitHub Hope it may help you, TD P.S Icon made by Freepik from www.flaticon.com, Modified by TheDcoder1 point -
StringRegExpReplace Help - Input string validation
OhBobSaget reacted to iamtheky for a topic
0 should be invalid1 point -
StringRegExpReplace Help - Input string validation
OhBobSaget reacted to kylomas for a topic
BS, Ranges is just test data....it's the SRE that is important.1 point -
Please wait at least 24 hours before bumping your posts. If the UDFs for FF and Chrome don't have those functions, then you're going to have to create them yourself or post in the threads for those UDFs. Or you could try this UDF to see if it can help.1 point
-
Number Puzzle
czardas reacted to jvanegmond for a topic
The problem with testing every case is that you should specify expected results manually. If you use an algorithm to generate the expected results, what are you really testing? The "code under test" or the "test implementation"? As for run-time, you seriously underestimate the speed of your computer. On my development machine, I regularly run 10,000s different and complex unit tests in minutes. The point is that they are simple and fast to execute. How to do that is for another time.1 point -
Help getting drive letter from an Arc Path?
argumentum reacted to Danyfirex for a topic
it took me more about 1200000 milisegundos ;Danyfirex 06/09/2015 #include <Array.au3> #include <WinAPI.au3> Opt("MustDeclareVars", 1) Global Const $DIRECTORY_QUERY = 0x0001 Global Const $DIRECTORY_TRAVERSE = 0x0002 Global Const $sTagUNICODESTRING = "USHORT Length;USHORT MaximumLength;PTR Buffer;" Global Const $sTagOBJECT_ATTRIBUTES = "ULONG Length;HANDLE RootDirectory;PTR ObjectName;ULONG Attributes;PTR SecurityDescriptor;PTR SecurityQualityOfService" Local $aSubObject = 0 Local $aObjects = _GetObjects() _ArrayDisplay($aObjects, "\", Default, Default, Default, "Name|Type|SymLink") If IsArray($aObjects) Then For $i = 0 To UBound($aObjects) - 1 If $aObjects[$i][1] = "Directory" Then $aSubObject = _GetObjects($aObjects[$i][0]) If IsArray($aSubObject) Then _ArrayDisplay($aSubObject, $aObjects[$i][0], Default, Default, Default, "Name|Type|SymLink") EndIf EndIf Next EndIf Func _GetObjects($sSource = "\") If $sSource <> "\" Then $sSource = "\" & $sSource Local $tNameSource = _tName($sSource) Local $tUnicodeString = _RtlInitUnicodeString($tNameSource) Local $pUnicodeString = DllStructGetPtr($tUnicodeString) Local $tObject_Attributes = _InitializeObjectAttributes($pUnicodeString) Local $pObject_Attributes = DllStructGetPtr($tObject_Attributes) Local $hDirectory = _NtOpenDirectoryObject($pObject_Attributes, BitOR($DIRECTORY_TRAVERSE, $DIRECTORY_QUERY)) Local $tData = 0 Local $tName = 0 Local $tType = 0 Local $index = 0 Local $bytes = 0 Local $tBuffer = 0 Local $aArcName[0] Local $taName = 0 Local $tStr = 0 Local $tAttr = 0 Local $hLink = 0 Local $taTarget = 0 Local $tTarget = 0 Local $tSTarget = 0 $tBuffer = DllStructCreate("byte Data[32767]") Local $aRet = DllCall("Ntdll.dll", "LONG", "NtQueryDirectoryObject", "HANDLE", $hDirectory, "ptr", DllStructGetPtr($tBuffer), "ULONG", 32767, "BOOL", False, "BOOL", True, "ULONG*", 0, "ULONG*", 0) If @error Or $aRet[0] < 0 Then Return $index = $aRet[6] $bytes = $aRet[7] ConsoleWrite("!index: " & $index & " $bytes: " & $bytes & @CRLF) For $i = 0 To $index - 1 $tData = DllStructCreate($sTagUNICODESTRING & $sTagUNICODESTRING, DllStructGetPtr($tBuffer) + ($i * 16)) $tName = DllStructCreate("wchar wNameString[" & DllStructGetData($tData, 1) & "]", DllStructGetData($tData, 3)) $tType = DllStructCreate("wChar wTypeString[" & DllStructGetData($tData, 4) & "]", DllStructGetData($tData, 6)) $taName = _tName($tName.wNameString) $tStr = _RtlInitUnicodeString($taName) $tAttr = _InitializeObjectAttributes(DllStructGetPtr($tStr), 0, $hDirectory) $hLink = _NtOpenSymbolicLinkObject(DllStructGetPtr($tAttr), $GENERIC_READ) ConsoleWrite("+$hLink: " & $hLink & @CRLF) $taTarget = _tName("") $tTarget = _RtlInitUnicodeString($taTarget) $tTarget.MaximumLength = 512 _NtQuerySymbolicLinkObject($hLink, $tTarget) $tSTarget = DllStructCreate("wchar wString[" & DllStructGetData($tTarget, 1) & "]", DllStructGetData($tTarget, 3)) ReDim $aArcName[UBound($aArcName) + 1][3] $aArcName[UBound($aArcName) - 1][0] = $tName.wNameString $aArcName[UBound($aArcName) - 1][1] = $tType.wTypeString $aArcName[UBound($aArcName) - 1][2] = (IsDllStruct($tSTarget) = 1) ? $tSTarget.wString : "" ;~ ConsoleWrite(">" & $i + 1 & @TAB & $tName.wNameString & @TAB & $tType.wTypeString & @TAB & $tSTarget.wString & @CRLF) $tType = 0 $tName = 0 $tData = 0 $tSTarget = 0 _WinAPI_CloseHandle($hLink) Next Return $aArcName EndFunc ;==>_GetObjects Func _RtlInitUnicodeString($tSourceString) Local $tUnicodeString = DllStructCreate($sTagUNICODESTRING) DllCall("Ntdll.dll", "NONE", "RtlInitUnicodeString", "struct*", $tUnicodeString, "struct*", $tSourceString) If @error Then SetError(@error, 0, 0) Return $tUnicodeString EndFunc ;==>_RtlInitUnicodeString Func _tName($String) Local $t = DllStructCreate("wchar String[512]") DllStructSetData($t, 1, $String) Return $t EndFunc ;==>_tName Func _InitializeObjectAttributes($pObjectName, $ulAttributes = 0, $hRootDirectory = Null, $pSecurityDescriptor = Null) Local $tObject_Attributes = DllStructCreate($sTagOBJECT_ATTRIBUTES) DllStructSetData($tObject_Attributes, 1, DllStructGetSize($tObject_Attributes)) DllStructSetData($tObject_Attributes, 2, $hRootDirectory) DllStructSetData($tObject_Attributes, 3, $pObjectName) Return $tObject_Attributes EndFunc ;==>_InitializeObjectAttributes Func _NtQuerySymbolicLinkObject($hLinkHandle, $tLinkTarget) Local $aRet = DllCall("Ntdll.dll", "LONG", "NtQuerySymbolicLinkObject", "HANDLE", $hLinkHandle, "struct*", $tLinkTarget, "ULONG*", 0) If @error Then SetError(@error, 0, 0) If $aRet[0] <> 0 Then SetError(1, 0, 0) EndFunc ;==>_NtQuerySymbolicLinkObject Func _NtOpenDirectoryObject($pObjectAttr, $AccessMask) Local $aRet = DllCall("Ntdll.dll", "LONG", "NtOpenDirectoryObject", "HANDLE*", 0, "ULONG", $AccessMask, "PTR", $pObjectAttr) If @error Then SetError(@error, 0, 0) If $aRet[0] < 0 Or $aRet[1] = 0 Then SetError(1, 0, 0) Return $aRet[1] EndFunc ;==>_NtOpenDirectoryObject ;~ Retur hLink Func _NtOpenSymbolicLinkObject($pObjectAttr, $AccessMask) Local $aRet = DllCall("Ntdll.dll", "LONG", "NtOpenSymbolicLinkObject", "HANDLE*", 0, "ULONG", $AccessMask, "PTR", $pObjectAttr) If @error Then Return SetError(@error, 0, 0) If $aRet[0] < 0 Or $aRet[1] = 0 Then Return SetError(1, 0, 0) Return $aRet[1] EndFunc ;==>_NtOpenSymbolicLinkObject Saludos1 point -
mmm I'm free right now so. I'll wanna eat something first. but I'll back in about 900000 milisegundos with the code I think. Saludos1 point
-
my first script with ie.au3 #pragma compile(AutoItExecuteAllowed, True) #include <IE.au3> #include <MsgBoxConstants.au3> Local $Filepathtosend = @ScriptFullPath If StringInStr($CmdLineRaw, "[filetosend]") > 0 Then $Filepathtosend = StringSplit($CmdLineRaw, "[filetosend]", 1) If @error Then Exit Local $hWnd = WinWait("[CLASS:#32770]", "", 1000) WinActivate($hWnd) WinWaitActive($hWnd) Sleep(500) Send($Filepathtosend[2] & "{TAB}{ENTER}") Exit EndIf Local $oIE = _IECreate("http://ose.demo.screenlyapp.com/") _IELoadWait($oIE) Local $oDiv = _IEGetObjById($oIE, "add-asset-button") _IEAction($oDiv, "click") _IELoadWait($oIE) Sleep(1000) _IELinkClickByText($oIE, "Upload") Local $oDiv = _IEGetObjByName($oIE, "file_upload") ShellExecute(@AutoItExe, " /AutoIt3ExecuteScript " & FileGetShortName(@ScriptFullPath) & " [filetosend]" & $Filepathtosend) _IEAction($oDiv, "click") $oLinks = _IETagNameGetCollection($oIE, "input") For $oLink In $oLinks If String($oLink.type) = "submit" And String($oLink.value) = "Save" Then _IEAction($oLink, "click") ExitLoop EndIf Next1 point
-
You should look at the doc open udf page and look at what error 1 means1 point
-
Hobbyist, The dynamic width checking code: #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <File.au3> #include <Array.au3> Local $aLog, $sFile = @ScriptDir & "\test data.csv" _FileReadToArray($sFile, $aLog, $FRTA_NOCOUNT, ",") ;_ArrayDisplay($aLog) $hGUI = GUICreate("Test", 500, 500) $cLV = GUICtrlCreateListView("", 10, 10, 400, 200) _GUICtrlListView_AddColumn($cLV, "Column 0", 90) _GUICtrlListView_AddColumn($cLV, "Column 1", 90) _GUICtrlListView_AddColumn($cLV, "Column 2", 90) _GUICtrlListView_AddColumn($cLV, "Column 3", 0) _GUICtrlListView_AddColumn($cLV, "Column 4", 90) _GUICtrlListView_AddArray($cLV, $alog) $cFormat = GUICtrlCreateButton("Format", 10, 450, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cFormat ; Array to hold width of widest element in each column Local $aColWidest[UBound($aLog, 2)] ; Loop through columns For $i = 0 To UBound($aLog, 2) - 1 ; Loop through rows For $j = 0 To UBound($aLog, 1) - 1 ; Determine longest element If StringLen($aLog[$j][$i]) > $aColWidest[$i] Then $aColWidest[$i] = StringLen($aLog[$j][$i]) EndIf Next Next ; just for interest _ArrayDisplay($aColWidest, "", Default, 8) ; Now add at 5 additional spaces to each item in each column ; Copy array and delete empty column $aResult = $aLog _ArrayColDelete($aResult, 3) ; Now add correct number of characters to each element For $i = 0 To UBound($aResult, 2) - 1 For $j = 0 To UBound($aResult, 1) - 1 ; Check how many to add $iAdd = $aColWidest[$i] - StringLen($aResult[$j][$i]) + 5 For $k = 1 To $iAdd $aResult[$j][$i] &= "_" Next Next Next ; Display result ConsoleWrite(_ArrayToString($aResult, "")) EndSwitch WEnd M231 point
-
That's pretty awesome that it worked glad to have contributed to helping you! Now go forth and help other where/when you can!1 point
-
Wombat, Look at GUICtrlSetResizing or the Opt equivalent - this allows the GUI to be set to whatever size you require and the controls alter size automatically. Here is an example I posted a while ago which also maintains the same aspect ratio: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; Set resize mode for controls Opt("GUIResizeMode", $GUI_DOCKAUTO) $hGUI = GUICreate("Test", 500, 300, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU)) $cButton_1 = GUICtrlCreateButton("Test 1", 10, 10, 80, 30) $cButton_2 = GUICtrlCreateButton("Test 2", 10, 50, 80, 30) GUISetState() GUIRegisterMsg($WM_SIZING, "_WM_SIZING") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_SIZING($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $wParam If $hWnd = $hGUI Then Local $iNew_H, $iNew_W Local $sRect = DllStructCreate("Int[4]", $lParam) Local $iLeft = DllStructGetData($sRect, 1, 1) Local $iTop = DllStructGetData($sRect, 1, 2) Local $iRight = DllStructGetData($sRect, 1, 3) Local $iBottom = DllStructGetData($sRect, 1, 4) ; Keep the same aspect ratio Switch $wParam ; drag side or corner Case 1, 2 ; $WMSZ_LEFT, $WMSZ_RIGHT $iNew_H = Int(($iRight - $iLeft) * 300 / 500) DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 2) + $iNew_H, 4) Case Else $iNew_W = Int(($iBottom - $iTop) * 500 / 300) DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 1) + $iNew_W, 3) EndSwitch EndIf EndFunc You can even get the font to adjust size as well by using a message handler - but you will have to wait until tomorrow if you want an example of that as I will have to strip it out of another script. M231 point
-
SciTE4AutoIt3 is Jos' baby, up to Jos really.1 point
-
As a coder "of a certain age" who uses higher DPI (as is downright necessary on higher-res LCD's), I feel the need to point out that the ratio returned by Phillip123Adams' original function does not necessarily have to be used in a reductionist fashion. By concentrating on reducing the font sizes (effectively punishing the users who, perhaps with good reason, changed their settings) you're forcing them to adapt to Lilliputian standards. Thus, the same ratio may be applied instead to the creation of the controls themselves (leaving the font sizes alone), which simply results in the "expected" behaviour of an application under higher-DPI - de facto "inflating" the GUI, which keeps everyone happy. Basically, this amounts to multiplying everything by the ratio (and I mean everything) - for example... #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Global Const $DPI = _GetDPI() ; Phillip123Adams simplified to only return the ratio _Main() Func _Main() Local $lWidth = 300, $lHeight = 150 Local $Form = GUICreate("DPI Test", $lWidth * $DPI, $lHeight * $DPI, -1, -1) GUISetFont(9, 400, 0, "Segoe UI") ; The '9pt' size is merely reference constant - the true size is determined by the Window's environment itself GUICtrlCreateLabel("Miss not, Dear Coder, the Forest for the Trees...", (($lWidth / 2) - 125) * $DPI, 53 * $DPI, 250 * $DPI, 18 * $DPI, BitOR($SS_CENTER, $SS_SUNKEN)) Local $Button_OK = GUICtrlCreateButton("Ok", ($lWidth - 185) * $DPI, ($lHeight - 40) * $DPI, 75 * $DPI, 25 * $DPI) Local $Button_Cancel = GUICtrlCreateButton("Cancel", ($lWidth - 95) * $DPI, ($lHeight - 40) * $DPI, 75 * $DPI, 25 * $DPI) GUISetState(@SW_SHOW, $Form) While True Switch GUIGetMsg() Case $Button_OK ContinueCase Case $Button_Cancel, $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($Form) EndFunc Now, I'm the first to admit that supporting this paradigm requires more effort to maintain (almost too much effort, if you attempt to retrofit an already mature project) - so it's best used when starting new projects which are meant to be at play in the wild, where many users will have many setups which you can't control or predict. The long-term benefit being, of course, that all users are happy - those who use normal DPI simply have a lot of superfluous multiplcation-by-1 processing - but take the same code and apply it to a user with DPI of 1.25 and the benefits become clear (at least to those with eyes not quite as strong as their stubborn resolves). In the above example I intentionally made the definitions more complex than merely using constants just to show how messy it can get - but it's worth it in the long run. Note that occasionally you can run into circumstances where the result of sending a floating-point (the result of ratio multiplication) to a control can lead to some things being "off" by a pixel or two... which is why I usually define a couple of offset constants just for fun (to add or subtract as needed)... Global Const $Offset = Int($DPI = 1), $cOffset = BitXOR($Offset, 1) ; Offset/Counter-Offset for DPI pixel irregularities ...for instance, sometimes a DPI-aware single-pixel counter-offset needs to be applied after the initial DPI scaling computation, as in: (16 * $DPI) - $cOffset ...but that's merely semantics. Anyway, this is just a suggestion - most high-DPI users find it offensive when lazy coders neglect this side of GUI design and assume that everyone likes to live in the same boring cookie-cutter world as they do. Subtle attention to detail like this will win you more users in the long run, than would efforts spent on less-functional ephemera like fancy toolbars and fluff.1 point
-
You need something like this. I use FileCopy for easier testing. Replace it with FileMove if it works for you. #include <File.au3> Global $sFileFrom = "C:temptest.txt" Global $sFileTo = "C:temptest.txt" $vResult = _SecureFileMove($sFileFrom, $sFileTo) If $vResult == 0 Then ; 0 = error MsgBox(0, "", "Error moving file to: " & $sFileTo) Else ; on success the name of the moved file is returned MsgBox(0, "", "File successfully moved to: " & $vResult) EndIf Exit Func _SecureFileMove($sFileFrom, $sFileTo) Local $iIndex = 0, $sFileTemp, $iResult Local $sDrive, $sDir, $sFName, $sExt If FileExists($sFileTo) Then _PathSplit($sFileTo, $sDrive, $sDir, $sFName, $sExt) While 1 $iIndex = $iIndex + 1 $sFileTemp = $sDrive & $sDir & $sFName & "_" & $iIndex & $sExt If Not FileExists($sFileTemp) Then ExitLoop WEnd $sFileTo = $sFileTemp EndIf $iResult = FileCopy($sFileFrom, $sFileTo) If $iResult = 1 Then Return $sFileTo Return 0 EndFunc ;==>_SecureFileMove1 point
-
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00080000);fade-in GUISetState() DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00090000);fade-out DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040001);slide in from left DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050002);slide out to left DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040002);slide in from right DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050001);slide out to right DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040004);slide-in from top DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050008);slide-out to top DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040008);slide-in from bottom DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050004);slide-out to bottom DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040005);diag slide-in from Top-left DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x0005000a);diag slide-out to Top-left DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040006);diag slide-in from Top-Right DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050009);diag slide-out to Top-Right DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040009);diag slide-in from Bottom-left DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050006);diag slide-out to Bottom-left DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x0004000a);diag slide-in from Bottom-right DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050005);diag slide-out to Bottom-right DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040010);explode DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050010);implode1 point