Results 1 to 2 of 2

Thread: Script to create a new text record - and then print it?

  1. #1
    New Member
    Join Date
    Jul 2012
    Posts
    1

    Default Script to create a new text record - and then print it?

    Hello everyone,

    I have been using a script cobbled together from various examples on here, which prompts me for a few bits of information, then creates a record in EagleFiler based on that information. This has been very helpful for the last little while; I use it to make work orders to give to my maintenance team. However, I print every single one of these, and so far the best I've been able to figure out is to just go to EagleFiler and manually print the record that I just created.

    Is there a way to automatically print this with my default printer?

    Here's my script:

    Code:
    -- set date in wanted format
    set theDate to current date
    set dm to month of theDate as number
    set dd to day of theDate
    set dy to year of theDate
    set fDate to do shell script "date '+%Y.%m.%d'" as string
    
    set _location to {}
    try
    	display dialog "Where is the problem? (e.g. SSB1 or CCG4)" default answer ""
    	set _locAnswer to text returned of result
    	if _locAnswer is not "" then
    		set _location to _locAnswer
    	end if
    end try
    
    set _problem to {}
    try
    	display dialog "What's the matter? (e.g. The sink is inflatable)" default answer ""
    	set _probAnswer to text returned of result
    	if _probAnswer is not "" then
    		set _problem to _probAnswer
    	end if
    end try
    
    set _whofix to {}
    try
    	display dialog "Who should handle this? (e.g. Richard, or D&D)" default answer ""
    	set _whoAnswer to text returned of result
    	if _whoAnswer is not "" then
    		set _whofix to _whoAnswer
    	end if
    end try
    
    set _tags to {_location, fDate, "open", "workorder", _whofix}
    set _noteName to fDate & " — " & _location & " — Work Order"
    set _noteBody to _noteName & return & return & "Work Order for: " & _whofix & return & return & "Date: " & fDate & return & "Location: " & _location & return & return & "Description: " & return & _problem & return & return & "Solution:"
    
    tell application "EagleFiler.app"
    	tell «class LibD» 1
    		«event WashImpr» given «class pTxt»:_noteBody, «class pTag»:_tags
    	end tell
    end tell
    Extra credit: I've got another computer on the same network that I'd like to be able to create work orders from. I can't even begin to fathom how to do this. I can obviously just create an RTF in the Eaglefiler library folder, shared via Dropbox... but then I'm afraid those will never get printed reliably. Anyway, that's not too big a deal, just another thought in case you know something obvious.

    Thank you very much for any help you can provide.

  2. #2

    Default

    Quote Originally Posted by Splendorr View Post
    Is there a way to automatically print this with my default printer?
    EagleFiler doesn’t currently support printing via AppleScript, but you could try something like:

    Code:
    tell application "EagleFiler"
        tell library document 1
            set {_record} to import text "The text"
            set _file to _record's file
        end tell
    end tell
    tell application "Finder"
        print _file
    end tell
    Quote Originally Posted by Splendorr View Post
    I've got another computer on the same network that I'd like to be able to create work orders from. I can't even begin to fathom how to do this. I can obviously just create an RTF in the Eaglefiler library folder, shared via Dropbox... but then I'm afraid those will never get printed reliably.
    How about creating the RTF files in a “To Print” folder in your library via Dropbox? Then you could periodically run a script that prints the records in that folder and moves them to a different folder.

Similar Threads

  1. Replies: 5
    Last Post: 12-22-2012, 02:28 PM
  2. Can't create subfolder
    By CTS in forum EagleFiler
    Replies: 4
    Last Post: 05-05-2010, 11:18 AM
  3. Open record in EagleFiler with Record Link
    By istib in forum EagleFiler
    Replies: 5
    Last Post: 03-09-2010, 11:38 AM
  4. Script to set URL to Note Text
    By kaybee in forum EagleFiler
    Replies: 3
    Last Post: 02-25-2010, 01:15 PM
  5. Replies: 0
    Last Post: 08-21-2007, 04:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •