|
Post by wexhammer on Jan 21, 2020 4:43:57 GMT -5
How would i open a files path without using the file dialog or api calls? How would i open the file in the code below and input its path into a string without the dialog?
#main.txtbox, "!contents? all$" open "users.txt" for output as #1 print #1, all$ close #1
|
|
|
Post by Rod on Jan 21, 2020 5:24:45 GMT -5
Its just a string so simply use the string in place of the literal "users.txt"
nomainwin textbox #t.txt, 20, 20, 260, 25 button #t.default, "Open file", [respond], UL, 20, 50,260,25 WindowWidth = 350 : WindowHeight = 190 open "Get file name" for dialog as #t #t "trapclose [quit]"
'clear the textbox and set the focus on it 'optionally you can pre fill it '\bmp\ a relative path 'c:\basic\ a hard path 'or no path at all and it will use the current directory 'this will be whatever DefaultDir$ contains #t.txt "c:\basic\file.bas" #t.txt "!setfocus" wait
[respond] 'get the contents once enter or the button has been clicked #t.txt "!contents? pathfilename$" notice "We are going to open "+pathfilename$ 'open pathfilename$ for output as #1 wait
[quit] close #t end
|
|