
ennis
Active Members-
Posts
28 -
Joined
-
Last visited
ennis's Achievements

Seeker (1/7)
0
Reputation
-
youre right actually they are all unicode..didnt know about that..will try it out..Thanks *Works Thank you Ennis
-
i will attach some file tommorow..but it doesnt matter which files are used. It never says theres an error. So im assuming its not working. I took a registry export txt file, made a copy and added some random text in one of them...It tells me they both match..which they dont.
-
Heres a function that compares 2 txt files to see if they match. If not it outputs the line that doesnt. The section that compares the 2 strings doesnt work( if $line1 <> $line2 then.....)...Im not sure why..It seems simple enough..But heres to fresh pair of eyes..I'll update this for others once it works as i had trouble finding one that does the job. Thanks. Ennis Func compare($file1, $file2) ;check if 2 passed files exist if not fileexists($file1) then msgbox(4096, "Error", $file1 & " does not exist!") return endif if not fileexists($file2) then msgbox(4096, "Error", $file2 & " does not exist!") return endif ;open files in read mode Local $handle1 = fileopen($file1, 0) Local $handle2 = fileopen($file2, 0) ;store txt lines read Local $line1 = "" Local $line2 = "" ;have 2 counts to record current line number Local $linecount1 = 1 Local $linecount2 = 1 ;2 vars to store @ error for each file read Local $error1 = 0 Local $error2 = 0 ;loop 1 While 1 $line1 = filereadline($handle1, $linecount1) $error1 = @error $line2 = filereadline($handle2, $linecount2) $error2 = @error ;if end of 1 reached --check eof 2 --if both yes then exit ---else quit say one file ended other file not at line count..print last line of not ended. select case $error1 = 1 msgbox(4096, "Error", $file1 & " open error! Quitting compare()") Return case $error2 = 1 msgbox(4096, "Error", $file2 & " open error! Quitting compare()") return case $error1 = -1 and $error2 = -1 EXITLOOP case $error1 = -1 and $error2 <> -1 msgbox(4096, "Error", "Files do not match!") msgbox(4096, "Error", $file1 & ": EOF reached") msgbox(4096, "Error", $file2 & ": Still on line " & $linecount2) msgbox(4096, "Error", "Line: " & $line2) return case $error2 = -1 and $error1 <> -1 msgbox(4096, "Error", "Files do not match!") msgbox(4096, "Error", $file2 & ": EOF reached") msgbox(4096, "Error", $file1 & ": Still on line " & $linecount1) msgbox(4096, "Error", "Line: " & $line1) return Endselect if $line1 <> $line2 then msgbox(4096, "Error", "Files do not match at Line " & $line1 & " !") msgbox(4096, "Error", $file1 & " Line:") msgbox(4096, "Error", $line1) msgbox(4096, "Error", $file2 & " Line:") msgbox(4096, "Error", $line2) ENDIF $linecount1 = $linecount1 + 1 $linecount2 = $linecount2 + 1 WEND msgbox(4096, "Event", "EOF reached for both files. Compare completed successfully!") ENDFUNC
-
Im guessing u dont want to list subdirectories and their files as well? Let me know...I may have smthng for that.
-
Newbie questions / syntax and "stop" command
ennis replied to ktvegas's topic in AutoIt General Help and Support
hmm how about using a while loop and select-case: while 1 if $a < 5 and $b = 1 then mouseclick("windowtitle", "windowtext", "buttonXYZ") elseif $a > 5 and $b = 0 then mouseclick("windowtitle", "windowtext", "buttonXYZ") elseif someothercondition EXIT else EXIT endif WEND the last elseif someothercondition and else use the exit command. Use only one of them. I dont know when you want to exit. If u decide to put this in a function, you can also say return instead of exit and it will exit the funtion and go on to the next commend (if no other commend it will exit the script). Hope it helps Ennis -
Thnx bud..the copy command did it..One weird thing is sometimes it adds a weird square character at the end -> -.maybe its a dos carriage return.not sure..but it doesnt on larger files... I appreciate the help Ennis
-
Im trying to merge some text files into a new empty text file..some are a few megs others smaller. My code doesnt seem to work. It only adds carriage returns into the new file. I've tried the _fileappend function as well..it does the same thing mine does. here it is (btw the array contents or size really doesnt matter as long as it has an entry for each file which it does): Local $regHandle = fileopen("C:\reg.txt", 1) for $count = 0 to ubound($regArray) - 1 if fileexists('C:\temp\reg' & $count & '.tmp') then Local $tmpregHandle = fileopen('C:\temp\reg' & $count & '.tmp', 0) Local $regString while 1 $regString = filereadLine($tmpregHandle) if @ERROR = -1 then EXITLOOP filewriteLine($regHandle, $regString) WEND fileclose($tmpregHandle) else msgbox(4096, "Error", "File " & $count & " does not exist!") endif Next fileclose($regHandle) and ive also tried this Local $regHandle = fileopen("C:\reg.txt", 1) for $count = 0 to ubound($regArray) - 1 if fileexists('C:\temp\reg' & $count & '.tmp') then Local $tmpregHandle = fileopen('C:\temp\reg' & $count & '.tmp', 0) Local $regString = fileread($tmpregHandle, filegetsize('C:\temp\reg' & $count & '.tmp')) filewrite($regHandle, $regString) fileclose($tmpregHandle) else msgbox(4096, "Error", "File " & $count & " does not exist!") endif Next fileclose($regHandle) not sure why it wont work..my best guess is maybe its too big of a string but the line by line version should have fixed that. Well thnx if u figure it out. Ennis
-
Deleting the registry key of the running script
ennis replied to maxcronjob's topic in AutoIt General Help and Support
See if this helps. IF it creates the entry in the same spot all the time (does it???) you can create a .reg file to delete the registry. All you do is package this .reg file with your script and copy it to say c:\temp or seld destructing batch file or smthng like that. Then use the AT command to schedule anew task. The task will be to run the reg file. Your script will set it to run at the end of the script after say 2 minutes..Your script should be done then...and the task will run and delete the registry entry. These may help: Writing a .Reg file http://msdn.microsoft.com/library/default....gistry_File.asp Using AT command: http://support.microsoft.com/default.aspx?...b;en-us;Q313565 Good Luck -
i think he wants to trap program errors not autoit errors...For example a program gets fatal/non fatal error..he can check what the error is and its description....either builtin description or displayed text. I suppose u can kinda do that now by checking for existing windows and window text but u wont know if its an error or not..cuz u cant get its decription. It would be nice if windows are identified as error windows or event windows...etc I dunno..i dont have too much use for it right now because i know what windows to expect - errors and not
-
thanks
-
if anyones done this before.....is there a way to give psexec the domain of the user im giving...i want to logon as the domain administrator no the local administrator. thanks, Ennis
-
incase inyone gets in my precarious position...heres my solution to this: create a batch file and place that in the runonce registry entry. Batch file located remotely. batch file: net use j: \\box\dir /persistent:no cd j: j: J:\autoit3 J:\script.au3
-
i run this and unexpectedly it restarts before it should..heres the section if $install_t1 = 1 then modLog("install", "Event", "Call installBES102() for BESX 400/401") installBES102() IniWrite("autoSIP_module_BES_temp.tmp", "STAGE", "installStage", 2) modLog("install", "Event", "Done 1st phase of install for BESX 400/401") $install_t1 = IniRead("autoSIP_module_BES_temp.tmp", "STAGE", "installStage", 2) endif if $install_t1 = 2 then modLog("install", "Event", "Call 2nd phase of install for BESX 400/401") install201() modLog("install", "Event", "Done 2nd phase of install for BESX 400/401") ;elseif $install_t1 = 3 then output DOne this function endif FUNC install201() modLog("install201", "Event", "Turn autoLogon ON") ;Set autologin on auto_login(1) ;Add module to runonce modLog("install201", "Event", "Add module to RunOnce") RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce", "Launch autoSIP", "REG_SZ", $scriptPath & "\autoSIP_module_BES_xLaunch.bat") modLog("install201", "Event", "All install stages complete - Restart") IniWrite("autoSIP_module_BES_temp.tmp", "STAGE", "installStage", 3) ;Restart system Shutdown(2) exit ENDFUNC it should restart at the bottom where it says shutdown....but it restarts right after finishing installBES102()..theres no shutdown in that function. Thanks for the insight EDIT: yes it does go through the first if statement because $install_t1 is set to 1 innitially.
-
ok more wierdness.. i used to be able to drag a script file to autoit3.exe and it would launch....now i have to double click autoit and so on....so i thoguht at least....i made a test script: ;test.au3 msgbox(1, "g", "ff") and i could drag this normally like b4...now also i can even launch this from the command line remotely or use a batch script. My script includes a bunch of scripts and all together its 1000+ lines...is there a limitation to the size of the script to be able to launch from command line or drag and drop (remotely located script that is)?? im dumbfounded
-
np....yeah autoit looks for the script in the docs&settings folder by default...so it brings up the error cant find script c:\docs.......\script.au3 with both autoit and the script specified using full path in regedit....nothing happens at startup wrt the script