Vinod Posted August 8, 2006 Share Posted August 8, 2006 My Requirement: I will get the filename during the runtime. Using that file name , I need to search for the availabilit of the file in a particular dir, and if it is avialable I need to open that file from that dir. I have the dir name in a variable , and the file name in another variable, I have used $file3=FileOpen($lib_path & $file2,0) I am getting an error message . How can i get this resolved ?? Link to comment Share on other sites More sharing options...
Briegel Posted August 8, 2006 Share Posted August 8, 2006 What about $file3=FileOpen($lib_path & '\' & $file2,0) Link to comment Share on other sites More sharing options...
Vinod Posted August 8, 2006 Author Share Posted August 8, 2006 File Open returns '-1' , we cannot open the file. I had tried this also.. Link to comment Share on other sites More sharing options...
xcal Posted August 8, 2006 Share Posted August 8, 2006 $file = "test.txt" $path = "c:\program files" $open = FileOpen($path & "\" & $file, 0) This returns 1 for me. How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Briegel Posted August 8, 2006 Share Posted August 8, 2006 File Open returns '-1' , we cannot open the file. I had tried this also..What about other files? Are you able to open other files or do you have a generally problem with 'FileOpen()'? Link to comment Share on other sites More sharing options...
/dev/null Posted August 8, 2006 Share Posted August 8, 2006 (edited) File Open returns '-1' , we cannot open the file. I had tried this also..Hm.. maybe because the file does not exist? File? Exist? FileExists() !!CheersKurt Edited August 8, 2006 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...
ddeerr Posted August 8, 2006 Share Posted August 8, 2006 Hm.. maybe because the file does not exist? File? Exist? FileExists() !!CheersKurtlolmaybe it is a read only access issue ? Link to comment Share on other sites More sharing options...
/dev/null Posted August 8, 2006 Share Posted August 8, 2006 lolmaybe it is a read only access issue ?well, no. He opened the file in "Read Mode". So, it would be rather a "write only access" issue CheersKurt __________________________________________________________(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...
Vinod Posted August 8, 2006 Author Share Posted August 8, 2006 I am not able to open only this file.. The file exists in the dir.. also I just need to open that file and copy its contents to another file , hence read only mode should be sufficient I guess .. how do I resolve this issue ?? Link to comment Share on other sites More sharing options...
/dev/null Posted August 8, 2006 Share Posted August 8, 2006 (edited) how do I resolve this issue ??Maybe you can't open it because some other process opened it before. The information you provided is not enough the figure out what's going wrong.So, where is the file coming from?What's the content of $lib_path and $file2?Maybe you should try: FileCopy().CheersKurt Edited August 8, 2006 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...
Vinod Posted August 8, 2006 Author Share Posted August 8, 2006 I cannot use filecopy bcoz. I have to append the content. I have attached the script.. for u r reference..test.au3 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 8, 2006 Moderators Share Posted August 8, 2006 I cannot use filecopy bcoz. I have to append the content.I have attached the script.. for u r reference..That is script is super confusing... Can you just say what it is step by step that you are trying to accomplish and maybe we can come up with a better, "faster", and more stable solution? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Briegel Posted August 8, 2006 Share Posted August 8, 2006 What is the content of 'Input_script.au3'? Can you post it? Link to comment Share on other sites More sharing options...
Vinod Posted August 8, 2006 Author Share Posted August 8, 2006 Following is the content Connection_Manager ait_connection Connection_Manager1 Connection_Manager2 Connection_Manager3 Connection_Manager4 Connection_Manager5 Connection_Manager6 Connection_Manager7 Connection_Manager8 Connection_Manager9 Link to comment Share on other sites More sharing options...
/dev/null Posted August 8, 2006 Share Posted August 8, 2006 I cannot use filecopy bcoz. I have to append the content.I have attached the script.. for u r reference..erm, Vinod. Your code is FULL of errors. You're mixing $file1, $file2, $file3 etc. as you like. This CANNOT work. I would suggest you read the code thoroughly and fix those problems first.Now to your first question. $file4=FileOpen($lib_path & $file2,0)Does not work, because THAT file does not exist. $lib_path = "C:\test\lib\" and $file2 = "ait_connection", so you are trying to open the file "C:\test\lib\ait_connection", which most certainly does not exist!CheersKurt __________________________________________________________(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...
Vinod Posted August 8, 2006 Author Share Posted August 8, 2006 If the file does not exist, the search should fail, but search is successful . Only the issue is with Fileopen. Rest of the correction I had done.. Link to comment Share on other sites More sharing options...
/dev/null Posted August 8, 2006 Share Posted August 8, 2006 If the file does not exist, the search should fail, but search is successful . Only the issue is with Fileopen.Rest of the correction I had done..O.K. post the corrected code.CheersKurt __________________________________________________________(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...
Vinod Posted August 8, 2006 Author Share Posted August 8, 2006 Here is the file... Link to comment Share on other sites More sharing options...
/dev/null Posted August 8, 2006 Share Posted August 8, 2006 (edited) Here is the file...O.K., so why don't you use FileExists()? Your whole FileFindFlieFirst/FileFindFileNext is useless is you're not using wildcards or traversing directories.Then, what's the output of " MsgBox(0, "filepath", $temp)" in your script and does that file exist?Maybe you should provide a textual description what you want to do. Based on your code it's really hard to figure out and then to find a logical error.AND then what's this?? $file5= FileRead("$lib_path & $file4,FileGetSize($lib_path & $file4)")You can't use double quotes here!! And you can't use $file4 here. That's a file handle. And you don't need the whole FileGetSize() thing.CheersKurt Edited August 8, 2006 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...
Vinod Posted August 8, 2006 Author Share Posted August 8, 2006 kurt,,.. the issue was with search file... search was successfulll but some how dir path was not sent correct to FileOpen func I used FileExists() it perfectly works fine.. Thanks guys 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