aheimdal, Not knowing your exact application I cannot replicate exactly what you want but I played around and used the macro switch to bring me to a form with buttons and no command tree. This is an example of my shortcut command line starting sesame with a macro and my own splash screen
C:\Sesame\ver\may18\sesame.exe -macro c:\sesame\start2mac.mac -splash c:\sesame\pics\ids4.jpg c:\sesame\data\menutry1.db
I then had a command button to add workorder I used the new record commands explained starting on page 8 in supplement for version 1.031
I then used a command button SEARCH FOR A WORKORDER with the @selectTreeitem () command see page 160 and 161 in programming guide. My example used:
// Selects Search mode
var vsearch as int if lastname <> "mcsd"
{
Vsearch=@selectTreeitem ("Search Update Menu!Search (F7)") }
3.COSTING INFORMATION OF A WORKORDER
I had no clue what this should do.
Then I used a command button CREATE A REPORT I used an example from previous posts and from Appendix 2 of the Sesame Programming Guide. This pops up a list of report choices when clicked it merges automatically.
// Letter Merge routine
var vFileHandle as Int // For writing data file var vHeader as String // Data file header line var vData as String // Data file data line var n as Int = 1 // General purpose counter var vSelectedDoc as String // Document selected from menu var vOneOrAll as String // Include record(s) option var F as array[25] of String // Mergeable fields array var vStartingRec = @ResultSetCurrentPosition() var vGoPrint as String
/* This program differs slightly from the one in Appendix 2 of the Sesame Programming Guide. This one gets its list of available merge documents from an external text file (list.txt) instead of the document names being hard-coded into the program. One may then create any number of merge documents, and simply edit the list.txt file (with Notepad) to correspond to the available merge documents */
// Next 4 lines user modifiable var vDataPath as String = "c:\sesame\docs\num1.txt" var vDocsPath as String = "c:\sesame\docs\" var vWordPath as String = "c:\sesame\word.bat" var vListPath as String = "c:\sesame\docs\list.txt"
SUBROUTINE PrintCurrentRecordOnly()
If @Askuser("Merge print the " + vSelectedDoc + " for " + vOneOrAll + "?","","") Then {
vGoPrint = "Yes"
n = 1 While F[n] <> "" { vHeader = vHeader + F[n] + "^" vData = vData + @(F[n]) + "^" n = n + 1 }
vFileHandle = fileOpen(vDataPath) fileSeek(vFileHandle, 0) fileWriteLn(vFileHandle, vHeader + @NewLine() + vData) fileClose(vFileHandle)
}
END SUBROUTINE
SUBROUTINE PrintAllRetrievedRecords()
var n as Int var i as Int = 1
If @Askuser("Merge Print " + vSelectedDoc + " for these " + @ResultSetTotal() + " retrieved records?", "( If not, cancel this task, press F7 for a new search,"," and retrieve the records DO you want to print. )") Then {
vGoPrint = "Yes"
n = 1 While F[n] <> "" { vHeader = vHeader + F[n] + "^" n = n + 1 }
vFileHandle = fileOpen(vDataPath) fileSeek(vFileHandle, 0) fileWriteLn(vFileHandle, vHeader)
For n = 1 to @ResultSetTotal()
ResultSetCurrentPosition(n)
While F[i] <> "" { vData = vData + @(F[i]) + "^" i = i + 1 }
FileWriteLn(vFileHandle, vData)
@Msg("Processed Record " + n + " of " + @ResultSetTotal()) vData = "" i = 1
Next
fileClose(vFileHandle)
// Rewind to record where it all started ResultSetCurrentPosition(vStartingRec)
}
END SUBROUTINE
// BEGIN MAIN PROGRAM
// Build documents menu
vSelectedDoc = @PopupMenu( @insert(vListPath), "SELECT MERGE DOCUMENT" )
// Build which record(s) menu
vOneOrAll = @PopupMenu( "THIS Record Only;" + "ALL Retrieved Records;" , "SELECT RECORD(S) TO MERGE PRINT" )
If vSelectedDoc <> "" and vOneOrAll <> "" Then {
// Delete exsting data file. New one will be generated. If FileExists(vDocsPath + vSelectedDoc) Then { fileDelete(vDataPath)
// Fields available for merging F[1] = "patientid"; F[2] = "itemextamt"; F[3] = "lastname" F[4] = "homephone" ; F[5] = "workphone"; F[6] = "Homestreet" F[7] = "HomeState"; F[8] = "homeZip" ; F[9] = "homecity" F[10]= "Emailhome"; F[11]= "insconameprimary"; F[12]= "insconamesec" F[13]= "DateEntered"; F[14]= "cellphone"; F[15]= "insuredemployer"
If vOneOrAll = "THIS Record Only" Then PrintCurrentRecordOnly() Else PrintAllRetrievedRecords()
If vGoPrint = "Yes" Then { // Start Word via Word.bat and pass doc filename. n = @Shell(vWordPath + " " + @Chr(34) + vDocsPath + vselectedDoc + @Chr(34)) If n = 1 Then @MSgbox(vDocsPath + vSelectedDoc,"word.bat not found or something else wrong.","") } } Else @Msgbox(vDocsPath + vSelectedDoc + " doesn't exist.","","Aw shucks!") } I then used a command button EXIT
See @Exit page 86 in programming Guide
This is only an example of some methods that could work for you. There are many other and probably better ways. I just wanted to try and give you an idea on how to progress.
Hope this helps
|