Indigo Rose Software

Go Back   Indigo Rose Software Forums > AutoPlay Media Studio 7.5 > AutoPlay Media Studio 7.5 Discussion

Reply
 
Thread Tools Display Modes
  #1  
Old 11-27-2007
Autoplayit07 Autoplayit07 is offline
Forum Member
 
Join Date: Nov 2007
Posts: 15
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".
Reply With Quote
  #2  
Old 11-27-2007
Autoplayit07 Autoplayit07 is offline
Forum Member
 
Join Date: Nov 2007
Posts: 15
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);
i get this to write the path to the file the user selects,but i need it to write the file name the user selects aswell.
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
Reply With Quote
  #3  
Old 11-27-2007
Dermot Dermot is offline
Indigo Rose Customer
 
Join Date: Apr 2004
Location: Vancouver, Canada
Posts: 1,520
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.
Reply With Quote
  #4  
Old 11-27-2007
Autoplayit07 Autoplayit07 is offline
Forum Member
 
Join Date: Nov 2007
Posts: 15
Quote:
Originally Posted by Dermot View Post
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
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.
Reply With Quote
  #5  
Old 11-27-2007
Lorne's Avatar
Lorne Lorne is offline
Indigo Rose Staff Member
 
Join Date: Feb 2001
Location: Indigo Rose Software
Posts: 2,588
To include quotation marks in a string, you need to escape them, like this: \"

__________________
--[[ Indigo Rose Software Developer ]]
Reply With Quote
  #6  
Old 11-27-2007
Autoplayit07 Autoplayit07 is offline
Forum Member
 
Join Date: Nov 2007
Posts: 15
Quote:
Originally Posted by Lorne View Post
To include quotation marks in a string, you need to escape them, like this: \"

hey thanks Lorne that worked.
thank you booth, for helping out
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -6. The time now is 05:50 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software