Running from Other Applications


You can run Stonefield Query for Sage Timberline Office from the Windows Command Prompt, the Windows Run dialog, a batch file, or another application so you don't have to find its icon on the Windows Desktop or in the Start menu and so you can have it automatically log in or run a particular report. To do so, execute:

directory\SFQuery.exe

In place of directory, enter the directory where Stonefield Query for Sage Timberline Office is installed. If there is a space in the directory, put quotes around this command. For example:

"C:\Program Files\Stonefield Query for Sage Timberline Office\SFQuery.exe"

If the Stonefield Query for Sage Timberline Office configuration files aren't located in the same directory as SFQUERY.EXE and Stonefield Query for Sage Timberline Office hasn't been run before on this computer, add "ini=directory" to the command line. In place of directory, enter the directory where the configuration files are located. Again, if there are any spaces in the directory, surround the entire parameter with quotes.

To automatically log into Stonefield Query for Sage Timberline Office, add "user=username" and "password=userpassword" to the command line. In place of username and userpassword, enter the user name and password. Here's an example (although this example is displayed on several lines for formatting purposes, enter everything on one line):

"C:\Program Files\Stonefield Query for Sage Timberline Office\SFQuery.exe"
  user=etaylor password=diamond

If more than one database is available, specify a particular database to use by adding "database=databasepath" to the command line. In place of databasepath, enter the full path of the database as you see it in the Stonefield Query for Sage Timberline Office Open Database dialog. If there are any spaces in the database path, surround the entire parameter with quotes. Here's an example, assuming we see "C:\Program Files\Timberline Office\Construction Sample Data" in the Open Database dialog:

"C:\Program Files\Stonefield Query for Sage Timberline Office\SFQuery.exe"
  user=etaylor password=diamond 
  "database=C:\Program Files\Timberline Office\Construction Sample Data"

If you want Stonefield Query for Sage Timberline Office to automatically print a particular report, add "report=reportname" to the command line. In place of reportname, enter the name of the report. Put quotes around the entire parameter (for example, "report=Invoice Details") if there are any spaces in the report name. If you want to run more than one report, specify "report1=reportname1", "report2=reportname2", and so forth.

Stonefield Query for Sage Timberline Office can also accept several other parameters that tell it how to behave:

If the command line becomes too long (Stonefield Query for Sage Timberline Office only accepts 15 parameters; more than that cause an error) or you'd rather put the parameters into a file for more flexibility (it's probably easier to change the contents of a file than to change how Stonefield Query for Sage Timberline Office is called), specify the name of the file containing the parameters by adding "parameters=filename", where filename is the name of the file containing the parameters. The file must contain the same format of parameters passed on the command line, with each parameter on a separate line, except you don't need quotes even if there are spaces in the names. Here's an example of such a file that outputs the Invoice Details for March 2001 to an Excel document named C:\Temp\My Spreadsheet.xls and the Employee Start Date report to a PDF file named C:\Temp\MyPDF.pdf, and then exits Stonefield Query for Sage Timberline Office:

report1=Invoice Details
filename1=C:\Temp\My Spreadsheet.xls
value1=2001-03-01,2001-03-31
report2=Employee Start Date
filename2=C:\Temp\MyPDF.pdf
user=etaylor
password=diamond
TIMBERUSERNAME=mytimbOPID
TIMBERPASSWORD=mypass

Here are some examples of these parameters (although these examples are displayed on several lines for formatting purposes, enter everything on one line):

"C:\Program Files\Stonefield Query for Sage Timberline Office\SFQuery.exe"
   "report=Invoice Details" user=etaylor password=diamond

Prints the Invoice Details to the printer.

"C:\Program Files\Stonefield Query for Sage Timberline Office\SFQuery.exe"
  "report=Invoice Details" preview
  user=etaylor password=diamond

Displays the Invoice Details in the preview window.

"C:\Program Files\Stonefield Query for Sage Timberline Office\SFQuery.exe"
  "report=Invoice Details" preview
  value=2001-03-01,2001-03-31
  user=etaylor password=diamond

Displays the Invoice Details in the preview window for records between March 31, 2001 and March 31, 2001 (assuming an ask at runtime condition on the date range).

"C:\Program Files\Stonefield Query for Sage Timberline Office\SFQuery.exe"
  "report=Invoice Details" filename=C:\Temp\MySpreadsheet.xls
  user=etaylor password=diamond

Outputs the Invoice Details to an Excel document named C:\Temp\MySpreadsheet.xls and brings up Excel once the document is ready.

"C:\Program Files\Stonefield Query for Sage Timberline Office\SFQuery.exe"
  "report=Invoice Details" filename=C:\Temp\MySpreadsheet.xls
  noshow user=etaylor password=diamond

Outputs the Invoice Details to an Excel document named C:\Temp\MySpreadsheet.xls but doesn't bring up Excel.

"C:\Program Files\Stonefield Query for Sage Timberline Office\SFQuery.exe"
  "report=Invoice Details" preview exit
  user=etaylor password=diamond

Displays the Invoice Details in the preview window and exits Stonefield Query for Sage Timberline Office once the preview window is closed.

"C:\Program Files\Stonefield Query for Sage Timberline Office\SFQuery.exe"
  "report=Invoice Details" "filename=C:\Temp\My Spreadsheet.xls"
  exit user=etaylor password=diamond

Outputs the Invoice Details to an Excel document named C:\Temp\My Spreadsheet.xls, exits Stonefield Query for Sage Timberline Office, and opens the document in Excel.

"C:\Program Files\Stonefield Query for Sage Timberline Office\SFQuery.exe"
  "report=Invoice Details" mailto=myboss@mycompany.com
  "subject=This Week's Invoice Details Report"
  "body=Here's the invoice details for this week."
  exit user=etaylor password=diamond

Emails the Invoice Details as a PDF file attached to a message sent to myboss@mycompany.com.