opening more than one file from MS Access

14 views
Skip to first unread message

fjbr

unread,
Mar 19, 2023, 5:32:31 PM3/19/23
to SemWare TSE Pro text editor
This will be quite mundane given the esoteric exchanges of late but I do need some help. I need to open two files from  within MS Access which I'm trying to do using the Shell function.
  Call Shell("C:\TSEPro\g32.exe" & " " & "E:\Food\rec-temp\recipe_fields.txt " & filePath, 1)
This opens TSE and the first file but the variable contains "file name with spaces.txt" so I get four other files open. Trying to use apostrophes either in the variable or the shell command results in an error in TSE being unable to open any files. I control the file names so I could just use underscores in the names but I'm pretty sure there will be a better solution.

knud van eeden

unread,
Mar 19, 2023, 5:43:32 PM3/19/23
to SemWare TSE Pro text editor
What about embedding the double quotes within single quotes:

Call Shell( "C:\TSEPro\g32.exe" & " " & '"E:\Food\rec-temp\recipe_fields.txt "' & filePath, 1)

with friendly greetings
Knud van Eeden

--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/semware/fd68bd30-d12b-4048-b585-309956ea6943n%40googlegroups.com.

Jose Adriano Baltieri

unread,
Mar 19, 2023, 5:57:09 PM3/19/23
to sem...@googlegroups.com
Are you able to find out the short file name from MS Access ? If so this short file name is simpler and very likely may be used within a command line without major complications.

If you are lucky enough to use 4NT/TCC/Take Command you can verify short file name by :

DIR weird-file-name*.* /f /b /x 

This will give you the short file name. I like to use this form (short) very often because I have a macro on Tessie, which I call from Alt-Enter that grabs the word underneath the cursor and if that's a file name, it opens it. IOW it opens the file under the cursor. 

Just in case anyone else needs this macro, it's below (very simple/humble) :


------------------------------------------------------
proc mcursorfile()

string owordset[255]=Query(wordset)
string ofilename[255],filename[255]=""
string extensions[255],fileext[255],testname[255]
integer lni, lnt, found=FALSE, abandon=FALSE

Set(wordset,ChrSet("0-9A-Z_a-z\\/:.*?~-"))

// autoexec.bat

filename=GetWord()

filename=Upper(GetWord())
if  RightStr(filename,1) == ":"
    filename=LeftStr(filename,Length(filename)-1)
endif
ofilename=filename

fileext=SplitPath(filename,_EXT_)
if  fileext == ""
    extensions=Query(defaultext)
else
    filename=SplitPath(filename,_DRIVE_+_PATH_+_NAME_)
    extensions=SubStr(fileext,2,Length(fileext)-1)
endif

lnt=NumTokens(extensions," ")
for lni=1 to lnt
  testname=filename + "." + GetToken(extensions," ",lni)
  if  FileExists(testname)
      found=TRUE
      break
  endif
endfor

if  (not found)
and SplitPath(filename,_DRIVE_) == "" and SplitPath(filename,_PATH_) == ""
    if  YesNo("File (" + ofilename + ") was not found on current dir." +
              " Try to load it against 'SET PATH' ?") == 1
        lnt=NumTokens(extensions," ")
        for lni=1 to lnt
          testname=filename + "." + GetToken(extensions," ",lni)
          testname=SearchPath(filename + "." + GetToken(extensions," ",lni),GetEnvStr("PATH"),".")
          if  FileExists(testname)
              found=TRUE
              break
          endif
        endfor
    else
        abandon=TRUE
    endif
endif

if  found
    EditFile(testname)
else
    if  not abandon
        Warn("Sorry but " + filename + fileext + " was not found anywhere...")
    endif
endif

Set(wordset,owordset)

end
-----------------------------------------




--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/semware/fd68bd30-d12b-4048-b585-309956ea6943n%40googlegroups.com.


--


Grato,
Jose Adriano Baltieri

Rick Bradley

unread,
Mar 19, 2023, 6:24:58 PM3/19/23
to 'knud van eeden' via SemWare TSE Pro text editor
I've tried several combinations of quotes and apostrophes but they all
result in TSE being unable to open any file.

On 19 Mar 2023 at 21:43, 'knud van eeden' via SemWare wrote:

