Jump to content
Sign in to follow this  
aleph01

How can I enum the systems on a domain that have Chrome browser installed?

Recommended Posts

aleph01

This is going to have to work on a mixed XP / Win 7 32 & 64 bit environment.

I first though of using FileExists to look for a file or folder unique to Chrome, but it appears Chrome gets installed under the Users/AppData/Local path of the installing user, and the installing user won't be known.

Then I thought RegEnumKey might work, since HKLM\Software\Google\Chrome and HKLM\Software\Wow6432Node\Google\Chrome are the locations of the registry entries, but I can't seem to get that to work across the domain, it only works on my system.

Acn anyone think of a way to make this work. Alternately anyone think of a better way, like is there a way to query Add/Remove Programs?

Any suggestions or other help would be greatly appreciated.

_aleph_


Meds.  They're not just for breakfast anymore. :'(

Share this post


Link to post
Share on other sites
FireFox

Hi,

Here you go :

$sChromeAppPath = @HomeDrive & @HomePath & "Local SettingsApplication DataGoogleChromeApplicationchrome.exe"

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
aleph01

FireFox,

Typically the current user won't be the installing user. Will your suggestion get the path even if it's under another user's profile? I won't have time to test until Monday.

Thanks,

_aleph_


Meds.  They're not just for breakfast anymore. :'(

Share this post


Link to post
Share on other sites
BrewManNH

Hi,

Here you go :

$sChromeAppPath = @HomeDrive & @HomePath & "Local SettingsApplication DataGoogleChromeApplicationchrome.exe"

Br, FireFox.

This doesn't work on Windows XP or on my installation of Win 7, my home drive is set to my H: drive so my @HomeDrive and @HomePath will come out to "H:", and there's no software installs there.

It would be closer to use this: "@AppDataDir & "GoogleChromeApplicationchrome.exe"", but that only works for Chrome installs that are done using the installer that installs to a user's profile folders. My install is in "C:Program Files (x86)GoogleChromeApplication" because we use the stand alone version of the installer.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
FireFox

Typically the current user won't be the installing user.

Then you can search the application for every user.

This doesn't work on Windows XP or on my installation of Win 7, my home drive is set to my H: drive so my @HomeDrive and @HomePath will come out to "H:", and there's no software installs there.

It would be closer to use this: "@AppDataDir & "GoogleChromeApplicationchrome.exe"", but that only works for Chrome installs that are done using the installer that installs to a user's profile folders. My install is in "C:Program Files (x86)GoogleChromeApplication" because we use the stand alone version of the installer.

Good to know.

But this works on my windows XP; @AppDataDir won't work because It targets "Application Data" and not "Local Settings" in the user folder.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
BrewManNH

Here's a script that the AIScriptomatic program came up with for checking for it using WMI. I modified it slightly so it only displays information about the Chrome installation. Change the computer name to the name of the computer you're wanting to query.

; Generated by AutoIt Scriptomatic
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Output = ""
$Output = $Output & "Computer: " & $strComputer & @CRLF
$objWMIService = ObjGet("winmgmts:" & $strComputer & "ROOTCIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Product", "WQL", _
          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) Then
     For $objItem In $colItems
          If StringInStr($objItem.Caption, "Chrome") Then
;~              $Output = $Output & "AssignmentType: " & $objItem.AssignmentType & @CRLF
               $Output = $Output & "Caption: " & $objItem.Caption & @CRLF
               $Output = $Output & "Description: " & $objItem.Description & @CRLF
;~              $Output = $Output & "HelpLink: " & $objItem.HelpLink & @CRLF
;~              $Output = $Output & "HelpTelephone: " & $objItem.HelpTelephone & @CRLF
               $Output = $Output & "IdentifyingNumber: " & $objItem.IdentifyingNumber & @CRLF
               $Output = $Output & "InstallDate: " & $objItem.InstallDate & @CRLF
               $Output = $Output & "InstallDate2: " & WMIDateStringToDate($objItem.InstallDate2) & @CRLF
               $Output = $Output & "InstallLocation: " & $objItem.InstallLocation & @CRLF
;~              $Output = $Output & "InstallSource: " & $objItem.InstallSource & @CRLF
               $Output = $Output & "InstallState: " & $objItem.InstallState & @CRLF
;~              $Output = $Output & "Language: " & $objItem.Language & @CRLF
;~              $Output = $Output & "LocalPackage: " & $objItem.LocalPackage & @CRLF
               $Output = $Output & "Name: " & $objItem.Name & @CRLF
               $Output = $Output & "PackageCache: " & $objItem.PackageCache & @CRLF
;~              $Output = $Output & "PackageCode: " & $objItem.PackageCode & @CRLF
;~              $Output = $Output & "PackageName: " & $objItem.PackageName & @CRLF
;~              $Output = $Output & "ProductID: " & $objItem.ProductID & @CRLF
;~              $Output = $Output & "RegCompany: " & $objItem.RegCompany & @CRLF
;~              $Output = $Output & "RegOwner: " & $objItem.RegOwner & @CRLF
               $Output = $Output & "SKUNumber: " & $objItem.SKUNumber & @CRLF
;~              $Output = $Output & "Transforms: " & $objItem.Transforms & @CRLF
;~              $Output = $Output & "URLInfoAbout: " & $objItem.URLInfoAbout & @CRLF
;~              $Output = $Output & "URLUpdateInfo: " & $objItem.URLUpdateInfo & @CRLF
               $Output = $Output & "Vendor: " & $objItem.Vendor & @CRLF
               $Output = $Output & "Version: " & $objItem.Version & @CRLF
;~              $Output = $Output & "WordCount: " & $objItem.WordCount & @CRLF
               $Output &= "#####################################################" & @CRLF
          EndIf
     Next
     ConsoleWrite($Output)
     FileWrite(@TempDir & "Win32_Product.TXT", $Output)
     Run(@ComSpec & " /c start " & @TempDir & "Win32_Product.TXT")
Else
     MsgBox(0, "WMI Output", "No WMI Objects Found for class: " & "Win32_Product")
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   ;==>WMIDateStringToDate

Localhost is the computer you're running it on, change it to the remote computer name without the "".

The lines that are commented out are commented out because I got errors on them when querying a remote machine, but works fine on the local system, try it both ways and see if it works for you.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
FireFox

@BrewManNH

Does not work for me :

Computer: localhost

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
BrewManNH

Yeah, I found out that script only works if you used the standalone installer and not the malware version that Google normally uses to install the browser.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
FireFox

and not the malware version that Google normally uses to install the browser.

Lol

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
aleph01

Thanks everybody for the suggestions, but none worked for me. I ended up manually remoting in and getting eye strain. On the up-side, the task is done except for a few systems I couldn't get to that were turned off. I didn't want to have to do this with this script, but is there a way to enumerate the subdirectories in a directory? Specifically, the user profile folders in C:Users? Ideally, all of the subdirectories would automatically populate an array.


Meds.  They're not just for breakfast anymore. :'(

Share this post


Link to post
Share on other sites
FireFox

but is there a way to enumerate the subdirectories in a directory?

Yes, _FileListToArray.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
aleph01

Thanks, FireFox. I scanned the help file looking for this, but had no idea what it would be called.


Meds.  They're not just for breakfast anymore. :'(

Share this post


Link to post
Share on other sites
iamtheky

A modified version of JSThePatriotripdad's func. Searches both keys for the item specified as $input.

#include <GuiListView.au3>
#include <File.au3>
Opt("TrayAutoPause", 0)
Opt('GUIOnEventMode', 1)
Opt('GUICloseOnEsc' , 1)


$station = @ComputerName

Global $i
Local $sSft
Global $sGui = GUICreate('Currently Installed Software', 810, 650, -1, -1)
Global $sLvw = GUICtrlCreateListView('#|Installed Software|Display Version|Publisher|Uninstall String', 5, 5, 800, 600)
_ComputerGetSoftware($sSft)
exit

; Author JSThePatriot - Modified June 20, 2010 by ripdad
Func _ComputerGetSoftware(ByRef $aSoftwareInfo)
$UnInstKey = "HKCUSOFTWAREMicrosoftWindowsCurrentVersionUninstall"
Local $i = 1
Dim $aSoftwareInfo[1][4]
$input = "Chrome"


For $j = 1 To 500
$AppKey = RegEnumKey($UnInstKey, $j)
If @error <> 0 Then Exitloop
$Reg = RegRead($UnInstKey & "" & $AppKey, "DisplayName")
$string = stringinstr($Reg, $input)
If $string = 0 Then Continueloop
ReDim $aSoftwareInfo[UBound($aSoftwareInfo) + 1][4]
$aSoftwareInfo[$i][0] = StringStripWS(StringReplace(RegRead($UnInstKey & "" & $AppKey, "DisplayName"), " (remove only)", ""), 3)
$aSoftwareInfo[$i][1] = StringStripWS(RegRead($UnInstKey & "" & $AppKey, "DisplayVersion"), 3)
$aSoftwareInfo[$i][2] = StringStripWS(RegRead($UnInstKey & "" & $AppKey, "Publisher"), 3)
$aSoftwareInfo[$i][3] = StringStripWS(RegRead($UnInstKey & "" & $AppKey, "UninstallString"), 3)
$i = $i + 1

Next

$UnInstKey = "HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall"

For $j = 1 To 500
$AppKey = RegEnumKey($UnInstKey, $j)
If @error <> 0 Then Exitloop
$Reg = RegRead($UnInstKey & "" & $AppKey, "DisplayName")
$string = stringinstr($Reg, $input)
If $string = 0 Then Continueloop
ReDim $aSoftwareInfo[UBound($aSoftwareInfo) + 1][4]
$aSoftwareInfo[$i][0] = StringStripWS(StringReplace(RegRead($UnInstKey & "" & $AppKey, "DisplayName"), " (remove only)", ""), 3)
$aSoftwareInfo[$i][1] = StringStripWS(RegRead($UnInstKey & "" & $AppKey, "DisplayVersion"), 3)
$aSoftwareInfo[$i][2] = StringStripWS(RegRead($UnInstKey & "" & $AppKey, "Publisher"), 3)
$aSoftwareInfo[$i][3] = StringStripWS(RegRead($UnInstKey & "" & $AppKey, "UninstallString"), 3)
$i = $i + 1

Next

;~ _ArrayDisplay($aSoftwareInfo)

If ubound($aSoftwareInfo) < 2 Then
msgbox (0, '' , $input & " is not installed")
Else
msgbox (0, '' , $input & " is installed")
Endif

EndFunc

edit: removed unused functions from original

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
aleph01

Hi, everybody, I'm back. Although I didn't get my script running and performed the task manually, I would really like to understand why I am getting the errors I get. If I leave lines 22 - 25 active, I always get the :No pat found" messagebox. If I rem them out, I am getting "Line 27: Subscript used with non-Array variable." The more I look, the more eyestrain I get, but the "aha" moment is elusive. Thanks in advance for any insight you can give me.

_aleph_

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <Misc.au3>
#include <File.au3>
Global $TargetFolder, $TargetItem, $FileList, $aItems
_Main()
;ProgressOn("File Seeker","")
;ProgressSet(0, "", 0 & " %")
$TargetFolder = "C$Users"
    If @error = 1 Then Exit
For $OuterLoop = 1 To $aItems[0]
   
    $FileList = _FileListToArray($aItems[$OuterLoop] & "" & $TargetFolder, "*", 2)
    ;If @error = 1 Then
    ;    MsgBox(0, "No Folders Found", "Path Not Found.")
    ;    Exit
    ;EndIf
   ; _ArrayDisplay($FileList, "$FileList")
    For $InnerLoop = 1 To $FileList[0]
    If FileExists ($TargetFolder & "" & $TargetItem & "AppDataLocalGoogleChromeApplicationchrome.exe") Then
       MsgBox (0, $TargetFolder & "" & $TargetItem & "AppDataLocalGoogleChromeApplication", "A file named  chrome.exe resides here.")
       EndIf
    Next
  $ProgNum = Round ($sItems / $aItems[0] * 100)
  ProgressSet($ProgNum, "", $ProgNum & " %")
Next

Func _Main()
    Local $hListBox, $FinishButton, $CancelButton
    ; Create GUI
    GUICreate("Select Computers", 210, 568)
    $FinishButton = GUICtrlCreateButton("Finish", 4, 541, 120)
    $CancelButton = GUICtrlCreateButton("Cancel", 126, 541, 80)
    $hListBox = GUICtrlCreateList("", 0, 0, 210, 545, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_EXTENDEDSEL))
    GUISetState()
    ; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
 
; add CUOPAC computers
     _GUICtrlListBox_AddString($hListBox, "CUONESTOP")
  _GUICtrlListBox_AddString($hListBox, "CUONESTOP2")
  _GUICtrlListBox_AddString($hListBox, "CUONESTOP3")
 For $i = 1 to 5
  _GUICtrlListBox_AddString($hListBox, "CUOPAC" & $i)
 Next
_GUICtrlListBox_EndUpdate($hListBox)
 
    ; Select items
    While 1
        Switch GUIGetMsg()
            Case $CancelButton
                Exit
            Case $FinishButton
        ExitLoop
    Case $GUI_EVENT_CLOSE
     Exit
        EndSwitch
    WEnd

    ; Get text of selected items
    $aItems = _GUICtrlListBox_GetSelItemsText($hListBox)
    GUIDelete()
 ;_ArrayDisplay($aItems)
EndFunc   ;==>_Main

Meds.  They're not just for breakfast anymore. :'(

Share this post


Link to post
Share on other sites
BrewManNH

You're forgetting the "" before the computer names.

You're also forgetting the computer name, and the user name, when you're searching the folder for the file.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
aleph01

Thanks, BrewManNH, I think I'm taking baby steps in the right direction. I've gotten rid of the errors, but when I search a known Chrome system (my own), I can see the array enumerating the subdirectories in the Users folder using _ArrayDisplay, but when I continue, I get no response from the script, rather than the expected msgbox telling me that "Chrome resides here."

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <Misc.au3>
#include <File.au3>
Global $TargetFolder, $TargetItem, $FileList, $aItems, $sItems, $FileListItem
_Main()
;ProgressOn("File Seeker","")
;ProgressSet(0, "", 0 & " %")
$TargetFolder = "C$Users"
    If @error = 1 Then Exit
For $OuterLoop = 1 To $aItems[0]
   
    $FileList = _FileListToArray("" & $aItems[$OuterLoop] & "" & $TargetFolder, "*", 2)
    If @error = 1 Then
        MsgBox(0, "No Folders Found", "Path Not Found.")
        Exit
    EndIf
    _ArrayDisplay($FileList, "$FileList")
    For $InnerLoop = 1 To $FileList[0]
    If FileExists ("" & $FileListItem & "" & $TargetFolder & "" & $TargetItem & "AppDataLocalGoogleChromeApplicationchrome.exe") Then
       MsgBox (0, $TargetFolder & "" & $TargetItem & "AppDataLocalGoogleChromeApplication", "A file named  chrome.exe resides here.")
       EndIf
    Next
  $ProgNum = Round ($sItems / $aItems[0] * 100)
  ProgressSet($ProgNum, "", $ProgNum & " %")
Next

Func _Main()
    Local $hListBox, $FinishButton, $CancelButton
    ; Create GUI
    GUICreate("Select Computers", 210, 568)
    $FinishButton = GUICtrlCreateButton("Finish", 4, 541, 120)
    $CancelButton = GUICtrlCreateButton("Cancel", 126, 541, 80)
    $hListBox = GUICtrlCreateList("", 0, 0, 210, 545, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_EXTENDEDSEL))
    GUISetState()
    ; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
 
; add CUOPAC computers
     _GUICtrlListBox_AddString($hListBox, "CUONESTOP")
  _GUICtrlListBox_AddString($hListBox, "CUONESTOP2")
  _GUICtrlListBox_AddString($hListBox, "CUONESTOP3")
 For $i = 1 to 5
  _GUICtrlListBox_AddString($hListBox, "CUOPAC" & $i)
 Next
_GUICtrlListBox_EndUpdate($hListBox)
 
    ; Select items
    While 1
        Switch GUIGetMsg()
            Case $CancelButton
                Exit
            Case $FinishButton
        ExitLoop
    Case $GUI_EVENT_CLOSE
     Exit
        EndSwitch
    WEnd

    ; Get text of selected items
    $aItems = _GUICtrlListBox_GetSelItemsText($hListBox)
    GUIDelete()
 ;_ArrayDisplay($aItems)
EndFunc   ;==>_Main

Meds.  They're not just for breakfast anymore. :'(

Share this post


Link to post
Share on other sites
BrewManNH

Try this, as I said previously, you were missing the computer name to search in, and some of the other things needed to look in the right place on the right computers.

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <Misc.au3>
#include <File.au3>
Global $TargetFolder, $TargetItem, $FileList, $aItems, $sItems, $FileListItem, $ProgNum
_Main()
;ProgressOn("File Seeker","")
;ProgressSet(0, "", 0 & " %")
$TargetFolder = "C$Users"
If @error = 1 Then Exit
For $OuterLoop = 1 To $aItems[0]

    $FileList = _FileListToArray("" & $aItems[$OuterLoop] & "" & $TargetFolder & "","*", 2)
    If @error = 1 Then
        MsgBox(0, "No Folders Found", "Path Not Found.")
        Exit
    EndIf
    For $InnerLoop = 1 To $FileList[0]
        If FileExists("" & $aItems[$OuterLoop] & $FileListItem & "" & $TargetFolder  & $TargetItem & "AppDataLocalGoogleChromeApplicationchrome.exe") Then
            MsgBox(0, $TargetFolder & "" & $TargetItem & "AppDataLocalGoogleChromeApplication", "A file named  chrome.exe resides here.")
        EndIf
    Next
    $ProgNum = Round($sItems / $aItems[0] * 100)
    ProgressSet($ProgNum, "", $ProgNum & " %")
Next

Func _Main()
    Local $hListBox, $FinishButton, $CancelButton
    ; Create GUI
    GUICreate("Select Computers", 210, 568)
    $FinishButton = GUICtrlCreateButton("Finish", 4, 541, 120)
    $CancelButton = GUICtrlCreateButton("Cancel", 126, 541, 80)
    $hListBox = GUICtrlCreateList("", 0, 0, 210, 545, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_EXTENDEDSEL))
    GUISetState()
    ; Add strings
    _GUICtrlListBox_BeginUpdate($hListBox)

    ; add CUOPAC computers
    _GUICtrlListBox_AddString($hListBox, "laptop-right")
    _GUICtrlListBox_AddString($hListBox, "CUONESTOP2")
    _GUICtrlListBox_AddString($hListBox, "CUONESTOP3")
    For $i = 1 To 5
        _GUICtrlListBox_AddString($hListBox, "CUOPAC" & $i)
    Next
    _GUICtrlListBox_EndUpdate($hListBox)

    ; Select items
    While 1
        Switch GUIGetMsg()
            Case $CancelButton
                Exit
            Case $FinishButton
                ExitLoop
            Case $GUI_EVENT_CLOSE
                Exit
        EndSwitch
    WEnd

    ; Get text of selected items
    $aItems = _GUICtrlListBox_GetSelItemsText($hListBox)
    GUIDelete()
    ;_ArrayDisplay($aItems)
EndFunc   ;==>_Main

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
aleph01

BrewManNH,

I'm still getting no message box when I run the script on a known Chrome system. I redid the computer list so that it had 3 known Chrome systems and when I run the script selecting all three, it runs fof about 10 seconds, so I think the script is probably going through the computers looking for the chrome.exe file, but perhaps there's a problem in the following lines:

For $InnerLoop = 1 To $FileList[0]
        If FileExists("" & $aItems[$OuterLoop] & "C$" & $FileListItem & "" & $TargetFolder  & $TargetItem & "AppDataLocalGoogleChromeApplicationchrome.exe") Then
            MsgBox(0, $TargetFolder & "" & $TargetItem & "AppDataLocalGoogleChromeApplication", "A file named  chrome.exe resides here.")
        EndIf
    Next

Meds.  They're not just for breakfast anymore. :'(

Share this post


Link to post
Share on other sites
BrewManNH

Which version of Chrome do they have installed, the standalone install version which puts the files in Program Folders, or the shitty version which puts it in AppData? If you go to the target folder using the same information in the FileExists function, can you find the exe?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
aleph01

I have the shitty AppData version. Otherwise, I wouldn't have this problem. It's the loop within a loop that's getting me. If I replace the variables with a simple path, the FileExists works fine. I think I'm just screwing my usage of the variables. I think I need some Ginko.


Meds.  They're not just for breakfast anymore. :'(

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×