Hi George,
Perhaps try assigning ProcessThese.FullPath to a variable first; e.g:
sFullPath = ProcessThese.FullPath
Print #1, sFullPath
You will need to declare the variable first (at the beginning of the program):
Dim sFullPath As String
Also please note the following:
* The "Run Command CmdString" line is unrelated to what you're trying to do here (but don't delete it - it is still a required part of your code)
* I understand from your previous post that this code is in a loop. Whilst what you have done should work, it would be better to execute the 'Open file "D:\4_RefreshMB.txt" for output as #1' statement just before the start of the loop, then close the file at the end of the loop.
------------------------------
James Nolet
Dooley Mitchell & Morrison Pty Ltd
------------------------------
Original Message:
Sent: 02-14-2019 19:12
From: George Corea
Subject: Mapinfo crashes when trying to print to txt file
I want to log the text from a message window in a mapbasic script to a txt file but the program now crashes.
Print ProcessThese.FullPath
Open file "D:\4_RefreshMB.txt" for output as #1
Print #1, ProcessThese.FullPath
Close File #1
Run Command CmdString

Problem signature: Problem Event Name: BEX Application Name: Mapinfow.exe Application Version: 12.5.0.206 Application Timestamp: 54bd32f4 Fault Module Name: MSVCR110.dll Fault Module Version: 11.0.50727.1 Fault Module Timestamp: 5011aa2a Exception Offset: 0009e1d1 Exception Code: c0000417 Exception Data: 00000000 OS Version: 6.1.7601.2.1.0.272.7 Locale ID: 3081 Additional Information 1: 3a04 Additional Information 2: 3a0491f107d8a808063562f7a7e91ce4 Additional Information 3: cb13 Additional Information 4: cb1337f25bf49f1acbe672c17d32b428Read our privacy statement online: http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409If the online privacy statement is not available, please read our privacy statement offline: C:\Windows\system32\en-US\erofflps.txt
The code runs fine without the open/close file commands but I want to have a log file.
------------------------------
George Corea
Mangoesmapping
------------------------------