> What about embedding the double quotes within single quotes:
> Call Shell( "C:\TSEPro\g32.exe" & " " &
> '"E:\Food\rec-temp\recipe_fields.txt "' & filePath, 1)
>
> with friendly greetingsKnud van Eeden
> On Sunday, March 19, 2023 at 10:32:36 PM GMT+1, fjbr
> <fjbr...@gmail.com> wrote:
>
> This will be quite mundane given the esoteric exchanges of late but I
> do need some help. I need to open two files from  within MS Access
> which I'm trying to do using the Shell function.  Call
> Shell("C:\TSEPro\g32.exe" & " " & "E:\Food\rec-temp\recipe_fields.txt
> " & filePath, 1)This opens TSE and the first file but the variable
> contains "file name with spaces.txt" so I get four other files open.
> Trying to use apostrophes either in the variable or the shell command
> results in an error in TSE being unable to open any files. I control
> the file names so I could just use underscores in the names but I'm
> pretty sure there will be a better solution.
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> semware+u...@googlegroups.com. To view this discussion on the
> web visit
> https://groups.google.com/d/msgid/semware/fd68bd30-d12b-4048-b585-3099
> 56ea6943n%40googlegroups.com.
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> semware+u...@googlegroups.com. To view this discussion on the
> web visit
> https://groups.google.com/d/msgid/semware/1632223503.2282769.167926220
> 5247%40mail.yahoo.com.
>


Regards
F.J. (Rick) Bradley

It takes a lot of time to be a genius, you have to sit around so much
doing nothing, really doing nothing.
--Gertrude Stein


knud van eeden

unread,
Mar 19, 2023, 6:38:36 PM3/19/23
to 'knud van eeden' via SemWare TSE Pro text editor
One more trick:

insert double quotes escaped, e.g.

\"filename with spaces\"

does that work?

knud van eeden

unread,
Mar 19, 2023, 6:47:32 PM3/19/23
to 'knud van eeden' via SemWare TSE Pro text editor
1. OK, I see that I have Microsoft Access installed on my computer (see screenshot).

2. So if you give me very precise instructions (like 1, 2, 3, ...) I will try to reproduce the issue and see where I can come up with.

with friendly greetings
Knud van Eeden


Inline image


Rick Bradley

unread,
Mar 19, 2023, 6:53:17 PM3/19/23
to 'knud van eeden' via SemWare TSE Pro text editor
Knud:

"\'" in the shell command produced a compile error while building it into
the variable produced the same error in TSE
> > 99 56ea6943n%40googlegroups.com.
> >
> >
> > --
> >
> > ---
> > You received this message because you are subscribed to the Google
> > Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> > group and stop receiving emails from it, send an email to
> > semware+u...@googlegroups.com. To view this discussion on the
> > web visit
> > https://groups.google.com/d/msgid/semware/1632223503.2282769.1679262
> > 20 5247%40mail.yahoo.com.
> >
>
>
> Regards
> F.J. (Rick) Bradley
>
> It takes a lot of time to be a genius, you have to sit around so much
> doing nothing, really doing nothing. --Gertrude Stein
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> semware+u...@googlegroups.com. To view this discussion on the
> web visit
> https://groups.google.com/d/msgid/semware/64178BB7.32537.45AE65E%40ric
> k.fjbradley.com.
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> semware+u...@googlegroups.com. To view this discussion on the
> web visit
> https://groups.google.com/d/msgid/semware/226877652.2289223.1679265512
> 042%40mail.yahoo.com.
>


Regards
F.J. (Rick) Bradley

Man will do many things to get himself loved; he will do all things to get
himself envied.
--Mark Twain


Rick Bradley

unread,
Mar 19, 2023, 6:53:17 PM3/19/23
to 'knud van eeden' via SemWare TSE Pro text editor
Knud:

The code segment follows:
Private Sub btnFormatRecipe_Click()
Dim dialog As FileDialog, filePath As String, fileName As String
Set dialog = Application.FileDialog(msoFileDialogFilePicker)
On Error GoTo SkipOut
With dialog
.InitialFileName = "E:\food\rec-temp\"
.AllowMultiSelect = False
.Show
filePath = .SelectedItems.Item(1)
filePath = "\'" & filePath & "\'"
fileName = Right$(filePath, Len(filePath) - InStrRev(filePath, "\"))
End With
Call Shell("C:\TSEPro\g32.exe" & " " &
"E:\Food\rec-temp\recipe_fields.txt " & filePath, 1)
SkipOut:
On Error GoTo 0
End Sub


On 19 Mar 2023 at 22:47, 'knud van eeden' via SemWare TSE Pro text
wrote:

> 1. OK, I see that I have Microsoft Access installed on my computer
> (see screenshot).
> 2. So if you give me very precise instructions (like 1, 2, 3, ...) I
> will try to reproduce the issue and see where I can come up with. with
> > 99 56ea6943n%40googlegroups.com.
> >
> >
> > --
> >
> > ---
> > You received this message because you are subscribed to the Google
> > Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> > group and stop receiving emails from it, send an email to
> > semware+u...@googlegroups.com. To view this discussion on the
> > web visit
> > https://groups.google.com/d/msgid/semware/1632223503.2282769.1679262
> > 20 5247%40mail.yahoo.com.
> >
>
>
> Regards
> F.J. (Rick) Bradley
>
> It takes a lot of time to be a genius, you have to sit around so much
> doing nothing, really doing nothing. --Gertrude Stein
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> semware+u...@googlegroups.com. To view this discussion on the
> web visit
> https://groups.google.com/d/msgid/semware/64178BB7.32537.45AE65E%40ric
> k.fjbradley.com.
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> semware+u...@googlegroups.com. To view this discussion on the
> web visit
> https://groups.google.com/d/msgid/semware/226877652.2289223.1679265512
> 042%40mail.yahoo.com.
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> semware+u...@googlegroups.com. To view this discussion on the
> web visit
> https://groups.google.com/d/msgid/semware/697024279.422819.16792660491
> 29%40mail.yahoo.com.
>


Regards
F.J. (Rick) Bradley

We are all amateurs; we don't live long enough to become anything else.
--Charlie Chaplin


knud van eeden

unread,
Mar 19, 2023, 7:11:51 PM3/19/23
to 'knud van eeden' via SemWare TSE Pro text editor
If you tell me thus *exactly* what to do to reproduce it, I will probably come up with some solution or workaround.
Like 1. click on this, 2. click on that, 3. write this, and so on...


Rick Bradley

unread,
Mar 19, 2023, 9:03:52 PM3/19/23
to 'knud van eeden' via SemWare TSE Pro text editor
Knud:

Just attach the previously sent code to a button after putting your own
values into InitialFileNameand the named file in the shell command.
Press the button and select another file with spaces in the name.

On 19 Mar 2023 at 23:11, 'knud van eeden' via SemWare TSE Pro text
wrote:

> If you tell me thus *exactly* what to do to reproduce it, I will
> probably come up with some solution or workaround.Like 1. click on
> this, 2. click on that, 3. write this, and so on...
>
> On Sunday, March 19, 2023 at 11:47:29 PM GMT+1, knud van eeden
> <knud_va...@yahoo.com> wrote:
>
> 1. OK, I see that I have Microsoft Access installed on my computer
> (see screenshot).
> 2. So if you give me very precise instructions (like 1, 2, 3, ...) I
> will try to reproduce the issue and see where I can come up with. with
> > 99 56ea6943n%40googlegroups.com.
> >
> >
> > --
> >
> > ---
> > You received this message because you are subscribed to the Google
> > Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> > group and stop receiving emails from it, send an email to
> > semware+u...@googlegroups.com. To view this discussion on the
> > web visit
> > https://groups.google.com/d/msgid/semware/1632223503.2282769.1679262
> > 20 5247%40mail.yahoo.com.
> >
>
>
> Regards
> F.J. (Rick) Bradley
>
> It takes a lot of time to be a genius, you have to sit around so much
> doing nothing, really doing nothing. --Gertrude Stein
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> semware+u...@googlegroups.com. To view this discussion on the
> web visit
> https://groups.google.com/d/msgid/semware/64178BB7.32537.45AE65E%40ric
> k.fjbradley.com.
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> semware+u...@googlegroups.com. To view this discussion on the
> web visit
> https://groups.google.com/d/msgid/semware/226877652.2289223.1679265512
> 042%40mail.yahoo.com.
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> semware+u...@googlegroups.com. To view this discussion on the
> web visit
> https://groups.google.com/d/msgid/semware/530482463.2313078.1679267505
> 740%40mail.yahoo.com.
>


Regards
F.J. (Rick) Bradley

Tea, though ridiculed by those who are naturally coarse in their
nervouse sensibilities...will always be the favored beverage of the
intellectual.
--Thomas DeQuincy


knud van eeden

unread,
Mar 19, 2023, 9:18:34 PM3/19/23
to 'knud van eeden' via SemWare TSE Pro text editor
I guess it is the best when you export your setup and let me import it.



Inline image


knud van eeden

unread,
Mar 19, 2023, 9:19:33 PM3/19/23
to SemWare TSE Pro Text Editor

Carlo Hogeveen

unread,
Mar 20, 2023, 5:08:33 AM3/20/23
to sem...@googlegroups.com

No idea if this is doable from Access, but it is an existing TSE solution, with a small drawback.

If you can list all your files to be opened in a file that has no spaces in its name, then TSE can open them with its "ldflist" macro.

For example, if file "d:\myfilelist.txt" contains
d:\file 1.txt
d:\file 2.txt
d:\file 3.txt
then this command will open the file list plus the three files:
g32.exe d:\myfilelist.txt -eldflist

The small drawback is that d:\myfilelist.txt is loaded too and becomes the current file.
A nice benefit is, that you are not limited to TSE's limited command line length.

Carlo



Rick Bradley

unread,
Mar 20, 2023, 12:16:11 PM3/20/23
to Carlo Hogeveen, sem...@googlegroups.com
Carlo:

That worked even better than you thought as writing the target file
name and the template file into a third file and opening it with the
suggested options resulted in just the two required files being opened.

Mission accomplished. Thank you.
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "SemWare TSE Pro text editor" group. To unsubscribe from this
> group and stop receiving emails from it, send an email to
> semware+u...@googlegroups.com. To view this discussion on the
> web visit
> https://groups.google.com/d/msgid/semware/00ac01d95b0b%248a0f0bb0%249e
> 2d2310%24%40ecarlo.nl.


Regards
F.J. (Rick) Bradley

Man is the only animal that blushes -- or has reason to.
--Mark Twain


Reply all
Reply to author
Forward
0 new messages