Hello, I need some help in coding. I bound my Excel file and can read the tables, there are no Problems with it. But if I try to read a file path, which I writed in my cell, my script dont work corectly. The program must get the filepath(speicherort) from excel file and create a txt file in this path.
Some ideas?
Thanks
Ranorex 8.2.1
Windows 7
Filepath from excel to create a file don't works
Filepath from excel to create a file don't works
Last edited by ChrisN. on Wed Aug 29, 2018 7:49 am, edited 1 time in total.
Re: Filepath from excel to create a file don't works
Hi,
Try to write the path in excel without these characters... @" " and then use this:
Try to write the path in excel without these characters... @" " and then use this:
string filePath = @varSpeicherort
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Filepath from excel to create a file don't works
Thanks for the idea, but this didn't works.
this I see in the debug mode
this I see in the debug mode
Re: Filepath from excel to create a file don't works
The reason why you see question marks in the console is that there is most probably enabled "Masking" for given (Speicherort) excel column.
https://www.ranorex.com/#Datamaskingoption
This means, that the content of masked value is not visible in console or report. However, it should not have any impact on the variable value in code. I would suggest to add a breakpoint at line string filePath = @varSpeicherort and examine the content of filePath in code. Also, make sure the format of excel cell is a plain text.
BTW, what error exactly are you getting? Are you sure you have a write access to the directory of your choice? If you are not logged as "zocnecae", you may not be able to write to his desktop. Try to write something to c:\temp or similar.
https://www.ranorex.com/#Datamaskingoption
This means, that the content of masked value is not visible in console or report. However, it should not have any impact on the variable value in code. I would suggest to add a breakpoint at line string filePath = @varSpeicherort and examine the content of filePath in code. Also, make sure the format of excel cell is a plain text.
BTW, what error exactly are you getting? Are you sure you have a write access to the directory of your choice? If you are not logged as "zocnecae", you may not be able to write to his desktop. Try to write something to c:\temp or similar.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Filepath from excel to create a file don't works
Thank you for the answer. I have the acces to the path and can write there.
I don't get any errors by execute the program, ranorex only don't create a file if I use a variable as path. If I write a path string in the script it works all. Both reports are the same.
I don't get any errors by execute the program, ranorex only don't create a file if I use a variable as path. If I write a path string in the script it works all. Both reports are the same.
- RobinHood42
- Posts: 324
- Joined: Fri Jan 09, 2015 3:24 pm
Re: Filepath from excel to create a file don't works
Hi ChrisN,
The value definitely gets resolved during the runtime, even if it's masked in the report:
Do you get any error messages when you try to create the file?
Cheers,
Robin
The value definitely gets resolved during the runtime, even if it's masked in the report:
Do you get any error messages when you try to create the file?
Cheers,
Robin
You do not have the required permissions to view the files attached to this post.
Re: Filepath from excel to create a file don't works
Hi,
In my opinion, there must be something wrong with the path stored in excel. I mean its format or maybe there are some non-printable leading/trailing characters in the path? Could you please share the excel file? Have you tried to debug the content of variable?
In my opinion, there must be something wrong with the path stored in excel. I mean its format or maybe there are some non-printable leading/trailing characters in the path? Could you please share the excel file? Have you tried to debug the content of variable?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Filepath from excel to create a file don't works
Hi, as first thank you for the interest and help. I don't know how to upload the excel file but I copy my file path and added it under this text. There are no any wrong characters in the string. I copied this directly from the place there you can add your formula.
I don't get any errors.
Somebody had the same problem in this forum but i can't find this post anymore. The post is 2-3 years old and not solved.
C:\Users\zocnecae\Desktop\Zeitstempel.txt
I don't get any errors.
Somebody had the same problem in this forum but i can't find this post anymore. The post is 2-3 years old and not solved.
C:\Users\zocnecae\Desktop\Zeitstempel.txt
Re: Filepath from excel to create a file don't works
Hi,
You can upload the file either via forum's attachments or simply use a public file sharing service (one drive, drop box, etc) and here post a link. I'm sure the key of the problem lies in the excel file.
You can upload the file either via forum's attachments or simply use a public file sharing service (one drive, drop box, etc) and here post a link. I'm sure the key of the problem lies in the excel file.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Filepath from excel to create a file don't works
Here is the link for the file.
https://www.dropbox.com/s/55fkj4blu1tmd ... .xlsx?dl=0
PS: I can read the path to open the file if its created but i cant use the path to create a file or write if its already created.
https://www.dropbox.com/s/55fkj4blu1tmd ... .xlsx?dl=0
PS: I can read the path to open the file if its created but i cant use the path to create a file or write if its already created.
Re: Filepath from excel to create a file don't works
Hi,
There is definitely something wrong with the cell containing the path. If you try to edit the cell, there is a visible apostrophe character in front of the path? I tried to delete it, but it returns back. So I tried to copy the path from cell as a simple text and pasted it to below cell, and it copies without apostrophe. However, I tried your file and code on my system and it works as expected. The file is created and append without any problem. So my guess is that there is a problem with permission on your system? Try to write the file to "C:\temp", instead of using "user" desktop.
There is definitely something wrong with the cell containing the path. If you try to edit the cell, there is a visible apostrophe character in front of the path? I tried to delete it, but it returns back. So I tried to copy the path from cell as a simple text and pasted it to below cell, and it copies without apostrophe. However, I tried your file and code on my system and it works as expected. The file is created and append without any problem. So my guess is that there is a problem with permission on your system? Try to write the file to "C:\temp", instead of using "user" desktop.
You do not have the required permissions to view the files attached to this post.
Last edited by odklizec on Mon Sep 03, 2018 1:14 pm, edited 1 time in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Filepath from excel to create a file don't works
Thank you very much, this was a part of the problem. It works now in my usercode. I try now to use this code in external file and call this file in my usercode. By this i have a same problem like bevor but its a question of C#.
Thank you all.
Thank you all.