Using script or Automator to set page settings, margins and page wrap automatically on Text Edit files - printing

I'm putting together an installation using Processing, where users type and their text is printed on a receipt printer.
I've got Processing saving out time-stamped text files to a folder, and a folder action in Automator watching that folder and sending to print.
My problem is that these .txt files need some intervention...
Format > Wrap to page
Change margins
Select 80mm receipt roll in Page Setup
I think I have the margins thing figured out by adding some code to the file header on the Processing side. With the rest, I'm drawing a complete blank.
I've tried setting the receipt roll as the default page size in 'Print and scan' in system prefs, but the receipt page size doesn't show in the list in system prefs, only shows on the page size list from within Text Edit application.
I suppose what I'm asking - is there a way of setting TextEdit's default to page wrap, certain page size, certain printer - then a folder action can just print away (I hope).
The idea is that these text files spit out of the receipt printer automatically with no intervention. Does anyone have any ideas? Thanks in advance.

Have you experimented with the settings available for TextEdit in AppleScript? If you look under the print settings section (in TextEdit's Script dictionary), there are a number of options available, which may help you achieve something pretty close to what you want. You could then drop the AppleScript into a Run AppleScript action in your Automator folder action.
Alternatively, you could go completely nuts and design a template in Pages that meets your criteria, and then extract your text, paste into your Pages template, and print that out. A whole lot more work, but once it became functional, you would only need to change the Pages template in the future to meet changing needs.

Related

Troubleshooting ZPL editing and saving to printer flash

I am using ZebraDesigner to create labels and save them as .zpl, files, then manually editing the zpl code to customize it further, and then save it in the printer's directory in onboard flash memory.
I see the .zpl files, listed with their sizes, in the flash directory, but the files are blank when opened, or sometimes contain text belonging to another file. If I try to paste new code into the file in flash, I'm unable to save it; meaning, I click save, and the web pages merely changes the file extension from ".zpl" to "---", then if I save again, then I get an error the script could not be saved.
I've been unable to get sufficient information nor resolution by contacting Zebra or looking at the product documentation. Advice would be appreciated.

Delphi: Set Browsers Homepage

I want my application to be able to set IE, Firefox, Chrome & Operas homepages when a button is pressed. I understand IEs homepage is set in the registry, which I understand how to change, but can anyone give me any help with the others? Thanks
Chrome stores the homepage in a file called 'Preferences'. On Windows XP, this is located at;
C:\Documents and Settings\USERNAME\Local Settings\Application
Data\Google\Chrome\User Data\Default
On Vista+, it's located at;
C:\Users\USERNAME\AppData\Local\Google\Chrome\User Data\Default
This file is JSON format, and so it can be opened and viewed as plain text. In order to change the homepage, you'd need to load the JSON from this file, and change the homepage field value. You may also need to change the homepage_changed field value in order for it to stick. Using something like SuperObject to change the field would be an easy solution (if I get time, I'll write up some example code later).
Firefox uses a pref.js file to store it's settings, and realistically, a way of changing this would be to load this file, find the something that's along the lines of;
user_pref("browser.startup.homepage", "[URL]");
...and edit it as appropriate before saving the file. This should be a simple task using some simple find-and-replace code. I'd strongly advise that you use a pos() function though, as it could be that the end-user has already got their own custom homepage set and so searching for a preset string (e.g. [URL]) may not work, and certainly wouldn't be reliable.
A quick search hasn't given me enough information about Opera to provide a solution, but I'll keep looking and respond if I do find such a way.
Note that none of these methods have been tested and are merely provided based upon some very quick research.

textarea that was using plain text with option of markdown or textile filter now needs images

