Jump to content

ChrisFromBoston

Active Members
  • Posts

    21
  • Joined

  • Last visited

Profile Information

  • Location
    Boston

ChrisFromBoston's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hi Everyone, I have a standard tray item with multiple submenus with radio options. Changing any of those submenu radio options closes the entire menu tree. I'd like users of my script to be able to continue to browse the submenus after picking one, so I'd prefer it didn't close. Any way I can make this change?
  2. I have an AutoIt script running on a few thousand computers that basically just sits in the system tray and allows support staff to ask a user to run a few common tools. What I've noticed recently is that sometime the AutoIt icon is missing from the tray entirely, but a check at Task Manager shows that the process is still running. The icon is not in the hidden area of the System Tray, it's just ... gone. Killing the task and restarting the app, or logging out and back in brings the icon back. These users would not know how to get into the debugging mode of the script (double right click / CTRL+F2) that I put in there so I wouldn't think that's causing any issue. Is there any AutoIt / Windows timeout that's occurring causing the icon to go away but the process remains? The code is below. Not quite a work of art, but it's been working so far :-) #Include <Constants.au3> #Include <misc.au3> $title = "Desktop Tools" $flagError = 48 $flagInfo = 64 $mnuQuit = "X" $mnuVersion = "X" $mnuDebugSep = "X" $appCScript = @WindowsDir & "\system32\cscript.exe" Opt("TrayIconDebug", 0) Opt("TrayAutoPause", 0) Opt("TrayMenuMode", 1) if _Singleton("DesktopTools", 1) = 0 then Msgbox($flagError, $title, "This tool is already running.", 15) exit(0) EndIf TraySetToolTip("Desktop Tools") $mnuMapDrives = TrayCreateItem("Map Network Drives") TrayCreateItem("") $mnuIPAddress = TrayCreateItem("What is my IP Address?") $mnuNetBIOSName = TrayCreateItem("What is my Computer Name?") While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $mnuMapDrives If Not FileExists("\\domain\netlogon\loginscript.vbs") then msgbox($flagError, $title, "Error Mapping Network Drives: Cannot Find Login Script. Ensure that you are connected to the Network.") ElseIf Not FileExists($appCScript) then msgbox($flagError, $title, "Error Mapping Network Drives: Cannot Find CSCRIPT. Please call the Support Center.") Else SplashTextOn("", "Please Wait While Your Drives Are Mapped.", 450, 30, 40, 40, 1 + 32, "Arial", 12, 400) $runLoginScript = ShellExecuteWait($appCScript, "//nologo \\domain\netlogon\loginscript.vbs") SplashOff() if $runLoginScript <> 0 Then msgbox($flagError, $title, "Login Script Returned Error " & $runLoginScript & ". Please call the Support Center.") Else msgbox($flagInfo, $title, "Your drives have been mapped.") EndIf EndIf Case $msg = $mnuIPAddress $ipList = "" if ValidIP(@IPAddress1) then $ipList = $ipList & @IPAddress1 & @CRLF if ValidIP(@IPAddress2) then $ipList = $ipList & @IPAddress2 & @CRLF if ValidIP(@IPAddress3) then $ipList = $ipList & @IPAddress3 & @CRLF if ValidIP(@IPAddress4) then $ipList = $ipList & @IPAddress4 & @CRLF if $ipList <> "" Then msgbox($flagInfo, $title, "Your IP Address is: " & @CRLF & @CRLF & $ipList) Else msgbox($flagError, $title, "Unable to determine your IP Address.") endif Case $msg = $mnuNetBIOSName msgbox($flagInfo, $title, "Your Computer Name is: " & @CRLF & @CRLF & @ComputerName) Case $msg = $mnuVersion msgbox($flagInfo, $title, "Version 1.01" & @CRLF & "June 12, 2009") Case $msg = $mnuQuit exit(0) Case $msg = $TRAY_EVENT_SECONDARYDOUBLE if $mnuQuit <> "X" Then TrayItemDelete($mnuQuit) TrayItemDelete($mnuVersion) TrayItemDelete($mnuDebugSep) $mnuQuit = "X" $mnuVersion = "X" $mnuDebugSep = "X" TraySetState(4) Sleep(2000) TraySetState(8) else HotKeySet("^{F12}", "TrayDebug") Sleep(5000) HotKeySet("^{F12}") EndIf EndSelect WEnd Func ValidIP($addr) if $addr <> "127.0.0.1" and $addr <> "0.0.0.0" Then return True Else return False EndIf EndFunc Func TrayDebug() if $mnuQuit <> "X" then return false $mnuDebugSep = TrayCreateItem("") $mnuVersion = TrayCreateItem("Application Version") $mnuQuit = TrayCreateItem("Exit Application") TraySetState(4) Sleep(2000) TraySetState(8) return true EndFunc
  3. The following code should work for you: ; Define $text - can be gotten with ClipGet() as well $text = "/dev/pts/12: Connected to Virtual Machine 'pick0:LINUX'." & @CRLF & "TEST CORP SALES (DETAIL) Primary Whse: 6 123456 08:22:10 05/01/09" & @CRLF & "Trans Cd: A (A,B,D,F,I,L,M,S,/) Order No: 24793485 Customer No: 000130522" & @CRLF & "Order for: TEST MXPQFG5F3C Placed By: WJB" & @CRLF & "Line PB Price... Catalog No Catalog Color. * Description........... Amount...." & @CRLF & " W" & @CRLF & "" & @CRLF & "Weight: 1 ================== Pieces: 1 ====== Amount: 11.99" & @CRLF & " 1 1 11.99 K420 Athletic Gold PA Pique Sport Shirt 11.99" & @CRLF & " 6 M: 1" & @CRLF ; Find out where the Order Starts $orderStart = StringInstr($text, "Order No: ")+10 ; Get the Length of the Order Number by getting the first Space after the Order Number Starts $orderLen = StringInStr($text, chr(32), 0, 1, $orderStart)-$orderStart ; Get a part of the string, starting after Order Number and Ending right before the Space $orderNumber = StringMid($text, $orderStart, $orderLen); ; Dump to Console to Test consolewrite($orderNumber) It takes into account a variable length order number, however if there will ever be anything after the order number besides a space (a carriage return, for example), additional coding would need to be done to take that into account.
  4. What does $text look like and what are you trying to capture? StringSplit will split a string by the delimiter into an array. For example: $var = "How now brown cow" $text = StringSplit($var, " ") Would return $text[0] = 4 $text[1] = "How" $text[2] = "Now" $text[3] = "Brown" $text[4] = "Cow" Where the first position of the array (zero) would be the number of split items (4 in this case for 4 words). You could also use functions like StringInStr, StringLeft, StringMid, and StringRight to get parts of $text if you know what you're looking for.
  5. I don't have AutoIt on this computer, but I think the variable is @SystemRoot so it'd be: FileCopy(@SystemRoot & \system32\drivers\UnlockerDriver5.sys", "saved")
  6. This example should set you in the right direction: DirCreate("c:\myFolder") FileCopy(EnvGet("SYSTEMROOT") & "\explorer.exe", "c:\myFolder") It will create c:\myFolder and then will copy explorer from SYSTEMROOT.
  7. Be careful, that's only working because you're using black and both RGB black and HEX black are 0. If you move to most other colors, it will not work just removing one equal sign if you're trying to compare the RGB color returned by PixelGetColor with the hex value as it would appear you're attempting to do.
  8. FWIW, the code above creates a system modal dialog box. It never moves to the background. Running Windows XP SP2 32-bit.
  9. Can't see any reason this wouldn't work as a non-admin, but test. Generated by AutoIt Scriptomatic. You'll need to modify to look only at the Network Adapter(s) you want to, perhaps even excluding anything that doesn't have a gateway. ; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "ArpAlwaysSourceRoute: " & $objItem.ArpAlwaysSourceRoute & @CRLF $Output = $Output & "ArpUseEtherSNAP: " & $objItem.ArpUseEtherSNAP & @CRLF $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "DatabasePath: " & $objItem.DatabasePath & @CRLF $Output = $Output & "DeadGWDetectEnabled: " & $objItem.DeadGWDetectEnabled & @CRLF $strDefaultIPGateway = $objItem.DefaultIPGateway(0) $Output = $Output & "DefaultIPGateway: " & $strDefaultIPGateway & @CRLF $Output = $Output & "DefaultTOS: " & $objItem.DefaultTOS & @CRLF $Output = $Output & "DefaultTTL: " & $objItem.DefaultTTL & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "DHCPEnabled: " & $objItem.DHCPEnabled & @CRLF $Output = $Output & "DHCPLeaseExpires: " & WMIDateStringToDate($objItem.DHCPLeaseExpires) & @CRLF $Output = $Output & "DHCPLeaseObtained: " & WMIDateStringToDate($objItem.DHCPLeaseObtained) & @CRLF $Output = $Output & "DHCPServer: " & $objItem.DHCPServer & @CRLF $Output = $Output & "DNSDomain: " & $objItem.DNSDomain & @CRLF $strDNSDomainSuffixSearchOrder = $objItem.DNSDomainSuffixSearchOrder(0) $Output = $Output & "DNSDomainSuffixSearchOrder: " & $strDNSDomainSuffixSearchOrder & @CRLF $Output = $Output & "DNSEnabledForWINSResolution: " & $objItem.DNSEnabledForWINSResolution & @CRLF $Output = $Output & "DNSHostName: " & $objItem.DNSHostName & @CRLF $strDNSServerSearchOrder = $objItem.DNSServerSearchOrder(0) $Output = $Output & "DNSServerSearchOrder: " & $strDNSServerSearchOrder & @CRLF $Output = $Output & "DomainDNSRegistrationEnabled: " & $objItem.DomainDNSRegistrationEnabled & @CRLF $Output = $Output & "ForwardBufferMemory: " & $objItem.ForwardBufferMemory & @CRLF $Output = $Output & "FullDNSRegistrationEnabled: " & $objItem.FullDNSRegistrationEnabled & @CRLF $strGatewayCostMetric = $objItem.GatewayCostMetric(0) $Output = $Output & "GatewayCostMetric: " & $strGatewayCostMetric & @CRLF $Output = $Output & "IGMPLevel: " & $objItem.IGMPLevel & @CRLF $Output = $Output & "Index: " & $objItem.Index & @CRLF $strIPAddress = $objItem.IPAddress(0) $Output = $Output & "IPAddress: " & $strIPAddress & @CRLF $Output = $Output & "IPConnectionMetric: " & $objItem.IPConnectionMetric & @CRLF $Output = $Output & "IPEnabled: " & $objItem.IPEnabled & @CRLF $Output = $Output & "IPFilterSecurityEnabled: " & $objItem.IPFilterSecurityEnabled & @CRLF $Output = $Output & "IPPortSecurityEnabled: " & $objItem.IPPortSecurityEnabled & @CRLF $strIPSecPermitIPProtocols = $objItem.IPSecPermitIPProtocols(0) $Output = $Output & "IPSecPermitIPProtocols: " & $strIPSecPermitIPProtocols & @CRLF $strIPSecPermitTCPPorts = $objItem.IPSecPermitTCPPorts(0) $Output = $Output & "IPSecPermitTCPPorts: " & $strIPSecPermitTCPPorts & @CRLF $strIPSecPermitUDPPorts = $objItem.IPSecPermitUDPPorts(0) $Output = $Output & "IPSecPermitUDPPorts: " & $strIPSecPermitUDPPorts & @CRLF $strIPSubnet = $objItem.IPSubnet(0) $Output = $Output & "IPSubnet: " & $strIPSubnet & @CRLF $Output = $Output & "IPUseZeroBroadcast: " & $objItem.IPUseZeroBroadcast & @CRLF $Output = $Output & "IPXAddress: " & $objItem.IPXAddress & @CRLF $Output = $Output & "IPXEnabled: " & $objItem.IPXEnabled & @CRLF $strIPXFrameType = $objItem.IPXFrameType(0) $Output = $Output & "IPXFrameType: " & $strIPXFrameType & @CRLF $Output = $Output & "IPXMediaType: " & $objItem.IPXMediaType & @CRLF $strIPXNetworkNumber = $objItem.IPXNetworkNumber(0) $Output = $Output & "IPXNetworkNumber: " & $strIPXNetworkNumber & @CRLF $Output = $Output & "IPXVirtualNetNumber: " & $objItem.IPXVirtualNetNumber & @CRLF $Output = $Output & "KeepAliveInterval: " & $objItem.KeepAliveInterval & @CRLF $Output = $Output & "KeepAliveTime: " & $objItem.KeepAliveTime & @CRLF $Output = $Output & "MACAddress: " & $objItem.MACAddress & @CRLF $Output = $Output & "MTU: " & $objItem.MTU & @CRLF $Output = $Output & "NumForwardPackets: " & $objItem.NumForwardPackets & @CRLF $Output = $Output & "PMTUBHDetectEnabled: " & $objItem.PMTUBHDetectEnabled & @CRLF $Output = $Output & "PMTUDiscoveryEnabled: " & $objItem.PMTUDiscoveryEnabled & @CRLF $Output = $Output & "ServiceName: " & $objItem.ServiceName & @CRLF $Output = $Output & "SettingID: " & $objItem.SettingID & @CRLF $Output = $Output & "TcpipNetbiosOptions: " & $objItem.TcpipNetbiosOptions & @CRLF $Output = $Output & "TcpMaxConnectRetransmissions: " & $objItem.TcpMaxConnectRetransmissions & @CRLF $Output = $Output & "TcpMaxDataRetransmissions: " & $objItem.TcpMaxDataRetransmissions & @CRLF $Output = $Output & "TcpNumConnections: " & $objItem.TcpNumConnections & @CRLF $Output = $Output & "TcpUseRFC1122UrgentPointer: " & $objItem.TcpUseRFC1122UrgentPointer & @CRLF $Output = $Output & "TcpWindowSize: " & $objItem.TcpWindowSize & @CRLF $Output = $Output & "WINSEnableLMHostsLookup: " & $objItem.WINSEnableLMHostsLookup & @CRLF $Output = $Output & "WINSHostLookupFile: " & $objItem.WINSHostLookupFile & @CRLF $Output = $Output & "WINSPrimaryServer: " & $objItem.WINSPrimaryServer & @CRLF $Output = $Output & "WINSScopeID: " & $objItem.WINSScopeID & @CRLF $Output = $Output & "WINSSecondaryServer: " & $objItem.WINSSecondaryServer & @CRLF Next ConsoleWrite($Output) FileWrite(@TempDir & "\Win32_NetworkAdapterConfiguration.TXT", $Output ) Run(@Comspec & " /c start " & @TempDir & "\Win32_NetworkAdapterConfiguration.TXT" ) Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_NetworkAdapterConfiguration" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc
  10. Your if statement is still just looking at VAR, which is the RGB color (0) of the pixel. If you want to compare against the hex value, use: $var = PixelGetColor( 1 , 1 ) MsgBox(0,"The decmial color is", $var) MsgBox(0,"The hex color is", Hex($var, 6)) If Hex($var, 6) == "000000" Then MsgBox(0,"Color found!", Hex($var)) Else MsgBox(0,"Color not found!", Hex($var)) EndIf
  11. Awesome We'd been prepping for the deployment for a long time and I've spent almost 9 months now with the product, so if they need anything, they're welcome to ping me through the forums. I have a few posts in my blog that talk about some issues that we'd run into, or that I helped other folks through, and the McAfee community is pretty good, too. Hope the UDF helps
  12. There's a list of Network Provider in order under the following key: HKLM\System\CurrentControlSet\Control\NetworkProvider\HwOrder I've referenced it in Windows 2000, XP, and Vista, but I don't know about older or newer Operating Systems. The list is comma delimited, you'll just need to know what you're looking for. I have some Netware client systems if you need to know what will show up for Netware, but I think it's just "Netware Provider".
  13. Are they all on the same network? If so, you can, with the proper permissions, FileCopy the EXE's to \\<computer>\c$ (or wherever). If you're in an enterprise, you can use tools like Microsoft SMS/SCCM, Altiris Deployment Server, ZenWorks, or any number of tools to remotely deploy software to a group of PCs.
  14. I haven't done anything like this before (with AutoIt or any language), but before you get too far, make sure that both your hardware and your Operating System support multi-touch. Google will help you figure this part out. For example, here is an article about Dell announcing their new multi-touch tablet. I'm not sure that any amount of coding will get you your desired functionality if it's not supported outside of AutoIt first. Sounds like a really fun project!
  15. Might be faster to load both files into an array using _FileReadToArray and then looping over one array and compare the arrays. I've seen a few UDFs that do array comparisons, here is the first one in the search list. Now, maybe someone will have an even faster way, but that's a good start.
×
×
  • Create New...