Jump to content

Sam1el

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by Sam1el

  1. Yes! I would like it to only print the file if it finds the owrd amro and I woul dlike it appended to the name of the file. I am going to test the suggestions given. Thanks so much for your help and patience. caught a nasty staph infection on the business trip I just returned from and i'm half concious.
  2. Tried to implement this bit I may be missing something. It will parse and write my file according to my defined line but still wot print if it finds the text I'm looking for.
  3. I've tried to write as much of my script as possible without asking for help but i'm stuck. I've searched the forums for my answer and read the help files but not totally sure how to go about my final step. THe code reads a file in a specified drive and writes a log to a server. What I need to add is, I need it to look for a specific word and then write the file if the word is present and not write the file if it isn't. I am sure it's a simple if/elsif and exit but not sure how to approach it. here's a snippet. Select Case @OSVersion = "WIN_XP" If FileExists("C:\Documents and Settings\All Users\Application Data\DassaultSystemes\CATEnv\Teamcenter_Integration_for_CATIAV5.txt") Then FileReadLine('C:\Documents and Settings\All Users\Application Data\DassaultSystemes\CATEnv\Teamcenter_Integration_for_CATIAV5.txt', 10) $PCName = @ComputerName $file = FileOpen("\\server\SCCM_Logs\" & $PCName & "log.txt", 1) ; Write month/day @ time FileWrite($file, @MON & "/" & @MDAY & " @ " & @HOUR & ":" & @MIN & " - ") ; Write computer name along with text FileWrite($file, $PCName & " - " & "File Exists") ; go to next line FileWrite($file, @CRLF) FileClose($file) Exit EndIf EndSelect i'm super close to what I need. THe word i'm looking for is Amro if that'll help/
  4. I"m having a similar issue with a large install string. Runwait('V5_R20_DMU\INTEL\startb.exe' & '-u C:\Program Files\Dassault Systemes\B20_DMU' & '-newdir -ident B20DMU -all -noStartMenuIcon -noStartMenuTools -noDesktopIcon', @ScriptDir) I've tried a million different combinations of switches and quotes. Can't get it to pass the command line arguements no matter what I do.
  5. ahh ok. THen i guess the part in koda I need help withis a browse button with a text box next to it that shows the file you chose that's what i've been fighting with
  6. I been reading up on it all day. been messing with it for an hour or so. I'm managed to create my buttons and get the interface how I like. i'm strugling with the onclick functions at the moment.
  7. Something like that would work. I was thinking more of an interface with some browse type buttons but, that's more than I was able to make it do and your code shows me some of what I was overthinking thank you very much
  8. I"m not gonna lie. I'm completely new. I may be getting in way over my head but I wanted to ask if what i'm doing is even possible. I created a script recently that would read arrays from 2 .csv files and use that info to create a structure of folders with sub folders predetermined. I have been reading the helpfile on gui creation and I have written some of the examples with my own twists multiple times just to understand how they work. What I want the gui to do is allow them to choose their own csv files and then create the directories. I know I will need 2 buttons that will open tree view to select the .csv files they want. I'm just not really sure how to make _filereadtoarray and dircreate integrate with the gui functions. I by no means want anyone to do this for me but maybe a push in the right direction or some examples would be greatly appreciated. Here is the working script i will be using. #include <File.au3> ;needed for _FileReadToArray function Dim $asDirList ;declare array var for lines of file Dim $asDirList2 _FileReadToArray("dir.csv", $asDirList);read lines of file into array with 1st element=num of lines read _FileReadToArray("subs.csv", $asDirList2) If @error Then MsgBox(0, "", "Error, Could not read file.") For $i = 1 To $asDirList[0] For $2 = 1 To $asDirList2[0] $asDirList[$i] = StringRegExpReplace($asDirList[$i], ",(\w+)", " $1") ;replace ,test with _test $asDirList[$i] = StringReplace($asDirList[$i], ",", "") ;remove trailing commas DirCreate(@ScriptDir & "\" & $asDirList[$i] & "\" & $asDirList2[$2]) ;create dir Next Next
  9. Now to create a gui version of it that allows me to select the csv files I want to use
  10. GOT IT!!!!!! #include <File.au3> ;needed for _FileReadToArray function Dim $asDirList ;declare array var for lines of file Dim $asDirList2 _FileReadToArray("dir.csv", $asDirList);read lines of file into array with 1st element=num of lines read _FileReadToArray("subs.csv", $asDirList2) If @error Then MsgBox(0, "", "Error, Could not read file.") For $i = 1 To $asDirList[0] For $2 = 1 To $asDirList2[0] $asDirList[$i] = StringRegExpReplace($asDirList[$i], ",(\w+)", " $1") ;replace ,test with _test $asDirList[$i] = StringReplace($asDirList[$i], ",", "") ;remove trailing commas DirCreate(@ScriptDir & "\" & $asDirList[$i] & "\" & $asDirList2[$2]) ;create dir Next Next
  11. Any pointers on creating specifically named subdiretories in those folders? not to be a pain but i'm looking at creating roughly 6 folders for each of these 650 folders
  12. OMFG! you're the man. I had tried something similar when I began and thought I was overthinking it and couldn't make it work so I started over. You guys rock thanks for all the help.
  13. I have tried every variation we've posted here. I'm throwing my hand in the air. I've only been playing with autoit for a week so I still have much to learn but if someone wants to take a crack at it I will post both files here and. Save them to a folder and run the script you will see the output i'm currently getting which would be perfect if I could just get rid of the commas. Just change the .txt to .csv and it should work. THis is exactly how i want the folders to be created i just need the commas gone lol or even replaced with an underscore would work. foldercreatefromxl.au3 dir.txt
  14. Tried this seems to just ignore anything after the first comma in the row. I may have to find a way to just remove the comma form the directory names with autoit,
  15. I managed to get it working somewhat with #include <File.au3> Global $usrArray _FileReadToArray("dir.csv" $usrArray) For $i = 1 To $usrArray[0] DirCreate(@ScriptDir&"\"&$usrArray[$i]) Next only issue is it's putting commas in the folder names now
  16. So basically this is what I'm doing. My gf was asked to create a folder structure using a list she was given. The list is in excel and has 650 folders to be created and each of the 650 folders will have 6 identical sub directories. This is where I am so far. I can parse the csv file and have it create folders with names pulls from column 1 for example the csv file reads test,test 2,test 3 test 4,, test 5,, but it creates folders named test, test 4 and test 5. what I need it to do is take test test2 and test 3 and use those values to create one folder name and to the same to all the following rows. IE read row1 and create folder test_test2_test3 here's my code. Local $sFile = "dir.csv" Local $aREResult = StringRegExp(FileRead($sFile), ".+(?=\v+|$)", 3) ; returns array of every line Local $iNumLines = UBound($aREResult) ConsoleWrite("$iNumLines; " & $iNumLines & @CRLF) ;Get number of commas / columns. Local $aREResult = StringReplace(FileRead($sFile), ",", ",") ; returns number of commas in file Local $iNumCommas = @extended ConsoleWrite("$iNumCommas per row; " & Int($iNumCommas / $iNumLines) + 1 & @CRLF) Global $aMain[$iNumLines][($iNumCommas / $iNumLines) + 1], $iRow = 0 ; Array for csv file _CSVFileToArray ($sFile) ; Fill array from file ;_ArrayDisplay($aMain, "csv file Results") Func _CSVFileToArray($sFile) Execute(StringTrimRight(StringRegExpReplace(StringRegExpReplace(FileRead($sFile), '"', '""'), "(\V+)(\v+|$)", 'Test1(StringRegExp("\1","([^,]+)(?:,|$)",3)) & '), 3)) EndFunc ;==>_CSVFileToArray ; Fills each row of the required 2D array Func Test1($aArr) For $x = 0 To UBound($aArr) - 1 $aMain[$iRow][$x] = $aArr[$x] Next $iRow += 1 Return EndFunc ;==>Test1 $content=$aMain dircreate($content) For $i = 0 To UBound($aMain) - 1 DirCreate ($aMain[$i][0]) Next any help is greatly appreciated
  17. Hi guys, I'm new to autoit. I've been using it for a couple weeks now to do basic things and I wanted to get into a little more advanced scripting. here is a snippit of code from a cmd file I have. set D3BPPATH=\\d3fs03\install\Randomcompany set ADMIN=%D3BPPATH%\Admin\Scripting set LUMPATH=\\d3fs03\install\CatiaV5\LUM set SITECODE=GV IF NOT "%CLEARED%"=="Y" cls set CLEARED=Y :BP13CHX echo Checking for BlockPoint 13 Installation.... if exist c:\cax\vendor\ds\hfx\b19sp3hfx16\. goto BP13X02 echo. echo Blockpoint 13.0 NOT FOUND - Installing Blockpoint 13.0 now! echo (Blockpoint 13.0x02 will be installed after Blockpoint 13) echo. call %D3BPPATH%\BP_13.0\%SITECODE%_BP.cmd echo. echo. :BP13X02 REM ******************************************* REM * vERSION VARIABLES - ANY SITE REM * REM * THESE VALUES WILL NEED TO BE UPDATED REM * AT vERSION LEVEL REM ******************************************* set VERPATH=%D3BPPATH%\BP13.0X02 set IVTXVER=4.7 set IVTPATH=4.7.19 :lowdisk echo Checking for disk space.... call cscript.exe %ADMIN%\lowdisk.vbs //nologo if %ERRORLEVEL%==1 goto END I'm trying to figure out how to convert this to an exe format with autoit. it seems to run fine with all but the "set" options but i can't seem to find the proper way to rewrite it. and help or pushes in the right direction would be great, I by no means want anyone to rewrite it for me just some links or something that may explain it better would be nice thanks.
×
×
  • Create New...