sulfurious Posted August 18, 2006 Posted August 18, 2006 Suppose you had this code OStream.WriteLine Valname & Val1 & ",1,\": OStream.WriteLine " " & Right(cLine, Len(cLine) - vP - 7): vCk = 1 where Valname = "ImagePath" Val1 = "=hex:" cLine = ""ImagePath"=hex:73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\" vP = 11 The file being read is a .reg file. The above vbs line writes the line in a certain format. However, because this is a hex value and there is a "\", the hex value continues on following lines. I have not used the ":" like that before, but it appears to keep writing lines until the end of the hex value is reached, then it assigns vCk = 1. All without moving around in the loop that reads the file. Is there anything similar for AutoIt? I realize I can work through the file one line at a time with clever coding. But that is a pretty nifty feature vbs has there if it is doing what I think it is doing. Any thoughts? Sul
randallc Posted August 18, 2006 Posted August 18, 2006 Hi, I think there is nothing special about the ":" - it could have been written on separate lines. Post the script and then someone will probably convert it ... [put a "wscript.echo" inside the loop to check how often it loops etc...] Best, randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
sulfurious Posted August 19, 2006 Author Posted August 19, 2006 Pretty much what you see in the top piece of code is what the line says. There is some logic before it, If Else type stuff to test for different StingInStr values. But, once it gets to that poing, it seems to be doing 3 things. Especially the last one, setting a vairable = 1. The only way I have ever seen that done on the same line would be in something like batch. I have not seen that in VBS. Anyway, I finally decided to just build a longer loop. But for future reference it would be nice to know what that does. When you have to use vbs for something, anything to speed it up helps Later, Sul
MHz Posted August 19, 2006 Posted August 19, 2006 OStream.WriteLine Valname & Val1 & ",1,\" OStream.WriteLine " " & Right(cLine, Len(cLine) - vP - 7) vCk = 1 FileWriteLine($file, $Valname & $Val1 & ",1,\") FileWriteLine($file, " " & StringRight($cLine, StringLen($cLine) - $vP - 7) $vCk = 1 Nothing special to the VBS code you show, Sul. It is rather ordinary code which has been added on to one line which VBS allows more then one command per line by using semicolons to separate them. The Stream object is what VBS uses for writing files as compared to AutoIt's writing functions. To be honest, the use of semicolon's in the VBS was abused to make poorly readable code. It is fine for the simpler items like very small loops etc.
sulfurious Posted August 19, 2006 Author Posted August 19, 2006 I see. I don't think then that it did what I thought it was going to do. The logic threw me because I thought it was some kind of a special looping command. But as it turns out, the vb code snippet I was using, it just stopped the line there, although the next line should have been concated. I did not think the author would do that, but he did. I made it mo' better now Sul
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now