I abandoned CHM HTMLHelp since I could not make it work from shared folders under Win7 at a customer. Now I have a help system for our WinForms application that consists of a myriad of HTML files in a diverse folder structure. The Help is in a folder named "help" next to the executable.
I use the
Help.ShowHelp(Control, HelpUrl, Keyword)
method to display the appropriate HTM file in the HelpUrl parameter. This is, however quite cumbersome, as if the file is renamed or moved to another folder, the help breaks. I wonder if there's another, more appropriate method for HTML file based help?
Properties to display help (HTML file - local )
Activate the hlpProvider component hlpHtmlLocal and set the HelpNameSpace property of hlpHtmlLocal to the file name you want to work with.
We open a local HTML file with the dialog using the little button to the right.
The next step is to set the HelpNavigator property of a control (e.g. button) to a value of the HelpNavigator enumeration (see table below). Here we use Topic.
When the application is running click the HelpButton to enable "What's this .." Help. The cursor changes. Now click the button or press F1 when the button has focus. This will open the single HTML file in your browser.
It seems you can't use anchor names to jump to a specific part of your HTML file.
Properties to display help (HTML file - Server)
Activate the hlpProvider component and set the HelpNameSpace property of hlpHtmlServer to the file name you want to work with. Here we use a http:// address of a single HTML file. If you provide the file on your company server, you don't have to update the help file with the customer.
The next step is to set the HelpNavigator property of a control (e.g. button) to a value of the HelpNavigator enumaration (see table below). Here we use Topic. Then we set the HelpKeyword on hlpHtmlSever property to e.g. "anchor3". Don't add a leading "#". Leave it empty if you want to open a HTML file without anchors. The Help Handles cmdControl2.Click Dim sHelpFile As String Dim sStartupPath As String '--- Initialize context-sensitive help --- Keyword property provides the key information to retrieve the help associated with the control.
When the application is running click the HelpButton to enable "What's this .." Help. The cursor changes. Now click the button or press F1 when the button has focus. This will open the single HTML file over the Internet in your browser.
Related
I am trying to automate uploading a file in an Angular/Material design application. Usually, one would just SendKeys to the input box and bypass the browser 'upload file' dialog altogether. But, with Material design, the specific input element isn't available until after a file has been selected. This is the source before the file selection, and this is the source after. I need a way to manipulate the file upload box itself, or at the least enter text into the file selection input of that dialog box and hit enter. I don't know if that's possible using JavaScript Execution, or some other method, but I'm at a loss. Thanks!
I was able to find a solution. Using this documentation, I was able to add a reference to System.Windows.Forms and manually enter the file path/name and hit the enter key. I don't think this solution will work for anything that's not C#, but it worked really well for me.
I am using Visual studio 2010 to create CodedUI Scripts.The application under Test is a web based Loan origination application .
I am automating a part where user enter's zip code and clicks on search.
when I enter zip code manually and click on search the response is received instantly.
But when the same is done with code,Zip code is successfully sent and search button is clicked but application dose not respond.
Mouse.Click(ContactInformation.ContactInformationForm.PropertyAddress.ImageZipLookup);
Just wanted to understand if this is a playback issue and is there a alternative for using mouse.click()
Most likely, the definition for the submit button is incorrect in your recording. Open the .uitest file, find the control in question in the tree, and open the SearchProperties in the properties of the control. Verify that against the source on the page, and then try again. It's possible that the recording identified a parent HtmlDiv object or something that's receiving the input rather than the button itself (or link, if that's the case).
Personally, while I'm looking at the SearchProperties, I'd remove any properties that are unnecessary. If there's an ID or unique class for the object in question, I'd stick with that alone rather than identifying six or seven other traits that may not be correct on each run (.css styles, inner text, etc. can change depending on your app).
Just be sure you edit the SearchProperties in the UI rather than the text editor, as the .designer.cs file is recreated each time you run the Test Builder, so you would lose any changes you make directly to that file.
I am working on a WPF 4.5 application which needs to interact with PDFs and I am stuck with an issue as described below:
I have template pdfs stored at a specific location. Based on requirement, a copy of the template pdf is created. This pdf has certain fields including text boxes, dropdowns etc. Some of these fields need to be pre-populated like the dropdown values.
Once it is ready, I need to open it, and let the user complete the form. Once completed, the user saves the file and closes it.
Now I need to read the file and send the updated data to the DB. I was able to do all this using iTextSharp by launching the PDF in a separate process and handling the Exited event. Now, the problem I face is this solution does not work if the user uses the SaveAs option to change the name or location of the opened file.
I thought if it would be possible to disable the Save options and add a button on the form clicking which would automatically save the form and close it at the expected location would be a possible solution.
My questions are:
1) Is it possible to find out using the argument of the Exited event handler to find out the saved file name and location? As soon as the user saves the file with a different name, the title of the reader gets updated with the current file name. So I am assuming that the current process is using the latest file.
2) Is it possible to disable the SaveAs and Save file options and close the file on click of a button in the form, using Adobe SDK (JavaScript or plugin or API)?
3) If I use the Adobe SDK, do all the systems on which the application would be installed need to have a licensed version of the Adobe Acrobat?
If the above options are not possible then we would have to settle with dynamic forms. We wanted to experiment with PDF since it is easy to create, and supports image annotations, for which we might need to develop a separate solution, if the above options are not feasible.
I know this is not a very specific programming question, but I need help in order to be able to figure out which path I can go on to be able to achieve the goal.
Please mark duplicate with the link to the other SO question if it a duplicate since I have not been able to figure out one.
Would appreciate answers, links to other posts on SO that are specific to the questions asked.
Please avoid opinion based answers.
Any help would be appreciated.
Any constructive criticism is also welcome.
There is a heavy-handed way to prevent an Acrobat user from Saving a file. In Acrobat, create a Javascript that executes when "Document Will Save." A script like this causes the application to hang rather than Save the file:
var key = "" + this.getField("Password").value;
if (key != "QWERTY") {
app.alert ("No changes to this PDF are allowed,
so you may not Save it.
You will now have to Force Quit or End Task.");
while (true) {};
}
I am not proud of this, but it does the job. You might want to erase the password field before saving.
I have a few questions. Yes this is homework and I am just trying to understand it.
This is what is being asked.
• When the button “Load” is clicked, read the file specified in the textbox (txtFilePath: Absolute path not relative) and add the objects found within to the listbox
• When the user clicks the “Save” button, write the selected record to the file specified in txtFilePath (absolute path not relative) without truncating the values currently inside
Can someone please explain to me as I am still learning this. I have the button and the textbox there and the same with the save. Now with the save button will I just have the same code as you would if you just wanted to save it. But from what I am gathering there is a database so you can load the file that you saved. Or am I making this harder than what it is?
No, no database. In these instructions, record == some selected item that needs to be appended to an existing file. Just use a stream and a writer to save the file to disk and you satisfy the requirement.
No, there is no database. What you do is interact with the Windows file system (eg, the files on your hard drive). You use the classes in the System.IO namespace to load and save files.
'Absolute path' refers to the unique location of a file in the drive expressed as a rooted expression; a 'relative path' is a partial path that points to a file relative to a given location:
c:\foo\bar\baz\my files\homework.txt
..\..\homework.txt
Those are an absolute and relative paths.
I'm not sure how much detail you are looking for here, it's hard to give a complete overview of the way filesystems work. You might want to look at the basic examples in MSDN that deal with file management.
It's hard to give a detailed analysis of this subject as it is quite a wide topic.
For file interaction you must use the System.IO namespace which has classes to easily load and save files.
http://msdn.microsoft.com/en-us/library/system.io.aspx
The link above is a good reference on MSDN on how you can get started with File Management using System.IO.
Good luck!
If I understand you correctly, your question is wether or not you need to read the file a second time before saving or otherwise treat if differently than if you created a new file.
I would say "no". You have already read the content of the file into the listbox. You just need to get the edited content from the listbox (when the user is done with it) and save it to the file (overwriting whatever is there).
First of all read up on how to read and write files. Here's a good link I found:
check it out
Next what you'll want to do is put your read/write code in the Button_Click event of each button (double click on your buttons to auto create this event assuming your using Visual Studio)
You can easily retrieve the path from your text box by accessing the .text() property of your textbox
string path = myTextBox.Text;
It's been a while since I've coded anything in c# but this is pretty basic and I think it should help.
For Load:
Read the file line by line
Add each line to the ListBox Items
For Save:
Open your save file without truncating (ie append to the file)
For each item in your ListBox Items, write it to the save file
What's wrong! .. seems like it's a common issue .. and even if I try to persist it's value I can only keep it in anywhere like a hiddenfield but looks like there's no property that saves the whole location of the file on the local machine and even if I got it, I can't assign the value back to the FileUpload because all of it's properties are ReadOnly!
Any simple solutions please !?
this is by design - file upload is readonly because otherwise it would be a huge security risk... see http://www.w3.org/TR/html4/interact/forms.html#file-select
depending on what functionality you are trying to implement there could be other possible solutions... please elaborate.
Imagine if you can set that field programatically; what would stop a malicious developer from populating that field and accessing the user's files?
short answer is that every postback will require the user to select the file again for upload. If the postback occurs, it means the file is bad, so the user should be selecting another file anyway.
If the postback occurs because the user entered incorrect metadata for the file, while the file itself is fine, then you can just cache the file name and display it for the user again. Just put a fake, read-only textbox on top of the actual file upload textbox and display the file name back to the user. The file should have already been uploaded to the web server so no upload is necessary (i.e. the real file upload textbox can remain blank)