My clients can enter text into textarea and have the option to use the markdown or textile filters for each textarea.
With some models (articles, newsletter, etc) they can upload images to associate with the model, which are displayed in a column next to the text of the text.
This worked fine for a while, but they have now told me that the want the ability to put the images INSIDE the text a specific positions.
What is the best way to go about this? I suppose I may have to use a wysiwyg for this, but would rather not. And how would this work for images which are not yet on the server, etc?
There are different directions you could go to:
Follow the path of Confluence, which released in their new version 4.0 a rewritten WYSIWYG editor, that stores as source XHTML, not any more wiki markup.
Leads to an update of all pages when migrating.
Was pretty difficult to implement. I do not know if they use any more the TinyMCE editor of previous versions.
Follow the format of markdown how to include images in your source format. So by typing: This is my text. !image.png! The inline image shows ..., you will have a format that is understandable.
You have to expand the interpretation, so that the !<filename>! will be mapped that is stored locally anyway.
You have to add clear-up dialogs for the images that are yet not known, so doing bulk uploads ...
You may provide a drag area on your view, that then shows the filename and gives examples how to include that inside the text area.
Go for something in between, by allowing users to drag images inside the editor. There are plugins written in Javascript that allow you to do that, e.g. UI Draggable for jquery
I have no idea how to integrate that image inside the text editor. Overlay?
So the second one is the easiest, and the user knows how to do it. If they only decide that this is the solution they want to have :-)
I think I'm going to use a combination of #2 above, and the Liquid templating engine.

WiX custom license file: setup shows links with < >

I created a WiX 3.5 setup with a custom license file by putting this into the .wxs file:
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
This works perfectly and the link is displayed when I run the created .msi file.
(I'm using the WixUI_InstallDir Dialog Set)
Now I want to put a hyperlink into the license file.
I just put the link into the file by opening it in WordPad and pasting http://mylink.com (WordPad turns it into a hyperlink automatically).
When I compile that in WiX, the license agreement dialog shows the link like this:
<http://mylink.com>
I noticed that this seems to relate to WordPad creating a hyperlink automatically (see above).
When I remove the http:// part from the link in the license file, WordPad doesn't recognize it as a link anymore and in the compiled .msi file, the < and > in the license agreement dialog go away.
Any ideas how I can get rid of the additional < and >, except putting the link into the license file without the http:// part?
EDIT:
Okay, maybe I didn't think enough when I used the word "hyperlink".
What I actually meant was: It does not have to be an actual clickable hyperlink.
I just want the adress of my web page to be displayed at the top of the license file.
I'm perfectly fine if it's just the URL as text (not clickable), but I want it to be displayed as I entered it, and not with < >.
The problem is that WordPad automatically turns any URL into a hyperlink as soon as I enter it, so I have no idea how to get the license agreement dialog to treat it as normal text.
Windows Installer doesn't support hyperlinks in the scrollable text control. This is why the link is not displayed correctly. Even if it was, nothing would happen when you click it because Windows Installer doesn't handle this event.
A hyperlink in a scrollable text control works only if you use an external UI which handles it.
Edit:
If you just want to display some text as a link, the usual approach is make it blue and underlined. As you already noticed Windows Installer doesn't show conventional hyperlinks correctly.
If you want to show a link as normal text, simply open the RTF file with a normal text editor (for example notepad.exe) and remove the hyperlink markers. Just follow the normal text formatting and you will easily spot the markers you want to remove.

Pdf modification on iOS

I am looking to be able to open a pdf file (done) and then be able to use the touch screen to sign the pdf and then save it with the modification. From what i have read this is no easy task, and i have no idea where to begin. Any of you know any tutorials or frameworks that will help me with this ?
Also if possible being able to modify fields of a pdf file, on the desktop the pdf can have fields you can click on then type in to fill out the form, without the need to ever print. If this is possible as well that would be perfect.
Thanks.
Maybe libHaru (http://libharu.org/wiki/Main_Page) does what you want, it's worth a try.
Does your starting point have to be a PDF? steipete's suggestion of using a system to create the PDF would work if your app workflow could create the PDF (sans signature) and display it, the user "signs" it in your app, and you create the PDF again this time with the signature embedded. It depends on whether this flow is an option for your app. Often it seems easier if you treat PDF as a final document and produce the PDF in it's final form each time (final meaning that you're not going to try modifying it).

Resources