Delphi: Set Browsers Homepage - delphi

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.

Related

In PHPstorm , is any way to avoid save all open documents instead current active document? [duplicate]

My traditional workflow must be a little different to the PHPStorm default. I often work on multiple files at the same time and want to be able to save just one file when I've finished with it, without saving the others that I've modified.
I've managed to turn off the auto-save feature. Now, when I edit files I get stars on the ones I've edited and they stay like that until I hit 'save'. So far so good.
But when press CTRL-S to save, expecting it to save the one file I'm looking at so I can go back to the ones with asterisks to polish them off too, it also saves ALL the other files too.
I hope there's some way to change this behaviour or set up something to allow me to save just one file at a time!
Yes, you can .. but that still does not change a lot (e.g if you change your settings, or run/re-run something -- all files will be saved automatically anyway). Eventually (after few weeks or month of adaptation) you will get used to this behaviour and quite likely will love it (yes, this means changing working habits a bit, which is quite hard to do (requires time) for some people/in some cases).
Anyway ... to enable "save single file" functionality:
Settings | Keymap
On that screen, in search box type "save"
The action you are after is called "Other | Save Document"
Assign whatever shortcut you want.
P.S.
This action will NOT ask for confirmation (same behaviour as standard save does).
P.P.S.
This action is available since PhpStorm v7 ONLY.

Code that can look at open browser tabs and store the urls?

I am attempting to write a program that looks at the current browser you have open, goes through each tab, and copies and pastes each page's url into a notepad file.
I have no issue with writing the file; my main concern is that I can't find anything in any language that can look at the browser, sift through the tabs, and scrape the url.
Does anyone know if this would be possible, any code that might be able to help (in any language), or if something like this exists? I would appreciate anyone pointing me in the right direction.
The software I was looking for did not exist, so I created it. It's a chrome extension called Raincheck

Explanation of (undocumented?) XUL dialog attribute buttoniconaccept (and similar)

I am pulling this attribute directly from Mozilla Firefox's about.xul file which shows the About dialog box for an add-on. It is a relatively simple XUL dialog with no inputs, locale data pulled from DTD entities, string bundle properties and JavaScript.
<!-- omni.ja!/chrome/toolkit/content/mozapps/extensions/about.xul -->
<!-- chrome://mozapps/content/extensions/about.xul -->
<dialog id="genericAbout"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="init();"
buttons="accept"
buttoniconaccept="close"
onaccept="close();">
MDN: Dialogs and Prompts and MDN: dialog both mention something about attributes that are formed by concatenating (pseudo-regexp):
"button" + "(label|accesskey|oncommand)" + "(accept|cancel|disclosure|help|extra[12])"
For example: buttonlabelaccept.
However, I could not find any documentation about the use of icon. The word icon does not even show up on either of the above-mentioned pages! What does it do? What is the correct way to use it?
I'm trying to make my add-on about page more modular, without loading internal files from omni.ja(r), which pulls in a LOT of unnecessary code with it. I am developing a very streamlined version, that will style itself appropriately depending on calling context.
I want it to look like Firefox's official About < addon.name > dialog if called from about:addons context-menu, or from my add-on's status-bar context-menu. I want a slightly different appearance if viewed from within the Options dialog as an iframe inside a XUL. I already have that structure set up. Just tweaking the little quirks.
This is not critical design or feature wise, and indeed the entire API will go away in a few months, but it just bothers me to not really understand this, so I want to figure it out before I let it go an move on to more important things. But I will if I absolutely can't find an answer. But it's one of those stupid little things that will just bother me a disproportionate amount. =D
If you can point me to documentation I may have missed, or even specific Mozilla source code, and a few examples, or a more complete explanation and typical use-cases, that would be great.
If you check the "blame" for about.xul, you'll see that the line was added to fix bug 422763. Judging from the screenshot in the bug, GNOME (Linux) has (had?) a convention of putting icons on dialog buttons, and this attribute allows overriding the default icon (inferred from the button type).
If you search for buttonicon, you'll find the code that handles this attribute in toolkit/content/widgets/dialog.xml.

Trying to open an application with parameter via an Application Protocol Handler

