Jump to content

interesting anomaly


t0ddie
 Share

Recommended Posts

well, i asked this before, but didnt get an answer.

why does fileappend leave the first line blank, in an empty .txt file?

and as for the interesting anomaly...

i found that if you run a second script from your first script and the second script fileappends to a file...

that file will be appended or created in the directory that the FIRST script was in.

i find it interesting because that first script has long exited before the fileappend is even CLOSE to executing in the second script.

i would expect the .txt file NORMALLY to be in the directory that the script it was called from is in.

but, it goes to the directory where the first script, that ran the second script, is located.

so, watch out people!

~Todd

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

You'll have that when you don't manually supply a working directory to your call to Run/RunWait, thus forcing AutoIt to set the spawned process' working directory to the current script's working directory.

If you want it to write in the proper directory, tell it to do so by either passing the correst path as the working directory argument of Run/RunWait, or use an absolute path in your call to FileOpen(). Otherwise, AutoIt will continue to (correctly) do what it is doing.

Link to comment
Share on other sites

understood. it all makes sense now.

what about the fileappend function though? why does it not write to the first line in an empty .txt file?

cmon! at least let me find ONE bug!!! is this a bug?

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

There is no reason for you to use _FileAppend(). Looking at the function definition, its just a thin wrapper around FileWriteLine() and does exactly what FileWriteLine() does (It may of been written before the built-in functions could accept file names, thats the only thing I can think of).

As for the newline at the beginning, it must be a problem with your code. It does not occur for me. Look at the source, there is no newline pre-pended. The function is just a thin wrapper around FileWriteLine().

Now time for me to bitch. How many days have you been touting this "bug"? A couple now? It would of taken 30 seconds or less to open up File.au3 in the Include directory and see what _FileAppend() is doing. End bitching.

Jon, it appears to me its a deprecated function that does no more than what AutoIt can do by itself, so it really should be removed.

Edit: Typo.

Edited by Valik
Link to comment
Share on other sites

k well.... i thought this was only the second time i mentioned it

and i waited a couple days with no response.

as for appending the file.. i want to use that command cause the file constantly changes size as it is filled, and i want the text to be added to the end.

that way, i dont have to specify the line.. its just the last one.

i dont know what i did, but that code all by itself without being used in my script gave me the error.. but it "fixed itself" somehow lol EDIT: it is not fixed...i tried the function again and forgot to change it to what i have in my script. read next post

thanks man.. now QUICHERBICHIN

cause it seems to me, that you like to complain about petty stuff lol.

sure i complain too, when im not getting help and its easy to help me. or when someone complains about my post.

do you hate me? i love you man

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

i must apologize first, because the code IS slightly different than what i had previously posted

the problem lies with the clipboard function

$bak = ClipGet()

$bak = StringTrimLeft($bak,4)

$bak = StringReplace($bak,",","")

$file = FileOpen("ACCOUNTS.txt", 1)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

FileWriteLine("ACCOUNTS.txt", $bak )

FileClose($file)

it works fine if you change this: $bak = ClipGet()

to this:

$bak = "**: I love, valik"

but see, im writing to the .txt file using the clipboard.

so copy and paste the code.. then put THIS in the clipboard:

**: I love, valik

try it now... see how it puts it on the second line?

but run it again.. and it writes to the third line.. and not the fourth.. like i would expect it to since of the way it writes it the first time.

so, for some reason, while the .txt file is empty.. the first line it writes starts on the second line.

i apologize for posting the code.... without doublechecking it to make sure that was the code that gave me the error.

but as you can see.. there IS a problem.. im not crazy

thanks.

~Todd

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

thanks black.. i know how to fix it.... thats not the issue

i shouldnt HAVE to fix it

but hey man, your thinking at least.

plus it does this in a loop, and i dont want to have to change the whole thing, cause of the first line. not to mention, when i run this script.. the .txt file may aready have info in it. so i wouldnt want to backspace unless i was absolutely sure that it was empty.

valik? i just want you to try my code now.. sorry though bro about before.

i can see how it would be annoying

*valik thinks to himself o0"damn NOOB again! wtf he talkin bout, this works perfectly!"0o

but at least i admit when im wrong

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

