NSearch Posted August 23, 2005 Share Posted August 23, 2005 For some reason my FileExists statement will not work. Can anyone see what I am doing wrong? Statement to save excel file (enters data in save as box and clicks enter). If $domestic <> "D" then Send("C:\"&$short_name&" International Detail "&$remit&"") Send("{ENTER}") EndIf Statement to close excel once file has saved: If $domestic <> "D" then While $flag = 0 If FileExists("C:\"&$short_name&" International Detail "&$remit&".xls") Then ProcessClose("excel.exe") ExitLoop EndIf WEnd EndIf Link to comment Share on other sites More sharing options...
blindwig Posted August 23, 2005 Share Posted August 23, 2005 can you locate the file and see that it is physically there on the drive? My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
NSearch Posted August 23, 2005 Author Share Posted August 23, 2005 yes, it is created and saved. I can not understand why it is not being recognized Link to comment Share on other sites More sharing options...
HardCopy Posted August 23, 2005 Share Posted August 23, 2005 (edited) u gonna need to but a couple of debug points in your code to see what value $Domestic $Flag are returning. put a messagebox(0,"Value of $Domestic + $Flag",$Domestic&" "&$Flag) before both your save and close excel If statemnts. Other than that we need a bit more code to see what you actually defining in those variables. HardCopy Edited August 23, 2005 by HardCopy Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad Link to comment Share on other sites More sharing options...
NSearch Posted August 23, 2005 Author Share Posted August 23, 2005 I have done this, and everything comes back the way that it should be before saving, and closing. Both have the same value, but for some reason I can not get it to recognize the file using fileexists. Link to comment Share on other sites More sharing options...
therks Posted August 23, 2005 Share Posted August 23, 2005 Try putting this line in there: InputBox('Test', 'FilePath', "C:\"&$short_name&" International Detail "&$remit&".xls") And if it looks normal, copy from the input box, and paste into your Start>Run dialog, and try to execute like that. If that works fine, then I'll be stumped. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
NSearch Posted August 23, 2005 Author Share Posted August 23, 2005 I am getting a "block". Looks to be a carriage return right before .xls Am I constructing my string wrong? FileExists("C:\"&$short_name&" International Detail "&$remit&".xls") Link to comment Share on other sites More sharing options...
HardCopy Posted August 23, 2005 Share Posted August 23, 2005 If $domestic <> "D" then Send("C:\"&$short_name&" International Detail "&$remit&"") Send("{ENTER}") EndIf Well u tagging an extra null on the end here!! dunno if that would kill it. change "" to ".xls" try that Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad Link to comment Share on other sites More sharing options...
seandisanti Posted August 23, 2005 Share Posted August 23, 2005 If $domestic <> "D" thenSend("C:\"&$short_name&" International Detail "&$remit&"")Send("{ENTER}")EndIfWell u tagging an extra null on the end here!! dunno if that would kill it.change "" to ".xls" try that<{POST_SNAPBACK}>try putting a space on either side of each of your &'s... if nothing else it will help readability. i know in vbs it doesn't like it when &'s are appended to variable names. Link to comment Share on other sites More sharing options...
NSearch Posted August 23, 2005 Author Share Posted August 23, 2005 I see what is happening. I am drawing in a carriage return when grabbing the remit number from a file. Is there a string command to strip a string of carriage returns? Link to comment Share on other sites More sharing options...
NSearch Posted August 23, 2005 Author Share Posted August 23, 2005 StringStripCR ( "string" ) Got it. Thanks everyone from your help!!! Link to comment Share on other sites More sharing options...
therks Posted August 23, 2005 Share Posted August 23, 2005 Just in case.. that will only strip carriage returns (ascii 13) sometimes you might have a line feed (ascii 10) on there too, in that case, try StringStripWS (whitespace). My AutoIt Stuff | My Github 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