
twbradio
Active Members-
Posts
57 -
Joined
-
Last visited
About twbradio
- Birthday 07/22/1968
Profile Information
-
Location
Dallas Texas
twbradio's Achievements

Wayfarer (2/7)
0
Reputation
-
McAfee blocking AutoIt3 today
twbradio replied to Gigglestick's topic in AutoIt General Help and Support
Just for personal information ... could you let me know what version of AutoIT the scripts were compiled under. Sometimes these false positives only detect certain engine versions. -
That did it ... I did go ahead and change dwMimeFlags to a 1 to allow pwzUrl to be a file name and dropped the http://, but other than that it worked right out of the box. Thank you so much. Final code I tested with: #include <WinAPI.au3> $sFile = FileOpenDialog ( "Test File", @ScriptDir, "All (*.*)" ) $aCall = DllCall("urlmon.dll", "long", "FindMimeFromData", _ "ptr", 0, _ "wstr", $sFile, _ "ptr", 0, _ "DWORD", 0, _ "ptr", 0, _ "DWORD", 1, _ "ptr*", 0, _ "DWORD", 0) If @error Then ; kind of not good. Do something here Else $sMime = DllStructGetData(DllStructCreate("wchar[" & _WinAPI_StringLenW($aCall[7]) & "]", $aCall[7]), 1) MsgBox(4096, "", "File = " & $sFile & @CRLF & "MIME type = " & $sMime & @CRLF) EndIf
-
Ok my friends ... It has been a long time since I asked for your help, but I need it once more. I need to use the FindMimeFromData call from urlmon.dll. Unfortunately, this is for a work project, so some of the "free for personal use" options are not available to me (TrIDLib for instance). The core issue is trying to detect files that have been corrupted by a specific virus family. The standard detection method includes checking the mime type against the file extension. The URL for the .net documentation for this is at: http://msdn.microsoft.com/en-us/library/ms775107(VS.85).aspx. One person that sucessfully got this to work in C# can be found in the thread located here: http://forums.asp.net/t/1292209.aspx. Below is the test code I am working with (using 3.3.10 for the Null function) ... any help or comments would be greatly appreciated: $DLL = DllOpen("urlmon.dll") $file = FileOpenDialog ( "Test File", @ScriptDir, "All (*.*)" ) $filedata = FileRead ($file) $filelen = StringLen($filedata) If $filelen > 4096 Then $filedata = FileRead ($file, 4096) $filelen = 4096 EndIf Dim $Null Dim $MimeOut $Null = Null ;First call by filename with dwMimeFlags set to 1 (URL as a filename) $Output = DllCall ( $DLL, "int", "FindMimeFromDataW", "BC*", $Null, "wstr", $file, "ptr", $Null, "DWORD", 0, "wstr", $Null, "DWORD", 1, "wstr", $MimeOut, "DWORD", 0) msgbox (0, "", $Output&@tab&$MimeOut) ;Second call using bytes pulled from the file into a "buffer" with a buffer size $Output = DllCall ( $DLL, "int", "FindMimeFromDataW", "BC*", $Null, "wstr", $Null, "ptr", $filedata, "DWORD", $filelen, "wstr", $Null, "DWORD", 0, "wstr", $MimeOut, "DWORD", 0) msgbox (0, "", $Output&@tab&$MimeOut)
-
Select Multiple Folders with Array Output
twbradio posted a topic in AutoIt General Help and Support
OK ... I am sure someone has done this out there ... I am looking for a function that has the user select multiple folders from a treeview type of dialog and then populates the folders that have been selected into an array. The need for this is for a deployment script that allows users to select what additional folders that they would like backed up. Tom Brown -
Get disk number from drive letter
twbradio replied to twbradio's topic in AutoIt General Help and Support
Huge thank you to everyone, I first tried the WMI call which worked on my local system, but did not work when I attempted to run it from my BartPE environment ... Moving to the DLL example, I was able to get exactly the result I wanted. Thank you all so much for pitching in. Thomas Brown -
Get disk number from drive letter
twbradio replied to twbradio's topic in AutoIt General Help and Support
Thanks for the catch on this ... I am looking for the windows physical disk number (similar to what is seen in Disk Management) with the Logical partition name (c:, d: ... ) as the input ... I don't need the partition number or any other data. Tom Brown -
Get disk number from drive letter
twbradio replied to twbradio's topic in AutoIt General Help and Support
Because physical disks can have more than one partiton, this doesn't always equate properly. Thanks you for the reply. Tom -
I have an external program that requires the disk number (0, 1, 2 ... ) and I am looking to wrap it with an AutoIt script. Is there a way to get the disk number from the drive letter of a partition? Tom Brown
-
OK, Treeview one more time - but with an example
twbradio replied to twbradio's topic in AutoIt General Help and Support
Thank you vey much for the response ... I had looked at your post before, but not really dug into the way your routine was working. There are several ideas that I may be able to use in the future; unfortunately, having checked it out, it doesn't seem to work with treeview items created with _GUICtrlTreeViewInsertItem. I inserted the following two lines into your code as a test... _GUICtrlTreeViewInsertItem ($Treeview, "Leaf 1c",$Tree_Parent_Split[1]) below GUISetState() in the main routine msgbox (1, "", $nCtrl&" "&$hItem&" "&$nItem) in the GetChilds function ... just below the call for GetItemID. The output for the _GUICtrlTreeViewInsertItem item returns a ControlID of 0. My challenge is that I need to add items to a treeview, and then know when that item is selected so that I can update an associated display. -
CODE#include <GuiConstants.au3> #include <Array.au3> #Include <GuiTreeView.au3> #include <Date.au3> Opt("GUIOnEventMode", 1) Opt("TRAYICONHIDE", 1) global $test, $tree1, $branch1, $branch2, $leaf1, $leaf2, $leaf3, $leaf4, $leaf5, $leaf6, $count=0 $test = GUICreate("test window", 200, 200 ) GUISetOnEvent ($GUI_EVENT_CLOSE, "exiter") $tree1 = GUICtrlCreateTreeView( 1, 1, 198, 198 ) $branch1 = GUICtrlCreateTreeViewItem ( "Branch 1", $tree1 ) GUICtrlSetOnEvent($branch1, "branch" ) $leaf1 = GUICtrlCreateTreeViewItem ( "Leaf 1a", $branch1 ) GUICtrlSetOnEvent($leaf1, "leafa" ) $leaf2 = GUICtrlCreateTreeViewItem ( "Leaf 1b", $branch1 ) GUICtrlSetOnEvent($leaf2, "leafb" ) $branch2 = GUICtrlCreateTreeViewItem ( "Branch 2", $tree1 ) GUICtrlSetOnEvent($branch2, "branch") $leaf3 = GUICtrlCreateTreeViewItem ( "Leaf 2a", $branch2 ) GUICtrlSetOnEvent($leaf3, "leafa") $leaf4 = GUICtrlCreateTreeViewItem ( "Leaf 2b", $branch2 ) GUISetState (@SW_SHOW) While 1=1 sleep (500) WEnd exit func branch () MsgBox (1, "Parent CID is", _GUICtrlTreeViewGetParentID ($tree1, @GUI_CtrlId)) EndFunc func leafa () MsgBox (1, "Parent CID of leaf typea is", _GUICtrlTreeViewGetParentID ($tree1, @GUI_CtrlId)) EndFunc func leafb () Select Case $count = 0 $leaf5 = _GUICtrlTreeViewInsertItem ($tree1, "Leaf 1c",$branch1, $leaf2) GUICtrlSetOnEvent ( $leaf5, "leafc" ) ;I know this won't work because $leaf5 is a handle and not a control ID GUICtrlSetOnEvent ( $leaf4, "leafb" ) GUICtrlSetOnEvent ( $leaf2, "" ) $count = $count +1 Case $count = 1 $leaf6 = _GUICtrlTreeViewInsertItem ($tree1, "Leaf 1c-1",$leaf5 ) GUICtrlSetOnEvent ( $leaf6, "leafc" ) $count = $count +1 MsgBox (1, "CID of leaf 1c is:", _GUICtrlTreeViewGetParentID ($tree1, $leaf6)) ;this should give me the CID of leaf 1c, but doesn't GUICtrlSetOnEvent ( _GUICtrlTreeViewGetParentID ($tree1, $leaf6), "leafc" ) ;this fails because I do not have a CID for leaf 1c GUICtrlSetOnEvent ( $leaf2, "leafb" ) EndSelect MsgBox (1, "Parent CID of leaf typeb is", _GUICtrlTreeViewGetParentID ($tree1, @GUI_CtrlId)) EndFunc func leafc () msgbox (1, "leaf type c", @GUI_CtrlId) EndFunc func exiter () Exit EndFunc First things first, this is not a real smaple of how I code - it is just a quick throw together for this discussion's sake. I have a problem ... I need to be able to dynamically create treeview items, and then be able to do something with them. I am using On-Event mode due to the number of elements that I am creating for this script (with treeviews, the number of elements gets very large quickly). In addititon, 1300 lines in is not a good place to try to make the change either. In the example script, you can click on just about anything, and something will happen, but, to test the behavior - click on leaf 1b to create leaf 1c and then click on leaf 2b to create leaf 1c-1 and pop up a message box with it's parent's contol ID (leaf 1c). The message box output indicates what I suspected - that the inserted treeview items do not have control ids. This makes trapping any event in which these new items are selected difficult to do. Any ideas are welcome. Tom Brown
-
Help with _GUICtrlTreeViewInsertItem and OnEvent mode
twbradio replied to twbradio's topic in AutoIt GUI Help and Support
Sorry, I was wrong - still could use some help. The function GUICtrlTreeViewInsertItem returns a windows handle and not a Control ID ... is there any way to assign or determine these control IDs? Thomas Brown -
Help with _GUICtrlTreeViewInsertItem and OnEvent mode
twbradio replied to twbradio's topic in AutoIt GUI Help and Support
:"> OK, I am really embarrased now ... I had some strange paradigm stuck in my head that said you could only set an OnEvent during GUI definition, but you can set an OnEvent whenever - so there really is no question or problem. :"> -
I have been working to convert some pretty standard WMI code to work in a script that I am writing, and I have hit a stump because I need to set my Path in the $objConfig.EnviromentVariables line, but can't seem to find a way to pull it off. Any help that can be provided would be appreciated. Tom $SW_NORMAL = 1 dim $array[2] $strComputer = "." $strCommand = "cobackup.exe" $intProcessID = "" $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\"&$strComputer&"\root\cimv2") $objStartup = $objWMIService.Get("Win32_ProcessStartup") $objConfig = $objStartup.SpawnInstance_ $objConfig.ShowWindow = 0 $objConfig.EnviromentVariables = ????? $objProcess = $objWMIService.Get("Win32_Process") $result = $objProcess.Create ($strCommand, "", $objConfig, $intProcessID) msgbox (1, "", $result&" "&$intProcessID )
-
I am having the exact same issue - when dealing with remote computers, every now and then the wmi is broken - and the script freezes indefinately. I am to the point that I am willing to compile the WMI check portion of my script as a seperate executable and run it with the machine name as an argument - if it runs too long or gets hung up, the main program can terminate the process. I just do not have a clean way of getting th results back to my main program yet - however, I would love to have this available in the language so that I do not have to fiddle around with it.