Guest BL@(K-R34P3R

Heh, I see. Anyways, what are you trying to do with your script? I mean, I know WHAT you are doing, but with your real code... what program are you making?

Link to comment
Share on other sites

look, id love to talk about it. but the forum isnt the place.. at least not in support.

so, without further ado..

YAHOO IM: toddie_s

AOL IM: DS v EVILGOD

please reply with informitave rebuttals in these posts. thanks.

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

  • Developers

look, id love to talk about it. but the forum isnt the place.. at least not in support.

so, without further ado..

YAHOO IM: toddie_s

AOL IM: DS v EVILGOD

please reply with informitave rebuttals in these posts. thanks.

<{POST_SNAPBACK}>

Your script works fine for me using the clipboard.

You could make it a bit shorter as well:

$bak = ClipGet()
$bak = StringTrimLeft($bak, 4)
$bak = StringReplace($bak, ",", "")
FileWriteLine("ACCOUNTS.txt", $bak)
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

ok jdeb.. you had ACCOUNTS.txt on the desktop?

was it empty?

i know the script works.. but if ACCOUNTS.txt is empty it will write to the SECOND line and not the first

ill test it again, but im sure this time that i posted it correctly, and that it HAS that error

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

  • Developers

ok jdeb.. you had ACCOUNTS.txt on the desktop?

was it empty?

i know the script works.. but if ACCOUNTS.txt is empty it will write to the SECOND line and not the first

ill test it again, but im sure this time that i posted it correctly, and that it HAS that error

<{POST_SNAPBACK}>

yeap.... how do you create an empty file ???

Doen't it already contain a CRLF character ??

try deleting it and let the script create it to see what it does...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

now this is seriously pissing me off.

it just worked...

same code.. same damn everything.

sometimes it does it, sometimes it doesnt.

wtf!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

it works every time now.. i am going to try to re-create the error.. so i dont look like im an idiot

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

  • Developers

now this is seriously pissing me off.

it just worked...

same code.. same damn everything.

sometimes it does it, sometimes it doesnt.

wtf!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

it works every time now.. i am going to try to re-create the error.. so i dont look like im an idiot

<{POST_SNAPBACK}>

did you see my post previous post?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

normally this would have not gone on this long....

i dont understand it.

i thought it was because maybe i was copying a carriage return into the clipboard.

but even once when i tested it... i made sure it wasnt so, and i still had problems.

not to mention f i DID copy a carriage return, it would do that on all lines....

not just the first

thats what i am saying!!!!!!!!

there is no reason why it should copy to the second line.... then i run the script again and it copies to the third line.....

if there was a carriage return, it would copy to the second line.. fourth line, sixth line. etc etc

well, my example doesnt do this anymore.. but it USED to... my script however.. still does this, but i KNOW its not the script!!!!

because i had previously copied and pasted this example from the script, and it did that error again.. without the rest of the script.

who cares.. i sure dont anymore. but if i figure it out, ill post it.

~Frustrated

EDIT: yes i saw that post... it dont matter if its created or not. does the same thing. well.. it did.. but i cant recreate the problem.

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

I bitch about the petty things because the petty things are the things people can figure out for themself if they would put forth a little time and effort into understanding how something works instead of running off to the omnipotent forum.

Link to comment
Share on other sites

  • Developers

normally this would have not gone on this long....

i dont understand it.

i thought it was because maybe i was copying a carriage return into the clipboard.

but even once when i tested it... i made sure it wasnt so, and i still had problems.

not to mention f i DID copy a carriage return, it would do that on all lines....

not just the first

thats what i am saying!!!!!!!!

there is no reason why it should copy to the second line.... then i run the script again and it copies to the third line.....

if there was a carriage return, it would copy to the second line.. fourth line, sixth line. etc etc

well, my example doesnt do this anymore.. but it USED to... my script however.. still does this, but i KNOW its not the script!!!!

because i had previously copied and pasted this example from the script, and it did that  error again.. without the rest of the script.

who cares.. i sure dont anymore. but if i figure it out, ill post it.

~Frustrated

EDIT: yes i saw that post... it dont matter if its created or not. does the same thing. well.. it did.. but i cant recreate the problem.

<{POST_SNAPBACK}>

Logic says that it cannot ever have been the case that the CRLF came from the clipboard since to are removing the first 4 character ... so they would have been removed. :) Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

ok, quick rebuttal.

i looked at it, TESTED it.. understand HOW it works, but under certain circumstances it did not work. and we cant all be a rocket scientist.. or a valik.

besides.. how about some encouragement? is that possible?

at least i am listening..which is what you were first upset about. (i listened then too)

1) im posting code to show an example of what im doing

2) im not asking anyone to write a script for me

3) im not asking for the impossible, i do appreciate the help you HAVE given me though. just your thoughts on the issue, not your thoughts on me

4) we all already know you hate me valik. lol, thanks for reminding us.

not to mention the fact that i thought it was a bug.. im not running off to the forum here, cause i dont understand....

and hey, i SAID i dont know whats wrong with it.. and that it sometimes does this, and sometimes doesnt. always the same though, until i change the test script. either does it or not.. so there problem is there SOMEWHERE

@jdeb.. i realized that thing with the crlf.. and the trim... i just forgot to mention it in the post but yeah.. thats obvious.

SUMMARY:

look this isnt even that big of a deal. ill just forget about the whole thing.

its just that i was craving knowledge, and when i want to know WHY something works

the way it does.... i cant relax until im satisfied with an informative answer.

ESPECIALLY when we arent communicating on the same level. hard to diagnose a problem you cant see, or one that doesnt exist.

when i find the culpret, i will test it 100 times to be sure, then post my findings. till then, ciao on this topic

EDIT: lol just like to say also, that i have put alot of time and effort into this (way to much)

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...