I must make sure that when i click the button on page, chose file dialog window opens. Do you have any idea about implementing this? I use RoR with Capybara.
Short answer: You can't
Longer answer: The file selection box is a system modal, which basically freezes everything until a file is selected. Because of this (and for security reasons) drivers handle attaching files to file inputs differently than most fields. It isn't done by sending keystrokes to fields on the page, but rather by shortcutting the file modal from appearing and adding the file behind the scenes. Because of that you really can't write a test that detects the presence of the choose file window.
Related
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.
I use keyboard shortcuts within CKeditor all the time. One of the very useful ones is to save the page (and close the editor) with Ctrl+Shift+s.
However, I just cannot find a keyboard shortcut to open the editor. I wouldn't be a CKEditor shortcut, but one of the browser. Does one exist?
If not, there still may be an alternative; In Mindtouch it is possible to open the editor on any page by adding the argument action=edit to the page URL. What tool could I use to create a keyboard shortcut that reloads the page with the argument added?
I think shift + f10 should do it? Here is the full list of keyboard shortcuts
See this question for an example of how to create your own key binding
I have an infopath form template at
https://mysite/Shared%20Documents/MyForm.xsn
If you click on the xsn file in your browser and hit "open" it opens up the template and allows you to fill it in and then hit a submit button which saves an xml file to
https://mysite/administrator/In%20Process/filledOutForm.xml
Then if an admin comes into sharepoint and clicks the filled out infopath form, it opens up fine.
However if the user first saves https://mysite/Shared%20Documents/MyForm.xsn locally, then the link to the form template appears to be stripped (i think because the actual form template is actually local now, rather then being viewed from the sharepoint). thats fine and dandy, they can still submit the form, and it gets saved to https://mysite/administrator/In%20Process/filledOutForm.xml but now its missing the href link to the form template. now when an admin tries to open the filled out form, they get an error saying infopath cant find the form template.
I can follow the instructions listed here:
http://blogs.msdn.com/b/infopath/archive/2006/11/01/relinking-forms-and-form-templates.aspx
to "relink" the form to the form template, and that fixes the issue, but I want to fix the underlying issue. How do i make it so that users either cant save it locally (breaking the href to the form template) or make it so that the link to the form template stays there, even if they save the form locally?
Sadly it is more due to training and configuration. We end up "fixing" this all the time (funny it is the same users that seem to have the problem). Some helpful ideas.
Remind your users that the XSN is a template and the XML is their data. They should never really need to save the template. A good analogy is Word dotx and docx - you open the dotx (template) but when you save it defaults to docx (data) - InfoPath does the same thing.
Usually when you "open" an XSN it opens in data mode. When a user clicks save the default is to save as XML. They have to "design" or "open in design mode" (or switch to design mode once open) to actually modify the XSN itself. Remind the users that when they go to save - if it is trying to save as XSN something is wrong and to back up a step.
We also tried to protect the XSN either by security or location so that the common users don't have rights to write/overwrite it - they can only save XML. That way even if they do mess up the system will block the save. Of course that doesn't keep them from local copies.
Just be open minded about it - there will always be cases where you have to go back and relink the template. The more you can reduce the better but they still happen ("but I wanted to keep the template locally so I didn't have to keep going to the website").
I have an app that can optionally open PDF's after it creates them. If two reports are generated in succession with the same name, the second attempt fails if the first copy of acrobat still has the PDF open, so before I write the PDF I check (with FindWindow) for a window with the document name. If one is found I issue a SendMessage WM_Close.
This works OK, but I was doing some other tests and was using Word to "edit" the PDF, to hold it open so I could test the app's behaviour when it can't write the PDF file. Now, when my app tries to close the window, Word pops up a "do you want to save" dialog. If I click cancel, Word remains open, my app carries on and I can test that it behaves sensibly when it encounters a file that it can't write to.
All good, but it has alerted me to the fact that using SendMessage WM_CLOSE to close another app will snag my app if the other app pops up a modal dialog. Is there any way around this - i.e a more forceful (but not too forceful) way of closing the other app? Or a "Close and click on cancel if necessary". Or should I use asynchronous messages?
Do not force any application to close, there may be other documents open the user is viewing etc... You can use SendMessageTimeout to wait the return of WM_CLOSE a sensible amount of time, and then proceed with either failure or success..
var
Word: HWND;
msgResult: DWORD;
begin
...
SendMessageTimeout(Word, WM_CLOSE, 0, 0, SMTO_NORMAL, 5000, msgResult);
if IsWindow(Word) then begin
// bummer! Application is open...
I would not close the other application at all. I think it's better to delete the current file before generating the report. If it fails (DeleteFile), show a message to the user that the file cannot be overwritten (because it is opened by another program) and do not generate the report at all. This is much safer, because you leave the option to the user. Also this saves you from major headaches, what if the program is opened by another program that does not show the title in the window caption?
If you want to go one step further than WM_CLOSE you can only terminate the application. Everything else would be like lottery.
That said I am against both. What if your PDF opens in a MDI application already showing other documents? Forcing the application to close would make the user lose all changes to the other open documents. And sending a close message to this application would be annoying since the user still needs the other documents opened.
You cannot predict the behavior of every application. And you certainly don't know every application. If the report has the same name then you can tell the user to close the other one with the same name. Otherwise he won't get a new report. Think what would happen if Windows started closing your applications as soon as you try to overwrite a file which is currently in use.
I have a slightly weird file upload user flow in an application I am testing which causes the file upload dialogue to remain open when testing with selenium-webdriver, via capybara.
The flow is this:
User is presented with a choice of 3 buttons (to specify type of file to be uploaded)
Selecting any of these immediately triggers file upload to be shown (via js)
Choosing file inserts the filename in a hidden field and submits form to the server
The problem is this: I can click the button for step 1, and attach the file for step 3, and all continues as usual. But the system file open dialogue remains open due to step 2, and these accumulate if I'm running several scenarios on the same piece of functionality.
So, although this doesn't break anything, it is obviously a bit untidy potentially having several file upload dialogues persisting through the entire test suite.
Have you tried skipping step 1 and 2 and just doing step 3?
Just wondering if that would work (can't say I have tried this before)