Necromorph Posted March 18, 2010 Posted March 18, 2010 any ideas why this isn't deleting the file $tEmpDir? ;Keyfinder by thomas malkewitz mcp mcdst $tEmpDir = ("C:\" & @ComputerName & ".txt") $tKeyLog = FileOpen("c:\Keys.txt", 1) FileInstall("keyfinder.exe", @TempDir & "keyfinder.exe") ShellExecute(@TempDir & "keyfinder.exe") WinWait("Magical Jelly Bean Keyfinder v2.0.1") Send("!f") Send("s") Sleep(500) ControlSend("Save As", "", "[CLASS:Edit; INSTANCE:1]", $tEmpDir) Sleep(500) Send("{ENTER}") Sleep(500) WinWaitClose("Save As") ProcessClose("Tempkeyfinder.exe") FileOpen($tEmpDir, 0) $tKeys = FileRead($tEmpDir) FileWrite($tKeyLog, @CR & @ComputerName & @CRLF & $tKeys) FileClose($tKeyLog) FileClose($tEmpDir) FileDelete($tEmpDir) FileDelete(@TempDir & "keyfinder.exe") Exit thanks.
Beege Posted March 18, 2010 Posted March 18, 2010 Mabey try and do some more error checking. Make sure file exists: If not FileExists($tEmpDir) then Msgbox(0,'','file does not exist') Make sure file closed properly. If Not FileClose($tEmpDir) then Msgbox(0,'','error closing file') Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator
Necromorph Posted March 18, 2010 Author Posted March 18, 2010 (edited) thanks for the tip i did try this, and it is getting an error on "closing the file" do i need a sleep command, or something in there? thanks $varDir = "C:\" $varFile = $varDir & @ComputerName & ".txt" $varKeyFile = FileOpen("c:\Keys.txt", 1) FileInstall("keyfinder.exe", @TempDir & "keyfinder.exe") ShellExecute(@TempDir & "keyfinder.exe") WinWait("Magical Jelly Bean Keyfinder v2.0.1") Send("!f") Send("s") Sleep(500) ControlSend("Save As", "", "[CLASS:Edit; INSTANCE:1]", $varFile) Sleep(500) Send("{ENTER}") Sleep(500) WinWaitClose("Save As") ProcessClose("Tempkeyfinder.exe") Sleep(250) FileOpen($varFile, 0) While 1 $varKeys = FileRead($varFile) FileWrite($varKeyFile, @CRLF & @ComputerName & @CRLF & $varKeys) ExitLoop WEnd FileClose($varFile) FileClose($varKeyFile) FileDelete($varFile) If FileClose($varFile) Then FileDelete(@TempDir & "keyfinder.exe") Else MsgBox(0, "redLabel keyFinder", "error closing file") EndIf Exit Edited March 18, 2010 by redLabel
Necromorph Posted March 18, 2010 Author Posted March 18, 2010 well, i got it to work. im still not sure why, but if i assign a $var to the FileOpen($varFile), then it works, here is the code $varDir = "C:\" $varFile = $varDir & @ComputerName & ".txt" $varKeyFile = FileOpen("c:\Keys.txt", 1) FileInstall("keyfinder.exe", @TempDir & "keyfinder.exe") If FileExists($varFile) Then FileDelete($varFile) EndIf ShellExecute(@TempDir & "keyfinder.exe") WinWait("Magical Jelly Bean Keyfinder v2.0.1") Send("!f") Send("s") Sleep(500) ControlSend("Save As", "", "[CLASS:Edit; INSTANCE:1]", $varFile) Sleep(500) Send("{ENTER}") Sleep(500) WinWaitClose("Save As") ProcessClose("Tempkeyfinder.exe") Sleep(250) $varFileOpen = FileOpen($varFile, 0) $varKeys = FileRead($varFile) FileWrite($varKeyFile, @CRLF & @ComputerName & @CRLF & $varKeys) FileClose($varFileOpen) FileDelete($varFile) FileDelete(@TempDir & "keyfinder.exe") Exit
AdmiralAlkex Posted March 18, 2010 Posted March 18, 2010 well, i got it to work. im still not sure why, but if i assign a $var to the FileOpen($varFile), then it works, here is the codeHow can you NOT be sure? The helpfile clearly say for FileClose:The handle of a file, as returned by a previous call to FileOpen.Not a single word there or in FileOpen about any filename.Seriously, use the helpfile next time, or you will find that more and more people will ignore you. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
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