Jump to content

Remo1075

Active Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by Remo1075

  1. Thanks a lot, you've been a great help.
  2. Thanks, for the tips. I don't understand the regex below can you explain it for me at all. (?m)^(?:.*?,) {' & $col-1 & '} ;This is clear, look in column 7 ([^\r\n,]*)
  3. I have managed to simplify it by just deleting the original test.csv file and have a new one generated each day with new results in it. So I don't need a 2nd csv file. I have substituted the numbers in the column for ip addresses to make it easier to understand what I'm trying to do. Only problem I have now is it tries to ping Personnel. because it finds it in the array. Can I exclude this some how? #Include <Array.au3> Global $txt = FileRead(@ScriptDir & 'test.csv') $col = 7 ; column to get $array = StringRegExp($txt, '(?m)^(?:.*?,){' & $col-1 & '}([^rn,]*)', 3) ;_ArrayDisplay($array) For $i = 0 To UBound($array) - 1 ;MsgBox(0, "Output", $array[$i] & @CR) RunWait(@ComSpec & " /k " & "ping " & $array[$i]) Next
  4. Sure, here it is. I had to rename it to test.txt from test.csv as it doesn't allow me to upload csv files. I am moving the regex around, I need column G. What I have so far, but is also returns values in other columns. $res = StringRegExp($txt, 'd{5}', 3) test.txt
  5. Thanks to all for the quick replies. I thought that I might have to use an array, I have not used them before. I tried using the code from mikell, but am struggling to make sense of the regex. I only get a returned result when using $col = 1 and then I don't get back what is actually in column 1. The results I need are all in column 7 and are only numbers, except for the top cell which is the heading.
  6. Hi, I am looking for help on reading a CSV file, specifically I need to read one column of data under the heading Personnel Number. I thought about using the Excel.au3 set of UDF's but the script would run on a server and I wont have exel installed on it. There will be new numbers added to this column daily, my goal is to search only this column for new additions and then be able to call each new number against a variable. eg, 2 new numbers found. $var1 $var2 These numbers represent a personal ID that exists in active directory, the account would then have xyz performed on it. poll AD for $var1 then perform xyz on the account repeat for $var2. Thanks for any help.
  7. Thanks alot...Great Help
  8. Hi, thanks for your reply. I still get 0 return value in the msgbox when I add _ExcelBookOpen and _ExcelBookClose, because I'm dealing with possibly hundereds of excel sheets idealy I dont want the script to physically open an instance of Excel everytime which is what _ExcelBookOpen and _ExcelBookClose is doing. I am still facing an issue of not being able to read a cell value from an array of loaded excel sheets. Thanks for posting.. [/i] [i][i]#include <RecFileListToArray.au3> #include <Excel.au3>[/i][/i] [i][i]$sDir = @ScriptDir[/i][/i] [i][i];List all xls files to array. $aFiles = _RecFileListToArray($sDir, "*.xls", 1, 1, 0, 2)[/i][/i] [i][i]For $i = 1 To $aFiles[0][/i][/i] [i][i]_ExcelBookOpen($aFiles[$i]) Sleep(200) $sCellValue = _ExcelReadCell($aFiles[$i], 2, 1) _ExcelBookClose($aFiles[$i])[/i][/i] [i][i]MsgBox(0, "", "Cell Value is: " & @CRLF & $sCellValue, 2)[/i][/i] [i][i]Next[/i][/i] [i]
  9. Thanks for the pointer.. I have started off with the code below but it seems to always return a value of 0 even though the cell has data in it. #include <RecFileListToArray.au3> #include <Excel.au3> $sDir = @ScriptDir ;List all xls files to array. $aFiles = _RecFileListToArray($sDir, "*.xls", 1, 1, 0, 2) For $i = 1 To $aFiles[0] $sCellValue = _ExcelReadCell($aFiles[$i], 1, 2) MsgBox(0, "", "Cell Value is: " & @CRLF & $sCellValue, 2) Next
  10. Hi everyone, I have a script that I'm using that when run on a pc creates a folder on a remote share with an Excel file under it. The Excel file contains serial numbers of all software on the computer, I need to write another sctipt that runs through the root folder and in to the subfolders, polls all Excels looking for say a cell that contains Adobe and the cell next to it contains the serial number. Get that information and write it out to a single Excel called adobe.xls. I am not an expert in scripting but think that it might be able to be done using an array? Any pointers, much appriciated.
  11. Thanks Tvern, You hit the nail on the head. You were right about the sleeps but I couldnt figure a way around it. Now I just need to try follow your logic in the script. Thanks again.
  12. Hi Manadar, Thanks for your quick response, the code seems to work exactly the same as before. Maybe I am missing something, my problem is that the exit button is not being read/processed while the do ... untill loop is running. The below bold code is where I am having problems. Until $check_state_of_checkbox = $GUI_UNCHECKED ;[b]or IF [/b]$check_state_of_Button1 = [b]4 then [/b]exit
  13. Hi, Hoping someone can help me on the logic, I just can't seem to find a way to exit the "when checked" loop using the exit button. Thanks before hand. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: Script Function: Move Mouse #ce ---------------------------------------------------------------------------- #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("MouseMove", 200, 69, 310, 296) WinSetOnTop("MouseMove", "", 1) $Checkbox1 = GUICtrlCreateCheckbox(" ON or OFF", 8, 16, 89, 33) $Button1 = GUICtrlCreateButton("Exit", 104, 24, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW, $Form1) While 1 $nMsg2 = GUIGetMsg() Select Case $nMsg2 = $GUI_EVENT_CLOSE Exit Case $nMsg2 = $Checkbox1 $check_state_of_checkbox = GUICtrlRead($Checkbox1) If $check_state_of_checkbox = $GUI_CHECKED Then Do $pos = MouseGetPos(0) $pos1 = MouseGetPos(1) $pos2 = $pos + 2 $pos3 = $pos1 + 2 MouseMove($pos2, $pos3) Sleep(1000) $pos4 = MouseGetPos(0) $pos5 = MouseGetPos(1) $pos6 = $pos4 - 2 $pos7 = $pos5 - 2 MouseMove($pos6, $pos7) Sleep(1000) $check_state_of_checkbox = GUICtrlRead($Checkbox1) $check_state_of_Button1 = GUICtrlRead($Button1) Until $check_state_of_checkbox = $GUI_UNCHECKED ;or IF $check_state_of_Button1 = 4 then exit EndIf Case $nMsg2 = $Button1 GUIDelete($Form1) ExitLoop EndSelect WEnd ;MsgBox(64,"","" & $Button1)
  14. Hi, stumbled accross this and it looks like it's what I'm looking for. How would I take this a little further and make part of the regread a wildcard? You have RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\rno\S9" If it was maybe S9, S8 or S7.
  15. Hello all, I have been looking around the forum and was wondering if anyone has tried this. I want to connect to a mailbox and export all mail in that mailbox as *.msg files to a share. Keeping the original folder structure and creating folders on the share as well. Thanks for any pointers or directions to other posts.
  16. Yes, yes I'm sure you have hit the nail on the head. It's not a problem with the code, but it's like it's run once and now it's moving on to the next line.
  17. I will try it with guigetmsg quickly. $answer variable is the variable for the msgbox() On a msgbox(68, "","") ( shows info icon and YES and NO Button ) Button Pressed Return Value OK 1 CANCEL 2 ABORT 3 RETRY 4 IGNORE 5 YES 6 NO 7 TRY AGAIN ** 10 CONTINUE ** 11 Because 7 = NO it calls the gui/func again then runs through ALL of the original 1st post code again. But the 2nd time it does not run the If $answer = 7 statement for whatever reason. it just jumps to the end and runs the setup.exe. $answer = MsgBox(68, "File hash check is " & $sData , "Only English will be installed, are you sure?" & @CRLF & _ "Nur Englisch wird installiert, sind Sie sicher?")
  18. The function is a GUI that is about 130 lines of code. I don't want to call the msgbox untill $answer = 2 but have it go around again if the user hit's NO again. It seems to do it once then never shows the msgbox the next time around. Calling the main gui func again would always make the value If $sData = "695689BD" as it starts again with a new file. Basicly the code works below that I have, but only once.
  19. Hello all, I'm sure this is a very simple fix but I just can't see it. After the gui/_func() closes it runs the next bit of code below which runs fine but only once. If I hit "No" answer 7 it should run the func() again then run in to the below code yet again. But the 2nd time around it seems to skip the if $answer = 7 bit and go to the setup.exe. It should continue to run through the If statement and call the Func() again as long as I keep selecting NO. ;If CRC32 = 695689BD then pop up a box to ask if you are sure, if yes then continue on, if no then call _func() Global $sFile = @WindowsDir & "\Config.xml" Global $sData Global $answer $sData = _CRC32ForFile($sFile) If $sData = "695689BD" Then $answer = MsgBox(68, "File hash check is " & $sData , "Only English will be installed, are you sure?" & @CRLF & _ "Nur Englisch wird installiert, sind Sie sicher?") EndIf If $answer = 7 Then ;No _Func() EndIf If $answer = 2 Then ;Cancel Exit EndIf ;Execute the script with all param ;run some setup.exe
  20. Thanks guys for all the quick responses, one of the reasons why I love Autoit and the Autoit community. Sh3llC043r - Thanks alot just what I was looking for, I should be able to patch that in to my main script.
  21. Hello, I'm having trouble trying to get the below code to add up the results of all IF statements as variables and if they = 0 (no boxes selected) then to ask in a msgbox, are you sure you want to proceed as you have not selected any boxes. Thanks for any help. While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Start If GUICtrlRead($German) = $GUI_CHECKED Then _FileWriteToLine(@WindowsDir & "\Config.xml", 4, '<AddLanguage Id="de-de" />', 1) If GUICtrlRead($French) = $GUI_CHECKED Then _FileWriteToLine(@WindowsDir & "\Config.xml", 5, '<AddLanguage Id="fr-fr" />', 1) If GUICtrlRead($Italian) = $GUI_CHECKED Then _FileWriteToLine(@WindowsDir & "\Config.xml", 6, '<AddLanguage Id="IT-IT" />', 1) If GUICtrlRead($Spanish) = $GUI_CHECKED Then _FileWriteToLine(@WindowsDir & "\Config.xml", 7, '<AddLanguage Id="es-es" />', 1) If GUICtrlRead($Dutch) = $GUI_CHECKED Then _FileWriteToLine(@WindowsDir & "\Config.xml", 8, '<AddLanguage Id="nl-nl" />', 1) If GUICtrlRead($Portuguese) = $GUI_CHECKED Then _FileWriteToLine(@WindowsDir & "\Config.xml", 9, '<AddLanguage Id="pt-pt" />', 1) If GUICtrlRead($Swedish) = $GUI_CHECKED Then _FileWriteToLine(@WindowsDir & "\Config.xml", 10, '<AddLanguage Id="sv-se" />', 1) If GUICtrlRead($Finnish) = $GUI_CHECKED Then _FileWriteToLine(@WindowsDir & "\Config.xml", 11, '<AddLanguage Id="fi-fi" />', 1) If GUICtrlRead($Czech) = $GUI_CHECKED Then _FileWriteToLine(@WindowsDir & "\Config.xml", 12, '<AddLanguage Id="cs-cz" />', 1) If GUICtrlRead($Russian) = $GUI_CHECKED Then _FileWriteToLine(@WindowsDir & "\Config.xml", 13, '<AddLanguage Id="ru-ru" />', 1) Exitloop EndSwitch WEnd
  22. Wish I knew that command last week, I used WMI to query for it. $1 = ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\localhost\Root\CIMV2\Applications\MicrosoftIE") If Not IsObj($1) Then Exit ;Check if IE7 is Installed $2 = $1.ExecQuery("SELECT * FROM MicrosoftIE_Summary") For $3 In $2 $result = ($3.Version) Next $result1 = StringLeft($result, 1) If $result1 = 7 Then Exit Else ShellExecute("B:\IE7.exe") ;MsgBox(0, "test", "" & $result1) EndIf
  23. OK, thanks alot, that did it. I actually read that bit but was concentrating too much on trying to output a hard copy of the file as well. Once again thanks for your help.
  24. As soon as I add co-ordinates to the _screencapture_capture() office clipboard does not capture it which is my whole point to use x y #Include <Clipboard.au3> #Include <ScreenCapture.au3> $a = _ScreenCapture_Capture("c:\out.bmp", 0, 0, 796, 596) _ClipBoard_Open("") _ClipBoard_Empty() _ClipBoard_SetDataEx($a, $CF_BITMAP) _ClipBoard_Close() This results in the following attached error from mspaint.
  25. I can't get my script to paste to the body of an e-mail (outlook) or to mspaint. Other applications like Word and Powerpoint seem to accept the contents of the clipboard just fine. I am currently using bmp format to maybe make things a bit easier but would chnage it to png in the end for e-mail and compression reasons. $sBMP_Path = @DesktopDir & "\ScreenCapture.bmp" _ScreenCapture_Capture($sBMP_Path, $iX1, $iY1, $iX2, $iY2, False) _ClipBoard_Open(0) _ClipBoard_SetData($sBMP_Path,$CF_BITMAP) _ClipPutFile($sBMP_Path) _ClipBoard_Close() ;This also seems to work just as well, meaning it still won't paste to mspaint or to the body of an e-mail in Outlook. ( adds it as an attachment) $sBMP_Path = @DesktopDir & "\ScreenCapture.bmp" _ScreenCapture_Capture($sBMP_Path, $iX1, $iY1, $iX2, $iY2, False) _ClipPutFile($sBMP_Path) Thanks for any insight
×
×
  • Create New...