Skip to content

Instantly share code, notes, and snippets.

@jslarve
Last active January 2, 2026 19:13
Show Gist options
  • Select an option

  • Save jslarve/04c76d2ca1af20fecd86af2aa0598fe9 to your computer and use it in GitHub Desktop.

Select an option

Save jslarve/04c76d2ca1af20fecd86af2aa0598fe9 to your computer and use it in GitHub Desktop.
TPS Table Remover - Doesn't need to know file structure
PROGRAM
!MIT License
!
!Copyright (c) 2004 Jeff Slarve
!
!Permission is hereby granted, free of charge, to any person obtaining a copy
!of this software and associated documentation files (the "Software"), to deal
!in the Software without restriction, including without limitation the rights
!to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
!copies of the Software, and to permit persons to whom the Software is
!furnished to do so, subject to the following conditions:
!
!The above copyright notice and this permission notice shall be included in all
!copies or substantial portions of the Software.
!
!THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
!IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
!FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
!AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
!LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
!OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
!SOFTWARE.
!
MAP
RemoveTPSTable(STRING pTableName,<STRING pOwnerID>),LONG,PROC
END
BuiltFilePath CSTRING(401)
Password CSTRING(101)
CODE
IF NOT COMMAND('1') OR NOT COMMAND('2')
MESSAGE('Tableremove.exe: A commandline program designed for|the quick removal of a table within a TOPSPEED data file.||Usage:||tableremove yourtpsfile tablename [password]|','Usage',ICON:EXCLAMATION)
RETURN
END
BuiltFilePath = LONGPATH(COMMAND('1')) & '\!' & COMMAND('2')
Password = CLIP(COMMAND('3'))
IF RemoveTPSTable(BuiltFilePath,Password)
MESSAGE('Remove() failed on "' & BuiltFilePath &'"'& |
CHOOSE(NOT Password,'','<13,10>Using Password: "'& Password & '"' ) & |
'<13,10><13,10>Error Code: ' & ERRORCODE()&' '& ERROR() & |
CHOOSE(~FILEERRORCODE(),'','<13,10>Driver Error: ' & FILEERRORCODE()&' '&FILEERROR() ) & |
CHOOSE(~ERRORFILE(),'','<13,10>File Name: ' & ERRORFILE()) , 'RemoveTPSTable Error',ICON:EXCLAMATION,,,MSGMODE:CANCOPY)
ELSE
MESSAGE('Removed: ' & BuiltFilePath ,'Success')
END
RemoveTPSTable PROCEDURE(STRING pTableName,<STRING pOwnerID>)!,LONG,PROC
FileName STRING(400),STATIC
OwnerID CSTRING(101),STATIC
F FILE,DRIVER('TOPSPEED'),NAME(FileName),PRE(F),OWNER(OwnerID),ENCRYPT
Record RECORD
END
END
CODE
IF NOT pTableName
RETURN 0
END
OwnerID = CLIP(pOwnerID)
FileName = pTableName
REMOVE(F)
RETURN ERRORCODE()
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{896C2BCF-8F4B-4E93-A997-93B423A4427E}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">Win32</Platform>
<OutputType>WinExe</OutputType>
<AssemblyName>tableremove</AssemblyName>
<OutputName>tableremove</OutputName>
<Model>Lib</Model>
<cpu>386</cpu>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<vid>full</vid>
<check_stack>True</check_stack>
<check_index>True</check_index>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<vid>off</vid>
<check_stack>False</check_stack>
<check_index>False</check_index>
</PropertyGroup>
<ItemGroup>
<FileDriver Include="TOPSPEED" />
<Compile Include="tableremove.clw" />
</ItemGroup>
<Import Project="$(ClarionBinPath)\SoftVelocity.Build.Clarion.targets" />
</Project>
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Clarion 2.1.0.2447
Project("{12B76EC0-1D7B-4FA7-A7D0-C524288B48A1}") = "tableremove", "tableremove.cwproj", "{896C2BCF-8F4B-4E93-A997-93B423A4427E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{896C2BCF-8F4B-4E93-A997-93B423A4427E}.Debug|Win32.Build.0 = Debug|Win32
{896C2BCF-8F4B-4E93-A997-93B423A4427E}.Debug|Win32.ActiveCfg = Debug|Win32
{896C2BCF-8F4B-4E93-A997-93B423A4427E}.Release|Win32.Build.0 = Release|Win32
{896C2BCF-8F4B-4E93-A997-93B423A4427E}.Release|Win32.ActiveCfg = Release|Win32
EndGlobalSection
EndGlobal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment