|
#1
|
|||
|
|||
|
Open a file and retrive the path and write it to a text file
Hello.
how can i open a file and get the path to this file. I have a button witch i would like the user to push and select a file with specific exstension. and ones the file is open i want the program to get the path and write this path to a text file witch is in the autoplay source folder "document". |
|
#2
|
|||
|
|||
|
I manage to get the first part right.
but i need a little help with the rest. this is what i got so far, Code:
result = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Files (*.*)|*.*|", "", "txt", false, false);
current_dir = Folder.GetCurrent(1);
TextFile.WriteFromString("C:\\myfile.txt", "1)"..current_dir, true);
lets say the user selects a file like this on drive C:\test Folder\test.dat i need the script to write to the text file not only the path like this C:\test Folder but like this C:\test Folder\test.dat and allso append this ") after the file name and before the path. like this ("C:\test Folder\test.dat") is that possible . cause i only get errors when i try to append this ("") around the path. thank you for any help
|
|
#3
|
|||
|
|||
|
Try this
Code:
result = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Files (*.*)|*.*|", "", "txt", false, false);
if result ~= "CANCEL" then
TextFile.WriteFromString("C:\\myfile.txt", "("..result[1]..")", true);
end
__________________
Dermot AMS Add-ons - xDialog.com A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine. |
|
#4
|
|||
|
|||
|
Hey Dermot, thats almost perfect, just one more this i cant get sorted out, your code works perfect, but i need it to include this too " like this ("the path and file name"). i dont know how to place these " without getting an error.
|
|
#5
|
||||
|
||||
|
To include quotation marks in a string, you need to escape them, like this: \"
__________________
--[[ Indigo Rose Software Developer ]] |
|
#6
|
|||
|
|||
|
Quote:
![]() thank you booth, for helping out |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
All times are GMT -6. The time now is 05:50 AM.









Linear Mode
