Jump to content

Recommended Posts

Posted (edited)

First off I know I have a whole bunch of includes that don't pertain to the script... Its just a testing window I use..

I'm trying to get the users names that appear to show up so then I can move the profiles. But no matter what checkbox I select it doesn't show me the right name back..

????????????

Help Please!!

#include <AD.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <Constants.au3>
#include <EditConstants.au3>
#include <GUIConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <GuiToolbar.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>
#include <ListViewConstants.au3>
#include <Math.au3>
#include <Misc.au3>
#include <NetShare.au3>
#include <Process.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <Timers.au3>
#include <TreeViewConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <Mysql.au3>
#include <string.au3>
#include <GDIPlus.au3>

#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 700, 438, 192, 124)
$Button1 = GUICtrlCreateButton("Remove from Discovery", 510, 8, 169, 25)
$ListView1 = GUICtrlCreateListView("User|Sid", 8, 8, 480, 425, BitOR($GUI_SS_DEFAULT_LISTVIEW, $LVS_SORTASCENDING), BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_TRACKSELECT))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 170)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 378)
;_GUICtrlListView_AddItem(
$xx = ""
$sids = ""
$Checkbox = ""
$Userandsid = ""
$text = ""
$Column = ""
$Columns = ""
$sArray = ""
For $i = 1 To 100
$var = RegEnumKey("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileList", $i)
If @error <> 0 Then ExitLoop
$sids = $var & "," & $sids
Next
$sids = StringSplit(StringTrimRight($sids, 1), ",")
For $x = $sids[0] To 1 Step -1
$userprofilepath = RegRead("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileList" & $sids[$x], "ProfileImagePath")
$user = StringSplit($userprofilepath, "")
$usernumber = $user[0]
$Userandsid = $user[$usernumber] & "|" & $sids[$x] & "," & $Userandsid
GUICtrlCreateListViewItem($user[$usernumber] & "|" & $sids[$x], $ListView1)
Next
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button1
   $state = ''
   For $i = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1
    If _GUICtrlListView_GetItemChecked($ListView1, $i) Then
    $state = $state & ',' & $i
   EndIf
   Next
  $State = StringTrimLeft($state,1)
   $statesplit = StringSplit($state, ",")
   For $d = 1 To $statesplit[0]
    If $statesplit[$d] <> '' Then
     $number = StringStripWS($statesplit[$d], 15)
     msgbox(0,"",$number)
     $item = _GUICtrlListView_GetItemSelected($ListView1, $number)
     $textofitem = _GUICtrlListView_GetItemText($ListView1, $item)
     MsgBox(0, $d, $textofitem)
    EndIf
    $number = ""
   Next
EndSwitch
WEnd
Edited by Ghost21
Posted

Not really sure why you are wanting to check those items twice, but here is a working option for you.

Only thing I worked on was the While / Wend section.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            For $i = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1
                If _GUICtrlListView_GetItemChecked($ListView1, $i) Then
                    $textofitem = _GUICtrlListView_GetItemText($ListView1,$i)
                    MsgBox(0,$i,$textofitem)
                EndIf
            Next

    EndSwitch
WEnd

Also, here's the list of includes that you need; for what you have posted:

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>

If you try to fail and succeed which have you done?AutoIt Forum Search

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...