05-25-2015 07:31 AM
Hello all! I have a problem regarding my installed application in another pc from "My installer" I built from my original labview project.
I wanted to implement an open/create file operation, getting the current file path of my vi, creating new folder "report" and new file of report, the name of which is composed of the date and time when it's created. With "Get date/time string" I got the date string like "25/05/2015" and time string like "14:24:20", and with "search and replace string" I converted them into "25052015" and "142420" simply by replacing "/" and ":" with nothing.
This works fine with the original vi in my pc, but with the installed application in another pc, I got error in the file path, that instead of "C:\....\report\transducer_25052015_142420.txt", I got "C:\....\report\transducer_25052015_14.24.20.txt"! The colomns are replaced with dots!!!
I have no idea why my installed application would give such error. Anybody got any idea?
PS. I have considered about the difference between "Run time application path" and the default file path, which you can see from the image below.
Solved! Go to Solution.
05-25-2015 07:59 AM
The dots are just because your indicator is not showing enough to fit the entire path. Make your indicator much larger to show the full path.
If you are not using the 8.X format for the executable, you cannot count on the extra Strip From Path since the executable actually has a directory structure inside. You should be using Application Directory to make paths relative to your project file's folder (when in the LabVIEW IDE) or the folder for the executable (when in the Run Time System). Then you do not need to worry about which system you are in and it makes things A LOT simpler.
05-25-2015 08:16 AM
Thank you very much for the reply.
But I'm not clear about your solution. Firstly, what indicator do you mean? Is this a solution "make that indicator much larger to show the full path" to my problem?
And then if it's possible I'd appreciate if you can explain a bit about the 8.X format for the executable.
Thanks again
05-25-2015 08:29 AM
I should have probably asked this earlier: What error are you getting? Now that I've thought about it for short bit, I'm guessing you are getting a File Does Not Exist error. If you get this error when trying to create a file, it means that the folder does not exist to put the file there. You need to make sure the folder is there.
@jcraffael wrote:
And then if it's possible I'd appreciate if you can explain a bit about the 8.X format for the executable.
Advanced Page (Web Service Properties Dialog Box)
When creating the build spec for an executable, there is an Advanced Page. At the bottom is the option to have the executable in 8.x format. What this does is make the directory structure in the executable flat (really, no directory structure). This is generally bad since you cannot have any files with the same name, even if from different libraries/classes.
But using the Application Directory function makes your code a lot simpler since you do not need to do any Strip Path in order to get a folder and everything is relative to the project or the executable.
05-25-2015 08:43 AM
Ah ok the application directory sounds quite interesting!
While for the first point you wrote, the error I got is exactly the File doesn't exist error, however it's not because the folder doesn't exist but the name of the newly created file doesn't have the correct format because it contains DOTs in its name, which is in "14.25.20"! I said before with my original vi I got the time part as "142520" since I replaced the ":" with void, but with the executable the ":" are replaced by dots which makes the file name having a wrong format!
So regarding the weird replacement do you still have any idea?
05-25-2015 09:26 AM - edited 05-25-2015 09:27 AM
You can supply a format if you use the Format Date/Time String. Then you do not need to do the replacement and you do not have to worry about system settings getting in the way either.
05-26-2015 05:14 AM
Thank you for this soulution! I found that the colomn and dot issue of time string seems to have sth to do with windows (xp and 7), while
this solution avoids this problem and it works perfectly.
Thanks again!