Decided I needed a quick way to remind myself of these system constants that can be accessed with the finddir command.
So I wrote one in yab. It doesn’t just display a static list. If the devs change a system constant, it will be reflected in this app as well. Single-clicking an item copies the constant to the clipboard. Double-clicking it opens the directory in Tracker.
#!/bin/env yab
############# Prologue #############
//*************************
//*****Global Variables****
//*************************
## Technically, yab does not require you to declare global variables,
##It just is a really, really good idea to do it anyway.
// set DEBUG = 1 to print out all messages on the console
DEBUG = 1
//change this to DEBUG = 0 when you are ready to bind the program for distribution
ProgramName$ = "SysPathDisplay"
tempfile$= rtrim$(system$("finddir B_COMMON_TEMP_DIRECTORY")) + "/" + ProgramName$ + ".ini"
selected$ = ""
invoked$ = ""
##########################
###Preliminary Commands###
##########################
system("finddir -l | sort >" + tempfile$)
## Commands to run before the Main Loop come here.
## e.g. setting up a window with a menu.
OpenWindow()
#######End of Prologue#######
//Main Message Loop
dim msg$(1)
while(not leavingLoop)
nCommands = token(message$, msg$(), "|")
for everyCommand = 1 to nCommands
if(DEBUG and msg$(everyCommand)<>"") print msg$(everyCommand)
switch(msg$(everyCommand))
case "_QuitRequested":
case "MainWindow:_QuitRequested":
leavingLoop=1
break
default:
break
end switch
if instr(msg$(everyCommand), "MainView:_Select:") then
selected$ = columnbox get$ "MainView", 1, columnbox get "MainView"
clipboard copy selected$
elseif instr(msg$(everyCommand), "MainView:_Invoke:")
invoked$ = columnbox get$ "MainView", 2, columnbox get "MainView"
launch invoked$
endif
next everyCommand
wend
CloseWindow()
end
sub CloseWindow()
//Close down the main window
window close "MainWindow"
end sub
sub OpenWindow()
//Setup the main window here
local item$, result$, counter
window open 100,100 to 600,700, "MainWindow", ProgramName$
Window set "MainWindow", "flags", "Not-zoomable"
Window set "MainWindow", "flags", "not-resizable"
Window set "MainWindow", "flags", "accept-first-click"
columnbox 0,0 to 500,600, "MainView", 0, "no-sorting, no-border", "MainWindow"
columnbox column "MainView", "Constant", 1 , 230,230,230, "align-left"
columnbox column "MainView", "Directory", 2 , 250,250,250, "align-left"
open tempfile$ for reading as #1
while(not EOF(1))
counter=counter +1
line input #1 item$
result$ = rtrim$(system$("finddir " + item$))
columnbox add "MainView", 1, counter, 16, item$
columnbox add "MainView", 2, counter, 16, result$
wend
close #1
end sub
or download it: xtn.sh - Easy and fast file sharing from the command-line.
