-
Posts
33 -
Joined
-
Last visited
Everything posted by MPHillier
-
So I'm teaching myself through the forum and help files - Listview and Checkboxes and the commands that control them. My project has two tabs - each with a listview on them - One is filed with .exe files from a directory and the other is filed with computer info from a .csv file. No problems there. I am able to setup both left and right click optionsmenus. I am able to check uncheck individual checkboxex - checkuncheck all items. My issue is I am attempting to Click a (Run) button and execute a command on only the checked items - once the command is run I want the checked item box to become unchecked. I can get it to work either by running a single checked item or [Odd] a group of checked items in a series. example item 0, 1,2,3,4, and so on. Yet when checking say items 1,3, 5 only the first check box is unchecked and the others are left. The command still runs but the items are still checked. Here is where I believe this should be happening - Below you can see I'm throwing out WOL commands throught NetScan (Condensed version - I have other commands under the WOL option) 1. First Get the count of the listview Items 2. Get only Items that are checked 3. put into array 4. run through Ping check - and run command. Running the command on only the checked items work great yet I can't get the checked Items to uncheck after the command has run on a non series group of checked items. I've put _GUICtrlListView_SetItemChecked and attempted other options found in the forum - all over the place to see what I get but if its not in a series - 1,2,3,4. uncheck fails on all but those in a series. (Odd) I hope this makes some meaning .... Func _RunSelectedOption() Local $aSelected[1], $1, $2, $iItemCount, $sFileName $iItemCount = _GUICtrlListView_GetItemCount($cListView);--- Number of items in listview $2 = 0 For $1 = 1 To $iItemCount If _GUICtrlListView_GetItemChecked($cListView, $1 - 1) = True Then ;-- which chkbox's are checked $aSelected[$2] = _GUICtrlListView_GetItemTextArray($cListView, $1 - 1);-- Take listview items\sub-items [column 1,2,3] ReDim $aSelected[UBound($aSelected) + 1] $2 += 1 EndIf Next For $1 = 1 To UBound($aSelected) -1 $sFileName = $aSelected[$1 - 1] ;-----------------------------------------------------------Wake Onlan If GUICtrlRead($hChkbxMWol) = $GUI_CHECKED Then Local $Replaced = StringReplace($sFileName [3],"-","") Run($NetScan & " /wol:" & $Replaced, "",@SW_HIDE) if GUICtrlRead ($hCheckbox) = $GUI_CHECKED Then MsgBox(64,"WOL", "Packet Sent To - " & $sFileName [1] & " \ " & $sFileName [3],3) EndIf Sleep(2000) EndIf Else MsgBox(48,"Connection", $sFileName [1] & " - Not Found Online", 3);-- Failed Ping Msg... EndIf Endif Next Sleep(1000 Endfunc My next step with the project is to be able to ping the checked items then in the listview indicate online or Offline - or something to that effect. Learning alot... Hey much Thanks in advance....
-
Ricoh printers counter page / toner usage
MPHillier replied to noorduffici's topic in AutoIt General Help and Support
Try - HP Web Jetadmin - -
Rename \ Adjusting file names
MPHillier replied to MPHillier's topic in AutoIt General Help and Support
Bunch of thanks - BrewManNH - Set me on a path learning more StringRegExp and patterns... From what I've learned I've been able to use StringRegExpReplace often in my schedule project. Project is running well after two days of tests. Still learning and crunching my codes down in size. Mahalo... -
Rename \ Adjusting file names
MPHillier replied to MPHillier's topic in AutoIt General Help and Support
I should have stated that the out put should be - Slide1.jpg = Slide01.jpg Slide2.jpg = Slide02.jpg and so on - through the 9 slides. note todays surf report - North Shore - 6-8ft 8-15ft face slight side on shore wind.. little choppy - I'm going surfing.... -
So I have a pptx file w 30 slides that I convert to .jpg monthly. Working on renaming the 9 slides that have single digits by adding a 0 to the file name. I have the get file to array and file rename etc... - Example script shows the logic used - wondering how possibly make it smaller... Local $sInput = "Slide1.jpg" ;-- File name Local $len = StringLen($sInput) ;-- Get string length if $len = 10 then ;-- If string = 10 continue - "else" Local $var = StringRight($sInput, 5) ;-- Hold right 5 places Local $result = StringTrimRight($sInput, 4) ;-- Trim right 4 placed Local $sOutput = StringRegExpReplace($result, "[123456789]", "0") ;-- replace digits with 0 MsgBox(0, "Result", $sInput & " - is now - " & $sOutput & $var ) ;-- put back together else MsgBox(0, "Results", "Incorrect target Length" ) ;-- If not string length = 10 EndIf Luv Autoit - Use it daily. Much Thanks
-
Win 7 Profile - Sounding Board.
MPHillier replied to MPHillier's topic in AutoIt General Help and Support
Just read that the author of Delprof2 is currently working on adding the exclusion option - Cool. I need the option to keep specific user profiles on each machine and delete the rest which has started me on this task yet I'm still moving forward on an Autoit version. I've also come across "WINAPI DeleteProfile", "WMI Win32_UserProfile", and also powershell version to delete profiles. I've confirmed a few things in my study on the subject and am close to completing my script. Testing looks promising I'll start testing on live images soon. -
$iComputer = "ComputerName" For $i = 1 To 100 Local $var = RegEnumKey("" & $iComputer & "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileList", $i) If @error <> 0 Then ExitLoop Local $var2 = RegRead("" & $iComputer & "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileList" & $var, "ProfileImagePath") ConsoleWrite(" SubKey #" & $i & " under ProfileList: " & $var & " " & $var2 & @CRLF) Next ConsoleWrite($iComputer & " Complete" & @CRLF) #include <file.au3> #include <Security.au3> $iComputer = "ComputerName" ;func DelProfmulti () $FolderRoot = "" & $iComputer & "c$Users" $Folder1 = "ADMINISTRATOR" $Folder2 = "ALL USERS" $Folder3 = "DEFAULT" ConsoleWrite(" Delelet Profile Sent To" & $iComputer & @CRLF) $AllFolders = _FileListToArray($FolderRoot, "*", 2) If Not @error Then For $i = 1 To $AllFolders[0] If $AllFolders[$i] <> $Folder1 _ And $AllFolders[$i] <> $Folder2 _ And $AllFolders[$i] <> $Folder3 Then ; ConsoleWrite($sStringSID) ;RegDelete("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileList", $sStringSID) ;DirRemove($FolderRoot & $AllFolders[$i], 1) ConsoleWrite($FolderRoot & $AllFolders[$i] & @CRLF ) EndIf Next EndIf ConsoleWrite($iComputer & " Complete" & @CRLF) I looked up delprof2 but see its limitations... I created a script that worked with 2003 and below but now that we're migrating to 7 its back to the drawing board... I just need confirmation that I'm heading in the right direction - any input that would help me get to my intended outcome would greatly be appreciated... Much Thanks...
-
Run a program with parameters
MPHillier replied to jWalker's topic in AutoIt General Help and Support
I agree w\ Jos - quoting and parameters don't look correct. Check out Help file - Language Reference - Strings. -
what are the command line parameters for the .exe file you're wanting to use? Here is an example of passing parameters to Xcopy - RunWait("xcopy.exe " & $CopySingle_From & " " & "\\" & $Read_Single_Input & "\C$\" & $CopySingle_To & " " & "/O /H /R /K /I /X /Y", "", @SW_HIDE) copies file from computer to computer and does not show the command while running... Gives you any idea concerning your project?
-
ListView fields to Input boxes
MPHillier replied to MPHillier's topic in AutoIt General Help and Support
This is cool - To my understanding - breaking it down - Get index of row being used $iIndex = Number(_GUICtrlListView_GetSelectedIndices($cListView)) Get text from index\row $sText = _GUICtrlListView_GetItemTextString($cListView) Split data using "|" as the delimiter, flag = 2, disable the return count in the first element - effectively makes the array 0-based. $aText = StringSplit($sText, "|", 2) Drop into the inputs 0 - 4 For $i = 0 To 4 GUICtrlSetData($aInput[$i], $aText[$i]);Input box - string To actually break it down clears up so much for understanding whats going on. This is opening up other ideas to use in the project. So much Thanks and Aloha! -
EDIT - initially had incorrect line...Corrected. Ok, Listview has 5 columns Username,Computername,Timein,Date,Serial. Thought process is to use _GUICtrlListView_GetItemTextString($hListView) to get specific row and take each column input and place each into its own Input box. Then run specific commands off these input boxes. I was looking at an example and it was used to split the listview and place into new excel file - thought I could do the same to get my needed results. Yet of course I am not getting to get the divided info into the separate input boxes. Here is my thought process Func ListInput() $iItems = [color=#ff0000]_GUICtrlListView_GetItemTextString[/color]($hListView, 1)) ;EDIT - initially had incorrect line...Corrected.[/color] For $iItem = 0 To $iItems - 1 $Zf = StringSplit($Zf, "|", 1) ;<<<<<<<<<<<<<<<<<<<<<<<< Take string and place into individual input boxes. EndFunc If you could point me to an example or another help file to help me work this out I would greatly appreciate it or am I coming at this from a wrong point of view....? I can get the first columns selected input using $WM_NOTIFY If $fDblClk = True Then $sText = GUICtrlRead($hListView) - 18 ; Read the item GUICtrlSetData($LCount, "List Item: " & $sText) Local $OutPut = _GUICtrlListView_GetItemText($hListView, $sText) GUICtrlSetData($iUserName, $OutPut) $fDblClk = False; Reset the flag EndIf Thank you.
-
Or, what I do is use Active Directory credentials to access a Mysql database. Sign inOut program.
-
My understanding of what is being asked... 1. User creates an account - Stored in MySql. 2. User logs in using a front end connected to Mysql to verify credentials - then runs? Is this a database program with MySql... Bounce credentials off one table to access another?
-
Simple input into label example ;----------- $ListCount = _GUICtrlListView_GetItemCount($hListView) GUICtrlSetData($Count, "List Total: " & $ListCount)
-
The issue was with my While 1 usage - Changed "Switch" ..... While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $nMsg = $Button1 FillList() Case $nMsg = $Button2 MyTest () Case $nMsg = $Button3 Close() EndSwitch WEnd To "Select"... While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ;Or $msg = $exititem ExitLoop Case $Msg = $Button1 FillList() Case $Msg = $Button2 MyTest () Case $Msg = $Button3 Close() EndSelect; WEnd From here is the obvious - Add clear ListView, options for different queries, Choose ListItem to triger event... and so on.... And we move forward.....
-
Had some time to kill so I did some playing around yet I dont have access to the Database until I get to work.... Full test project to this point added. Also I changed line 75 and used _GUICtrlListView_AddItem. Want to see how this will work.... #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> #include <String.au3> #include <GuiListView.au3> #include <mysql.au3> #Region ### START Koda GUI section ### Form= ;--------------------------------------- Global $objDB, $obQuery, $arArray, $sUserName, $sPassword, $sDomain Global $ListView, $refreshlist $objErr = ObjEvent("AutoIt.Error","MyErrFunc") ;--------------------------------------- Local $sServer = "10.100.200.300", $sUsername = "Adam", $sPassword = "vxIcu", $sDatabase = "Doughnut1" Global $objDB = _MySQLConnect($sUsername, $sPassword, $sDatabase, $sServer) ;--------------------------------------- Global $Form1 = GUICreate("Form1", 480, 586, 193, 115) $ListView = GUICtrlCreateListView("", 16, 40, 450, 150) _GUICtrlListView_AddColumn($ListView, "UserName") _GUICtrlListView_AddColumn($ListView, "ComputerName") _GUICtrlListView_AddColumn($ListView, "TimeIn") _GUICtrlListView_AddColumn($ListView, "Date") _GUICtrlListView_AddColumn($ListView, "Serial") _GUICtrlListView_SetColumnWidth($ListView, 0, 100) _GUICtrlListView_SetColumnWidth($ListView, 1, 100) _GUICtrlListView_SetColumnWidth($ListView, 2, 50) _GUICtrlListView_SetColumnWidth($ListView, 3, 50) _GUICtrlListView_SetColumnWidth($ListView, 4, 50) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) $Button1 = GUICtrlCreateButton("Add", 16, 200, 75, 25, 0) $Button2 = GUICtrlCreateButton("Test", 104, 200, 75, 25, 0) $Button3 = GUICtrlCreateButton("Close", 192, 200, 75, 25, 0) $Label1 = GUICtrlCreateLabel("Double click to open history", 16, 16, 183, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $nMsg = $Button1 FillList() Case $nMsg = $Button2 MyTest () Case $nMsg = $Button3 Close() EndSwitch WEnd Func MyTest () $iName = "Bob.Millier" $query = _Query($objDB,"SELECT * FROM Accesslog WHERE Username LIKE '" & $iName & "' AND Date LIKE '2/29/2312' ORDER BY Computername") With $query While NOT .EOF MsgBox(0,$iName,.Fields("Computername").value & " " & .Fields("TimeIn").value & " " & .Fields("Date").value & " " & .Fields("Serial").value &@CRLF) .MoveNext WEnd EndWith EndFunc Func FillList() $refreshlist = _Query($objDB,"SELECT * FROM Accesslog WHERE Username LIKE 'michael.hillier' AND Date LIKE '2/29/2312' ORDER BY Computername") With $refreshlist While Not .EOF _GUICtrlListView_AddItem($refreshlist.Fields("UserName").value & "|" & $refreshlist.Fields("ComputerName").value & "|" & $refreshlist.Fields("TimeIn").value & "|" & $refreshlist.Fields("Date").value & "|" & $refreshlist.Fields("Serial").value, $ListView) .Movenext WEnd EndWith EndFunc Func Close() _MySQLEnd($objDB) Exit EndFunc;=> close Func MyErrFunc() $hexnum=hex($objErr.number,8) Msgbox(0,"","We intercepted a COM Error!!" & @CRLF & @CRLF & _ "err.description is: " & $objErr.description & @CRLF & _ "err.windescription is: " & $objErr.windescription & @CRLF & _ "err.lastdllerror is: " & $objErr.lastdllerror & @CRLF & _ "err.scriptline is: " & $objErr.scriptline & @CRLF & _ "err.number is: " & $hexnum & @CRLF & _ "err.source is: " & $objErr.source & @CRLF & _ "err.helpfile is: " & $objErr.helpfile & @CRLF & _ "err.helpcontext is: " & $objErr.helpcontext _ ) ;exit EndFunc;=> MyErrFunc
-
jCHD - I plan to clean up the script and keep at it until it works. I know its something simple.... Thanks for the suggestion - I'll keep plugging away at it more tomorrow...
-
You know you have to quit when your eyes are blood shot and people are telling you that Man you look beat.... Anyway I'm working with MySql and trying to put a query into a Listview. Problem is with the examples I've been playing with I either get 1. error either BOF or EOF e or 2. the data just simply continues to flow in the listView. I ran accross an entry somewhere here, I think yesterday, but cant find it which had an example that I beleive will open my eyes to my error. Anyway heres the problem portion of the script. As you can see Ive tried two ways to get through the issue. Any guidance is greatly appreciated and will open up the flood gates to this project.... I Func List() $refreshlist = _Query($objDB,"SELECT * FROM Accesslog WHERE Username LIKE 'User.Name' AND Date LIKE '2/29/2012' ORDER BY Computername") ; ; If $refreshlist.EOF Then ; MsgBox(48,"Attention", "The table is empty!") ; $refresh.close ; Return ; Endif ;$rows = _Query($objDB,"SELECT COUNT(*) Username FROM Accesslog") ;$rowcount = $rows.Fields("Username").value ;_GUICtrlListView_DeleteAllItems ($ListView) With $refreshlist While Not .EOF ; For $i = 1 to $rowcount GUICtrlCreateListViewItem($refreshlist.Fields("UserName").value & "|" & $refreshlist.Fields("ComputerName").value & "|" & $refreshlist.Fields("TimeIn").value & "|" & $refreshlist.Fields("Date").value & "|" & $refreshlist.Fields("Serial").value, $ListView) ; $refreshlist.MoveNext ; Next .Movenext WEnd EndWith EndFunc;=> list
-
Retrive Computer name using Login ID on network
MPHillier replied to Pritam's topic in AutoIt General Help and Support
We use a Mysql database and an autoit script to push logon user name, computer name, Ip, date and time, and computer serial to the database. I have a front end VB6 program to retrieve information by various queries. By date, By month, by year, by computer name, by username and so on.... All free just had to built it.... -
Delete User Profiles from Vista
MPHillier replied to Smitro's topic in AutoIt General Help and Support
Smitro, I am looking to create a similar program that will delete all profiles except those I designate. I've come across this and wanted to find out if you have had any luck with your process. My thought process is to read the registry entries - if not matched with my do not delete list then delete registry entry and c:usersProfile folder.... I'm just finishing up on another program project and in the mead time am gathering info for the next. We are testing with Delprof2 and RemProf but because we have multiple sits with different types of profiles that need to stay on the computers I'd like to make a program that will fit our needs. Using a GPO is not 100% and we cannot control what we don't want to delete... Much Thanks -
Issues, Scripting, and Great Stuff
MPHillier replied to MPHillier's topic in AutoIt General Help and Support
Water - Solved I've kept my combo which list 10,20,30 and so on and am using it with a button to check not only the combo info but also user input. if $msg = $bCount then if GUICtrlRead($bCombo) = "..." Then ClearOne() else $sSelection = GUICtrlRead($bCombo) For $i = 0 To $sSelection - 1 GUICtrlSetState($CHKBOX[$i], $GUI_CHECKED) Next EndIf EndIf Thank you for your advise and concise input on your example script... -
Issues, Scripting, and Great Stuff
MPHillier replied to MPHillier's topic in AutoIt General Help and Support
Water - Just got back from the mall with my daughter - Got her a few Angry bird stuffed animals - logged in to see your reply. This looks like it. I ran your example and Cool Stuff. When I have time I'll sit and examin your script closer. Next task is dinner.. Much Thanks -
Issues, Scripting, and Great Stuff
MPHillier replied to MPHillier's topic in AutoIt General Help and Support
Water, Thanks for your reply. 1) I have a working version of the software on my work computer and did not anticipate the newer version to have this issue. - Just wanted to show some of Auto It's usage. 2) Auto Recorder is the base to my package creations. I've always found need to enhance the base to suite our needs. 3) Thanks for adding input on the array. My thought process was correct but when I implemented it and it worked I thought that it was too easy. Had to be a catch down the road.... What would be the logic in creating behind the check boxes? Type # = boxes 1 thru # checked. Array - step through....? ;-------------------- Good stuff - Much Thanks -
1. Issues: So Im working with my Boss - introducing him to Autoit. I had him download the latest version and wanted to show him how easy it was to create an install package for packages with no Msi options. Downloaded fine but when attempting to Autorecord - error's and missing Dlls. Did the same on my end and got the same thing. Both Win7 - one 64bit other 32bit. I ended up loading an older version of the recorder and got it going... I was working over the phone remoted on his desktop - I senced he was kind of frustrated due to the situation..... 2. Scripting. I have a program with 60 buttons and check boxes each representing a computer - 01 thru 60. So I'm looking at arrays to find ways to check and uncheck the checkboxes - No issues there. Then I thought since I have rooms with say only 3 computers and others up to 52. Could I create an input box and run button - Type in a number, say 10, hit that run button and only checkboxes 1 thru 10 become checked. and so on - 30 would check 1 thru 30.... 3. Scripting. I have a combo box that is fead via text file. $eFile = "Process.txt" For $x = 1 To $eRecords[0] $eComboList = $eComboList & $eRecords[$x] & "|" Next $eComboList = StringTrimRight($eComboList, 1) GUICtrlSetData($tproces, $eComboList) - I have an edit box that opens the text file in it so I can edit it then save the file. - I found a way to refresh the combobox to represent my changes to the file without having to reopen the program - Cool stuff... - I've done it by the follwoing after saving the file - running a fucntion - Func SingleListRefresh() $sComboList = "" GUICtrlSetData ($SingleStart, "") $sFile = "SList.txt" If Not _FileReadToArray($sFile, $sRecords) Then MsgBox(4096, "Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 To $sRecords[0] $sComboList = $sComboList & $sRecords[$x] & "|" Next $sComboList = StringTrimRight($sComboList, 1) -Question is this proper to clear the Array or will I have issues down the road....? $sComboList = "" GUICtrlSetData ($SingleStart, "") 3. Great Stuff - Just wanted to add that this has been a great tool for me and work - Install packages, AutoTasking, Tech Utilites, Checking and email processing, WMI, VBS support and so on.. If I can script it... thats my motto... It has really reduced time on many of my daily tasks and site support... I'm trying to get the others I work with, that support other sites, to get on board but I guess each has their own ways.... Thanks for reading and also for advise to my scripting questions.....