Rex Posted June 11, 2005 Share Posted June 11, 2005 Hi all you AutoIT users. I have some kind of a funny problem. This code works, with out problem $read = GUICtrlRead($Treeview) if $Read = 0 Then MsgBox(64, "Delete Item", "Nothing to delete, list is empty or item not checked") EndIf FileDelete("C:\Test1.ini") For $i = 0 To UBound($ahsLines) - 1 If BitAnd(GUICtrlRead($ahsLines[$i][1]), 1) Then GUICtrlDelete($ahsLines[$i][1]) $ahsLines[$i][1] = 0 If Not FileExists("C:\Test1.ini") Then; FileDelete("C:\Test.ini") FileWrite("C:\Test.ini", "") FileWrite("C:\Test1.ini", "") EndIf ContinueLoop Endif If $ahsLines[$i][1] Then FileWriteLine("C:\Test1.ini", $ahsLines[$i][0]) FileCopy("C:\Test1.ini", "C:\Test.ini", 1) Next But this code don't $read = GUICtrlRead($Treeview) if $Read = 0 Then MsgBox(64, "Delete Item", "Nothing to delete, list is empty or item not checked") EndIf FileDelete(@ScriptDir & "\" & @UserName & ".tmp"); Deletes User Tmp file For $i = 0 To UBound($ahsLines) - 1 If BitAnd(GUICtrlRead($ahsLines[$i][1]), 1) Then GUICtrlDelete($ahsLines[$i][1]) $ahsLines[$i][1] = 0 If Not FileExists('"' & @ScriptDir & "\" & @UserName & ".tmp" & '"') Then FileDelete(@ScriptDir & "\" & @UserName & ".dat") FileWrite(@scriptdir & "\" & @UserName & ".dat", "") FileWrite(@scriptdir & "\" & @UserName & ".tmp", "") EndIf ContinueLoop Endif If $ahsLines[$i][1] Then FileWriteLine('"' & @scriptdir & "\" & @UserName & ".tmp" & '"', $ahsLines[$i][0]) FileCopy(@scriptdir & "\" & @UserName & ".tmp", @scriptdir & "\" & @UserName & ".Dat", 1); Updates the originale file;-) Next How can thet be, the only thing i have changed is the file to update/delete/write from C:\Test.ini / C:\Test1.ini to @ScriptDir & "\" & @UserName & ".Dat" / @ScriptDir & "\" & @UserName & ".Tmp" My big problem is that i don't get the thing with arrayers yet, but i'm still learning Hope that some of you great fokes can help me, with this little problem so i can get on with my script Link to comment Share on other sites More sharing options...
layer Posted June 11, 2005 Share Posted June 11, 2005 Well, I suck with arrays, so I can't help ya there But, is "FileDelete(@ScriptDir & "\" & @UserName & ".dat")" really a directory? To me it would maybe look like this if your script was in "C:\" and the username was "Bob J. Smith" C:\Bob J. Smith.dat Unless that's really a directory on your computer, I'm not too sure... Someone else probably knows. FootbaG Link to comment Share on other sites More sharing options...
Rex Posted June 11, 2005 Author Share Posted June 11, 2005 Well, I suck with arrays, so I can't help ya there But, is "FileDelete(@ScriptDir & "\" & @UserName & ".dat")" really a directory? To me it would maybe look like this if your script was in "C:\" and the username was "Bob J. Smith"C:\Bob J. Smith.datUnless that's really a directory on your computer, I'm not too sure... Someone else probably knows.<{POST_SNAPBACK}>Weel in the start of my script i creates a file with FileWrite(@ScriptDir & "\" & @UserName & ".dat") Link to comment Share on other sites More sharing options...
layer Posted June 11, 2005 Share Posted June 11, 2005 Sorry, I didn't see that, I'm no good at this, I'm sure someone else will know. FootbaG Link to comment Share on other sites More sharing options...
Rex Posted June 11, 2005 Author Share Posted June 11, 2005 Sorry, I didn't see that, I'm no good at this, I'm sure someone else will know.<{POST_SNAPBACK}>I hope so Link to comment Share on other sites More sharing options...
SumTingWong Posted June 11, 2005 Share Posted June 11, 2005 But this code don't$read = GUICtrlRead($Treeview) if $Read = 0 Then MsgBox(64, "Delete Item", "Nothing to delete, list is empty or item not checked") EndIf FileDelete(@ScriptDir & "\" & @UserName & ".tmp"); Deletes User Tmp file For $i = 0 To UBound($ahsLines) - 1 If BitAnd(GUICtrlRead($ahsLines[$i][1]), 1) Then GUICtrlDelete($ahsLines[$i][1]) $ahsLines[$i][1] = 0 If Not FileExists('"' & @ScriptDir & "\" & @UserName & ".tmp" & '"') Then FileDelete(@ScriptDir & "\" & @UserName & ".dat") FileWrite(@scriptdir & "\" & @UserName & ".dat", "") FileWrite(@scriptdir & "\" & @UserName & ".tmp", "") EndIf ContinueLoop Endif If $ahsLines[$i][1] Then FileWriteLine('"' & @scriptdir & "\" & @UserName & ".tmp" & '"', $ahsLines[$i][0]) FileCopy(@scriptdir & "\" & @UserName & ".tmp", @scriptdir & "\" & @UserName & ".Dat", 1); Updates the originale file;-) NextHow can thet be, the only thing i have changed is the file to update/delete/write from C:\Test.ini / C:\Test1.ini to @ScriptDir & "\" & @UserName & ".Dat" / @ScriptDir & "\" & @UserName & ".Tmp"My big problem is that i don't get the thing with arrayers yet, but i'm still learning Hope that some of you great fokes can help me, with this little problem so i can get on with my script <{POST_SNAPBACK}>I thinkIf Not FileExists('"' & @ScriptDir & "\" & @UserName & ".tmp" & '"') Thenshould beIf Not FileExists(@ScriptDir & "\" & @UserName & ".tmp") Thenand If $ahsLines[$i][1] Then FileWriteLine('"' & @scriptdir & "\" & @UserName & ".tmp" & '"', $ahsLines[$i][0])should beIf $ahsLines[$i][1] Then FileWriteLine(@scriptdir & "\" & @UserName & ".tmp", $ahsLines[$i][0]) Link to comment Share on other sites More sharing options...
Rex Posted June 11, 2005 Author Share Posted June 11, 2005 (edited) @SumTingWong That i alsow have tryed But i think that i might have found the error (not sure) It seems that AutoIT dont work properly with ext. Dat when you do a filewrite thing, i'd alsow try som other ext. like .sbp, .dba, .set alsow there it did't work. but i'm sure that there is a way out of that prob. :EDIT Hmm don't tell me how, but now i got it to work ?????????????? Edited June 11, 2005 by Rex Link to comment Share on other sites More sharing options...
/dev/null Posted June 11, 2005 Share Posted June 11, 2005 (edited) Dammed why did i play Battleship in my english class Should'nt it be Damned? Dammed has a slightly different meaning CheersKurt Edited June 11, 2005 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Rex Posted June 11, 2005 Author Share Posted June 11, 2005 Should'nt it be Damned? Dammed has a slightly different meaning CheersKurt<{POST_SNAPBACK}>Your right it schould be Damned - as i say my english stinks thx Link to comment Share on other sites More sharing options...
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