I am currently trying to figure out an issue with an Application Protocol Handler I've created. Following the directions listed on MSDN (http://msdn.microsoft.com/en-us/library/aa767914%28v=vs.85%29.aspx), I was able to register my application, PDF Annotator, to open via a URL. The issue I am experiencing is when I try to pass a parameter along with the call. The application will open, but the file parameter that gets passed is not opening within the application.
My registry key is verbatim as dictated by MSDN. My HTML code is as follows:
PDFAnnotator:C:\path\to\file\file.pdf
The way I understood the protocol handler is it takes the URL and tries to launch it via the command line. That being said, I am able to open my pdf file in PDFAnnotator with following command in the prompt:
PDFAnnotator.exe C:\path\to\file\file.pdf
I've tried formatting the file path in the HTML differently thinking that would be the issue too. Has anyone else come across this issue or something similar?
Obligatory Update for future generations (http://xkcd.com/979/):
The reason I was doing this is because half of the PDFs my application handled would be editable while the other half were read-only. I was trying to keep the read-only ones in browser with the Acrobat plugin (I'm targeting chrome only) while the protocol would allow me to set the links of the editable ones to open with Annotator. I tried, on whim, to reverse this (setting the default to Annotator and creating a protocol for Acrobat). I did this, first by trying Acrobat's URI Scheme (acrobat://), which didn't work outside of opening Acrobat. Then, I tried creating a protocol for Acrobat. When that fired off, it gave me an error stating the path was wrong for the file name, path name, or volume. So, progress? I'm giving up on this for now as other priorities have come up, but hopefully this helps somebody down the road.

How Can I Automatically Execute A Link In Internet Explorer

I am trying to create an application to print documents over the web. I have created my document, and made a web page with a meta refresh tag, along the lines of this:
<meta http-equiv="refresh" content="3;http://example.com/download.epl2" />
I specify that the document has a content-type of application/x-epl2, and I have associated .epl2 files on my computer with a program that silently sends them to the printer.
I have put the website into my trusted sites zone.
Currently Internet Explorer pops up the "Open, Save, Cancel" dialog box with no option to automatically open the file.
Is there a setting in IE6/7/8 that I can use to have IE just open the file without prompting?
EDIT
The actual content of the file will differ based on the job, but essentially it is text that follows the Eltron Programming Language.
EDIT
I have accomplished this in both Chrome and Firefox by choosing "Automatically Open Files Of This Type From Now On"
EDIT
The machines this program will be used on will effectively be kiosks that are limited to only accessing my website from their web browsers, so I'm not worried about rogue websites sending documents to my printers.
EDIT
I am using PHP to generate the documents and HTML on the server side, though I expect the solution to be language agnostic.
I would expect that not to be possible, because then you could stumble onto a site that automatically loads and prints a 5000 page document or something, which would not be good.
If you always had a secret desire to develop a custom URL protocol (I know I do), this might be a good excuse to do it. ;-)
http://msdn.microsoft.com/en-us/library/aa767914%28VS.85%29.aspx
There are 1-2 prompts when opening such a link for the first time in IE, but you can choose to automatically open them after that.
I would use javascript to make this happen.
Javascript Window Open
EDIT
Since you have control of the windows box you could use an automate script process to interact with the print window.
autoit3: ControlClick
Write a small utility program that does nothing but send the file passed to it on the command-line to the default system printer.
Then, edit the registry under HKEY_CLASSES_ROOT to associate this program with the .epl2 filetype.
I don't have time to investigate it for You, but there were lots of exploits that could be helpful. Using ie6 without certain fixes seems helpful.
Also there should be an option called "Automatic prompting for file downloads". I use Linux nowadays so I can't chceck if it helps. I found it in some docs.
I'm on a Mac at the moment, but if this is possible in IE I would imagine this page holds the answer to it (or at least hints at it) http://support.microsoft.com/kb/883255
I believe what you're looking for is a setting in Windows, not IE:
Microsoft Support: Not Prompted to Specify Download Folder for File
Try using an older version of IE. Security was looser in the older versions and since it's a non-issue, this could be the quickest solution.

Resources