-
Posts
34 -
Joined
-
Last visited
Everything posted by DeFuser
-
Sorry, perhaps I should have been more specific. The utility reads settings from an central .ini and kicks-off the backup locally, and without user intervention. For example, if the .ini says that machine X needs backups of C:, D:, and the System State, the utility builds the .bks file and then fires-off NTBackup, telling it to use said .bks file. I'm thinking of creating the .bks file using Little Endian and then stripping off the first two bytes, but I am unsure as to whether a) this will work, or b ) that it's the best approach. I'm not the fastest at making this stuff (it's usually some trial and lots of error), but the .bks files are 2 or 3 lines at most so I figure that it can't be that difficult of a thing to do manually, right? Thanks, DeF
-
Hello All, I'm putting together a routine that runs NTBackup.exe from the command line. Part of this entails creating a .bks file (which tells NTBackup *what* to backup) on the fly. The problem is that (and it took a while to track this down) .bks files created via the NTBackup GUI look like this when viewed in a hex editor: S.y.s.t.e.m.S.t.a.t.e. I've tried opening and writing to the file using different encodings, but haven't been met with much love - Little Endian add gibberish to the beginning of the file, and Unicode doesn't add the "00" bytes. What is the best way to address this? Is there an encoding setting that I am missing or should I go about inserting the "00" bytes manually? I've attached an image of the file as seen in the editor. Thanks, DeF
-
Sweet. That is exactly what I was looking for (and also explains why it wasn't working using the "... with an ampersand (&) to {ENTER} concatenate ..." method. Nice example too Thanks, DeF
-
Is there a way to format the text within a plain ol' message box (add hard returns, italics, and the like)? Thanks, DeF
-
Here is the requested (as well as almost finished) example, replete with Larry's spot-on advice. Thanks guys, I really appreciate the input (and feel free to offer criticism of my methods too). Regards, Def (edited to switch from |codebox| to |autoit|) #NoTrayIcon #Include <Array.au3> #Include <File.au3> #Include <date.au3> #include<string.au3> AutoItSetOption("MustDeclareVars",1) HotKeySet("{F9}", "Terminate") If $CmdLine[0] = 2 Then Dim $Path = $CmdLine[1] ;sets the path Dim $Days = $CmdLine[2] ;sets files older than X to be deleted Else MsgBox(64, "Error - Correct usage is:", "PURGEFILES [path] [days]", 0) Exit EndIf Dim $FileList = $Path & "\_" & Random() & ".txt" Dim $TodaysDate = StringTrimRight(_Nowcalc(),9) ;returns date in yyyy/mm/dd format Dim $TotalLines Dim $CurrentLine Dim $TargetFile Dim $Timestamp Dim $AgeInDays FileOpen($FileList,0) RunWait(@ComSpec & " /c " & 'dir ' & $Path & ' /B /L /S > ' & $FileList, "", @SW_HIDE) $TotalLines = _FileCountLines($FileList) For $CurrentLine = 1 to $TotalLines $TargetFile = FileReadLine($FileList,$CurrentLine) If FileExists($TargetFile) = 1 Then $Timestamp = GetFileTimestamp($TargetFile) $AgeInDays = _DateDiff("D", $Timestamp, $TodaysDate) If $AgeInDays > $Days Then If Not StringInStr(FileGetAttrib($TargetFile),"D") Then MsgBox(64, $TargetFile & " : " & $AgeInDays & " : " & FileGetAttrib($TargetFile), "This would be deleted.", 0) ;FileDelete($TargetFile) EndIf EndIf EndIf Next FileDelete($FileList) Func GetFileTimestamp($File) $Timestamp = FileGetTime($File,1,1) $Timestamp = StringTrimRight($Timestamp,6) $Timestamp = _StringInsert($Timestamp,"/",6) $Timestamp = _StringInsert($Timestamp,"/",4) Return $Timestamp EndFunc Func Terminate() Exit EndFunc
-
Hello all, I wrote a utility that culls through a given path and deletes files more than X days old. My concern is that I make use of the DIR /B /L /S command, which lists both files and folders. I don't want to delete any folders. I've searched the help file and have yet to find a command that can test as to whether a path is a folder. If I use FileExists and give it a folder path it returns 1. If I use FileDelete and give it a folder path is doesn't *seem* to delete the folder (but I want to be certain before I run this on real data). My questions are: 1) Is there a command to check whether an entity is a folder? 2) Will FileDelete delete folders? (I don't think it does, based on experience and the existence of DirRemove) If the above answers are no and yes respectively, any insight on how to approach the issue would also be appreciated. Thanks, Def
-
I only use the check/unchek method when I absolutely have to (as the get control number - give it focus - check/uncheck routine gets to be a pain). Try to get the installation working by using a sequence of keystrokes ... For example, tabbing to a control and then using space bar to toggle the check. You'll find very few installations that can not be installed via keystrokes alone. Hoping this helps, Bryan Edit - ***ooops too late ***
-
-
Exactly - Once you have returned the shortcut name via $info = GUICtrlRead($List), then run value through a Select Case. Case $info = xxxx Run(xxxx) Case $info = yyyy Run(yyyy)
-
I'd probably go with the method of running a Select Case on Valuater's $info variable. Cheers, Def
-
Beautiful! Now I have 2 ways to tackle issues of this type. Thanks, Def
-
Post import, $aTempArray holds 600+ computer names which I then migrate to a multi-dimensional array. Once the data is transferred, I see no reason to have $aTempArray hanging out in memory. I couldn't find a way to kill it other than by making it local to a function. Is there any other way to remove unused variables? Of course, your suggestion regarding redim (which I never even thought of) makes the entire discussion pointless (at least in this circumstance). Once again, thanks for the pointers and the insight. Cheers (and relatively new to this), Def
-
Wow, thank you very much. Not only was that a great idea, but you were spot-on. When moving the .exe I totally forgot about moving the original file along with it. In the future, I'll make it a point to check error flags. Thanks again! Hey, if you don't mind my asking - What's your take on deleting $aTempArray? Im I going about it in the correct manner? Wondering what it's like to be gifted, Def
-
Hello all, In one of my scripts, I have the following code: Func CreateArray() Local $aTempArray _FileReadToArray($File, $aTempArray) For $iAE1 = 0 to $aTempArray[0] $aArray[$iAE1][0] = $aTempArray[$iAE1] Next Return $aTempArray[0] EndFunc AU3Check finds no errors. If I run this within SciTE all is well. If I create and run a compiled .exe from my memory stick (drive B: - where the thing was created) all is well. If I move the .exe to another location (C:\..., Desktop, etc.) AutoIt barks with the following: For $iAE1 = 0 to $aTempArray[0] For $iAE1 = 0 to $aTempArray^ERROR Error: Subscript used with non-Array variable. Can anyone shed light on this? Also, the only reason I have the above in a function it that I didn't want $aTempArray hanging around for the life of the .exe and figured that this would kill it when CreateArray() ended. Is my thinking right on this or is there a command to destroy a variable? Cheers, Def
-
Software Installation Console(My dream)
DeFuser replied to Bio's topic in AutoIt General Help and Support
Also, try to rely more on keystrokes and less on mouse movements. If you keep this in mind, a lot of the individual installation routines (as you have already noticed) will consist mainly of "Send("!n")" Best of luck, Def -
#NoTrayIcon #Include <Misc.au3> Opt("MustDeclareVars", 1) Dim $dll = DllOpen("user32.dll") Dim $pos[2] Dim $kicks While 1; main loop HotKeySet("{F9}", "Terminate") Do Sleep(100) Until _ispressed ("77", $dll) = 1; do nothing until F8 is pressed For $kicks = 0 To 3; 4 balls - 4 cycles $pos = GetCoordinate() Sleep(2000) TapThatBar($pos) Sleep(2000) Next WEnd DllClose($dll) Exit Func GetCoordinate(); sets the position of the pixel to check Dim $pos While _ispressed (01, $dll) = 0; detect left mouse click $pos = MouseGetPos() Sleep(50) WEnd Return $pos EndFunc Func TapThatBar($pos); sends a {space} when the target pixel is white Local $pix_color Do $pix_color = PixelGetColor($pos[0], $pos[1]) Until $pix_color = 16777215 Send("{SPACE}") EndFunc Func Terminate() Exit 0 EndFunc I wrote the above to detect when a given pixel (set by mouse click) was white. Once said rascal turned white, the code "TapsThatBar" (space bar). I am sure that you can get it to check a given area with a little tweaking. Good luck BTW - I'm new to this, so if anyone can offer pointers on my code (better practices, bad habits, etc.) feel free to comment. Cheers, Def
-
And a n00b at IE too!
-
Running compiled scripts over the WAN
DeFuser replied to DeFuser's topic in AutoIt General Help and Support
WinWaitActive("MicroStation Setup", "Setup has finished") Send("{ENTER}") WinWaitActive("MicroStation V8 2004 Edition ReadMe") Sleep(1000) WinClose("MicroStation V8 2004 Edition ReadMe") WinWaitActive("C:\Documents and Settings\All Users\Start Menu\Programs\MicroStation") Sleep(1000) WinClose("C:\Documents and Settings\All Users\Start Menu\Programs\MicroStation") Else MsgBox(48, "Microstation V8 is already installed. Moving on to PDF Composer installation.", 3) EndIf ; ===== End Microstationv8 installation ===== ; ===== Start Microstation PDF Composer installation ===== If FileExists("C:\Program Files\MicroStation PDF Composer\")=0 Then MsgBox(64, "Status", "Beginning PDF Composer installation.", 3) Select Case $location = "Houston" After examining the code as you suggested the two "Sleep(1000)" comments stood out like a sore thumb. I remember having to throw those into the mix in order to get the final nag windows to close properly. Strangely enough, this is where the script stalls during remote installs. Come to think of it, the remote offices generally have older (slower) machines and run Win2K as opposed to XP ... I'll try bumping that value see what happens. Can you suggest a better method to kill those last two windows? Thanks for pointing me in the right direction! Def -
Ahhh, thanks for the encouragement! I figure that while true proficiency is still a (long) way off, at least the code snippets I stumple across are beginning to look less gibberishish ... and that's a definite good sign!
-
I'm glad to assist. More than you know actually, because this is the first time I've actually been able to contribute (as opposed to ask questions). Cheers, Def
-
The following works for me (when opening the file "test.txt" in Notepad: While 1 If WinExists ( "test.txt - Notepad", "" ) Then Sleep(200) WinKill( "test.txt - Notepad", "" ) EndIf WEnd Try using WinExists and a While-WEnd loop. Cheers, Def
-
How to detect XP Home vs. XP Pro, etc.
DeFuser replied to Wyleyrabbit's topic in AutoIt General Help and Support
That approach sounds like an excellent idea to me - Something that I would come up with on my own actually. Of course, I am new to this ... So be careful! -
Running compiled scripts over the WAN
DeFuser replied to DeFuser's topic in AutoIt General Help and Support
First off, let me say thanks for your input on this. Are you suggesting replication of the script folder to each of the remote offices, or copying the required script to the local server on an as-needed basis and then deleting it? In regards to the former, we have 9 offices and I'm not too keen (from a purely administrative point) of having to maintain up-to-date copies at every location. If you're suggesting copying the script to the local server on an as-needed basis, I may as well set it up to run from the hard drive of the system getting the install (vile latency, take that ). I really thought that this would be a common scenario with a "try this command instead" or "adjust this parameter" type of fix, but it looks as though I'll be going with the billmez "script to automate deploying the scripts" idea ... I'll just be deploying to the local hard drive. Enjoy your weekend, Def -
Running compiled scripts over the WAN
DeFuser replied to DeFuser's topic in AutoIt General Help and Support
I think that is the case. The scenario is like this - I am in Houston, along with our local server where both the AutoIT .exe files and the application files reside. I can run installations all day long without a hitch (so far) When I remotely log into another machine (say in Dallas) I'll install the application from the Dallas server, but I'm still kicking-off the process from the AutoIT .exe in Houston. I do find it odd that latency would factor in with such a small .exe ... Then again, I am not too proud to admit that I may be way off-base with the timing theory. I was just wondering if others have run into similar issues. Cheers, Def -
how can this be done with a script
DeFuser replied to n9mfk9's topic in AutoIt General Help and Support
And once you logged in then what? I take it you want to do this from the remote machine?