[wtr-general] Re: Opening an Excel file with a variable name

2008-12-17 Thread LFIdnl

More useful

File.join($drive,env,Test_Results,#{$file_name}_Results.xls )

On 17 дек, 00:20, Darin Duphorn dduph...@redbrickhealth.com wrote:
 Try \\

 $drive+\\+env+\\Test_Results\\+$file_name+_Results.xls

 -Original Message-
 From: watir-general@googlegroups.com

 [mailto:watir-gene...@googlegroups.com] On Behalf Of
 jas.shel...@hotmail.com
 Sent: Tuesday, December 16, 2008 3:08 PM
 To: Watir General
 Subject: [wtr-general] Opening an Excel file with a variable name

 All,

 I am attempting to open an Excel file with Ruby, and have run into a
 problem.  If I open the file with single quotes, like  inputFile =
 input.Workbooks.Open('C:\Folder\sheet.xls') everything works fine.  My
 problem now is that the location of the .xls file has a variable name,
 like inputFile = input.Workbooks.Open(C:\#{var)\sheet.xls).  When I
 try this, I get an error saying that the file cannot be found.  It
 seems that the 'open' method will only work with single quotes, but to
 signify a variable in a string in Ruby you have to use double quotes.
 Has anyone discovered a way around this?  Thanks in advance for any
 help.

 - Shelton
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Opening an Excel file with a variable name

2008-12-17 Thread Jason Shelton

I discovered that my problem was that I had a newline character at the end of 
each array element.  Once I removed the character, it worked fine.  Thanks for 
your help.
 
- Shelton Date: Wed, 17 Dec 2008 10:02:11 -0600 From: b...@pettichord.com 
To: watir-general@googlegroups.com Subject: [wtr-general] Re: Opening an Excel 
file with a variable name   Actually this method won't work. The problem is 
that File.join will join  the elements using a forward slash (/). The pathname 
is being passed to  Excel, which truly requires that backslashes be used in 
the filename.  I've argued that this is a bug in Ruby, but there it is.  
Bret  LFIdnl wrote:  More useful   
File.join($drive,env,Test_Results,#{$file_name}_Results.xls )   On 17 
дек, 00:20, Darin Duphorn dduph...@redbrickhealth.com wrote:Try 
\\   $drive+\\+env+\\Test_Results\\+$file_name+_Results.xls   
-Original Message-  From: watir-general@googlegroups.com   
[mailto:watir-gene...@googlegroups.com] On Behalf Of  
jas.shel...@hotmail.com  Sent: Tuesday, December 16, 2008 3:08 PM  To: 
Watir General  Subject: [wtr-general] Opening an Excel file with a variable 
name   All,   I am attempting to open an Excel file with Ruby, and 
have run into a  problem. If I open the file with single quotes, like 
inputFile =  input.Workbooks.Open('C:\Folder\sheet.xls') everything works 
fine. My  problem now is that the location of the .xls file has a variable 
name,  like inputFile = input.Workbooks.Open(C:\#{var)\sheet.xls). When I 
 try this, I get an error saying that the file cannot be found. It  seems 
that the 'open' method will only work with single quotes, but to  signify a 
variable in a string in Ruby you have to use double quotes.  Has anyone 
discovered a way around this? Thanks in advance for any  help.   - 
Shelton 
_
Send e-mail faster without improving your typing skills.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Opening an Excel file with a variable name

2008-12-17 Thread Jason Shelton

I have tried both proposed methods, and I am getting the same 'File not found' 
error.  It seems that Ruby has a problem with using variables in certain 
scenarios.  Previously, I was passing a parameter to a class named 'Test' with 
a function in it named 'go'.  This is the syntax that I used, 
Test.new.go('hello')  The function 'go' would open a .xls file with the 
parameter in the path, such as C:\hello\data.xls.  Everything was working fine 
then.  Now, instead of using the actual string 'hello' as the parameter, I am 
using an array element variable, so the syntax is Test.new.go(array[x]).  Now 
the 'go' function throws the ''File not found' error.  In the error message, 
both the path and file are correct, so I do not understand why the file cannot 
be found.  Does anyone have any idea about what could be going on?  Thanks in 
advance for any help.
 
- Shelton
 
 Date: Wed, 17 Dec 2008 00:36:06 -0800 Subject: [wtr-general] Re: Opening an 
 Excel file with a variable name From: sraniim...@gmail.com To: 
 watir-general@googlegroups.com   More useful  
 File.join($drive,env,Test_Results,#{$file_name}_Results.xls )  On 17 
 дек, 00:20, Darin Duphorn dduph...@redbrickhealth.com wrote:  Try \\ 
   $drive+\\+env+\\Test_Results\\+$file_name+_Results.xls   
 -Original Message-  From: watir-general@googlegroups.com   
 [mailto:watir-gene...@googlegroups.com] On Behalf Of  
 jas.shel...@hotmail.com  Sent: Tuesday, December 16, 2008 3:08 PM  To: 
 Watir General  Subject: [wtr-general] Opening an Excel file with a variable 
 name   All,   I am attempting to open an Excel file with Ruby, and 
 have run into a  problem.  If I open the file with single quotes, like  
 inputFile =  input.Workbooks.Open('C:\Folder\sheet.xls') everything works 
 fine.  My  problem now is that the location of the .xls file has a variable 
 name,  like inputFile = input.Workbooks.Open(C:\#{var)\sheet.xls).  When 
 I  try this, I get an error saying that the file cannot be found.  It  
 seems that the 'open' method will only work with single quotes, but to  
 signify a variable in a string in Ruby you have to use double quotes.  Has 
 anyone discovered a way around this?  Thanks in advance for any  help.  
  - Shelton _
You live life online. So we put Windows on the web. 
http://clk.atdmt.com/MRT/go/127032869/direct/01/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Opening an Excel file with a variable name

2008-12-16 Thread Darin Duphorn


Try \\



$drive+\\+env+\\Test_Results\\+$file_name+_Results.xls


-Original Message-
From: watir-general@googlegroups.com
[mailto:watir-gene...@googlegroups.com] On Behalf Of
jas.shel...@hotmail.com
Sent: Tuesday, December 16, 2008 3:08 PM
To: Watir General
Subject: [wtr-general] Opening an Excel file with a variable name


All,

I am attempting to open an Excel file with Ruby, and have run into a
problem.  If I open the file with single quotes, like  inputFile =
input.Workbooks.Open('C:\Folder\sheet.xls') everything works fine.  My
problem now is that the location of the .xls file has a variable name,
like inputFile = input.Workbooks.Open(C:\#{var)\sheet.xls).  When I
try this, I get an error saying that the file cannot be found.  It
seems that the 'open' method will only work with single quotes, but to
signify a variable in a string in Ruby you have to use double quotes.
Has anyone discovered a way around this?  Thanks in advance for any
help.

- Shelton



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---