
twbradio
Active Members-
Posts
57 -
Joined
-
Last visited
Everything posted by twbradio
-
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.
-
Updating A Guictrlcreatedate
twbradio replied to twbradio's topic in AutoIt General Help and Support
I took my first programming course in '83 on a TRS 80 model III - mostly, it's just a joke ... but there is a certain amount of nostalga involved as well. Tom -
Updating A Guictrlcreatedate
twbradio replied to twbradio's topic in AutoIt General Help and Support
Thank you very much - this is my first go around with the date control, and for some reason I just couldn't get it right. Tom -
What format should the data be in to properly update a date control - I am making the assumption that the form GUICtrlSetData ($datecontrol, #a valid date#) is the format, but I can't seem to figure out what the language wants for #a valid date#. 20060421 2006/04/21 04/21/2006 I know I'll go " but of course :"> " when I hear the answer - so please be kind Thomas Brown
-
Create a quick launch type toolbar (not IE)
twbradio replied to twbradio's topic in AutoIt GUI Help and Support
I was really looking to make the program dockable ... :-) -
I have an Autoit program that many of the desktop technicians that I work with really like that allows them to run certain admin programs from a floating toolbar with alternate credentials. It also has a search box that we use to look up people in our company directory. They love it so much that they now insist that I make it more convenient by turning it into a start menu toolbar (like the quick launch bar). Any ideas about where to start with this one? Tom Brown
-
OK, here is the correct WMI call for the IE proxy settings Tom #include <Array.au3> $report = "c:\test.txt" $strComputer = "." $objFile = FileOpen ($report, 2) $objWMIService2 = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\"&$strComputer&"\root\CIMV2\Applications\MicrosoftIE") $colIESettings3 = $objWMIService2.ExecQuery ("Select * from MicrosoftIE_LANSettings") For $strIESetting2 in $colIESettings3 FileWrite ( $objFile, "<tr>"&@CRLF&"<td>Auto-Proxy URL:</td>"&@CRLF ) FileWrite ( $objFile, "<td>"&$strIESetting2.AutoConfigURL&"</td>"&@CRLF ) FileWrite ( $objFile, "<td>   </td></tr>"&@CRLF ) FileWrite ( $objFile, "<tr>"&@CRLF&"<td>Auto-Proxy detection mode:</td>"&@CRLF ) FileWrite ( $objFile, "<td>"&$strIESetting2.AutoProxyDetectMode&"</td>"&@CRLF ) FileWrite ( $objFile, "<td>   </td></tr>"&@CRLF ) FileWrite ( $objFile, "<tr>"&@CRLF&"<td>Proxy override excludes:</td>"&@CRLF ) FileWrite ( $objFile, "<td>"&$strIESetting2.ProxyOverride&"</td>"&@CRLF ) FileWrite ( $objFile, "<td>   </td></tr>"&@CRLF ) FileWrite ( $objFile, "<tr>"&@CRLF&"<td>Proxy override settings:</td>"&@CRLF&"<td>" ) $PS2 = StringSplit( $strIESetting2.ProxyServer, ";") _ArrayDelete ( $PS2, 0 ) For $settinG1 in $PS2 FileWrite ( $objFile, $settinG1&"<BR>"&@CRLF) Next FileWrite ( $objFile, "</td></tr>" ) Next FileClose ( $objFile )
-
OK - I see what the VB script is doing, and this looks like a piece of junk code that was never removed, I'll post the working code as soon as I get it flushed out. Thank you all. Tom
-
I almost pulled that bit out since I haddn't massaged it much from the VB to AU3 conversion tool that I ran on the original script - at leat this indicates that if I can ever get the For - IN loop to do anything that I will at least have an error to let me know its working
-
We have an auto script here as well, but the script should still do something - if you put a msgbox inside the for - in loop it never trips. I am working on trimming the VB script into a similar code that does work. Tom
-
I have a piece of code that works OK in VB but is not working in AutoIT and I was wondering if you could give me a hand. Below is a functional code snippet from the larger script that includes the problem code. Perhaps someone that is better at WMI than me can see where the issue is. $report = "c:\test.txt" $strComputer = "." $objFile = FileOpen ($report, 2) $objWMIService2 = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\"&$strComputer&"\root\CIMV2\Applications\MicrosoftIE") $colIESettings2 = $objWMIService2.ExecQuery ("Select * from MicrosoftIE_ConnectionSettings") For $strIESetting in $colIESettings2 FileWrite ( $objFile, "<tr>"&@CRLF&"<td>Autoconfiguration URL:</td>"&@CRLF ) FileWrite ( $objFile, "<td>"&$strIESetting.AutoConfigURL&"</td>"&@CRLF ) FileWrite ( $objFile, "<td>   </td></tr>"&@CRLF ) FileWrite ( $objFile, "<tr>"&@CRLF&"<td>Proxy Server:</td>"&@CRLF ) FileWrite ( $objFile, "<td>" ) $PS = StringSplit($strIESetting.ProxyServer, ";") For $settinG in $PS FileWrite ( $objFile, $settinG&"<br>"&@CRLF ) Next FileWrite ( $objFile, "<\td>" ) FileWrite ( $objFile, "<td>   </td></tr>"&@CRLF ) Next FileClose ( $objFile ) The output of the code is in html, so if you get it working the output will be the middle of a table that is defined earlier in my script. Thanks - Tom