How to Get a Popup Window With Menu? - outlook

I am opening a popup window from CRM 2011 for Outlook. The problem is I need the user to be able to print. If you do it from IE the browser print menu is available but from Outlook it is not. You just get a plain window. Hitting the Alt key does nothing when a popup opens from Outlook. None of the openStdWin() options seem to actually work from Outlook.
FYI I'm trying to print Dashboards (why MS left that out is beyond me). The solution we came up with is the following code hooked to a ribbon button. Then the user uses the built-in browser print functionality and the dashboard can be printed. But not from Outlook it seems. Any suggestions? (before anybody suggests it our client thinks print-screen is unacceptable)
function printCurrentDashboard() {
if (Xrm.Page.context.isOutlookClient()) {
var pTarget = document.getElementById('dashboardFrame').src;
openStdWin(window.location.protocol + '//' + window.location.host + pTarget, 'test', 800, 600, 'menubar=yes,toolbar=yes,channelmode=no,directories=yes,fullscreen=no,location=yes,status=yes,titlebar=yes');
}
else {
var pTarget = parent.document.getElementById('dashboardFrame').src;
window.open(window.location.protocol + '//' + window.location.host + pTarget);
}
}

Try using openStdWinWithFeatures vs openStdWin.

Related

window.onbeforeunload not working on Firefox 46 in a popup window, all other browsers work

Having an issue with Firefox 46, on all the other browsers it work fine.
Upon exit from the page I ask the following question. Firefox ignores it completely.
Help please!
window.onbeforeunload = ThisCheckExittingPage;
var ThisCheckExitWindow = 1;
// Checks before exitting
// ThisCheckExitWindow = 1;
// Does NOT check before exitting
// ThisCheckExitWindow = 0;
function ThisCheckExittingPage() {
if (ThisCheckExitWindow == 1)
{
return "You are about to exit this page.";
}
}
This looks like by design, as WindowEventHandlers.onbeforeunload - Web APIs | MDN has this note:
To combat unwanted pop-ups, browsers may not display prompts created
in beforeunload event handlers unless the page has been interacted
with. Firefox has implemented this policy since Firefox 44 (Bugzilla).
As the relevant patch shows, the mUserHasInteracted flag variable is set after a mouse or keyboard event happens in the window.

VBScript not working in IE 11

This is the shocking news from Microsoft, Internet Explorer 11 no longer supports the VBScript. I've tried possible ways to run the vbscript in the IE 11 but not effective. Please provide the solution/suggestions.
<meta http-equiv="X-UA-Compatible" content="IE=10">
I've tired this and below js (will runs the vbscript in IE 11)
function callVBS(scriptName) {
//-Variables--------------------------------------------------------
var wsh, pathName;
if ("ActiveXObject" in window) {
wsh = new ActiveXObject("WScript.Shell");
if (typeof(wsh) == 'object') {
pathName = location.pathname.substr(0, location.pathname.lastIndexOf("/"))+"/";
pathName = pathName.slice(1);
wsh.run("wscript.exe \"" + pathName + scriptName + ".vbs\"", 1, true);
wsh = null;
}
}
else {
alert("Your Browser doesn't support ActiveXObject");
}
}
Ie isn't available anymore, but i will give the answer.
Scripts and ActiveX Objects are disabled in ie11 bt default.
There is something called Edge Mode, that should be off.
Find Tools, click Internet Options.
Select Security, click Custom level.
Under the "Active Scripting", there should be a radio, enable it.
And finally click OK.

How to click UI element using JXA

Please tell me how do I click in point coordinates in application window?
I trying to UI automate my application on OSX 10.10 using JXA technology.
In documentation I found that it's possible using click at event. By I'am beginner of JXA and cant find how make a call.
Code snippet which I tried in Script Editor:
var app = Application('my_application_path')
app.window.click.at('{100,100}')
Thank you for help
You can interact with an application's user interface using the System Events application. Here is a script that clicks at certain coordinates in Safari:
// Activate Safari, so you will be able to click like a user
Application("Safari").activate()
// Access the Safari process of System Events
var SystemEvents = Application("System Events")
var Safari = SystemEvents.processes["Safari"]
// Call the click command, sending an array of coordinates [x, y]
Safari.click({ at: [300, 100] })
If you want to click a specific button (or other element of the user interface), it is more appropriate to click that specific element. For example:
// Click the third button of Safari's first window to minimize it
Safari.windows[0].buttons[2].click()
To learn what user interface elements can be interacted with and how, check out the Processes Suite in System Events' scripting dictionary. To open the dictionary, in Script Editor's menu bar, choose Window > Library, then select System Events in the Library window.
See https://github.com/dtinth/JXA-Cookbook/wiki/System-Events#clicking-menu-items
For example:
var fileMenu = proc.menuBars[0].menuBarItems.byName('File');
Below is an example of a portion of a script I wrote that automates creating mailboxes (aka folders) in Mail. I ended up using the UI file menus and click because using make() in the Mail DOM had issues for me. Hope it helps someone.
(() => {}
//this is part of a script that automates creating mailboxes (ie folders) in Apple Mail
//I used the file menu UI because when I tried the Mail library and make() method
//there was strange behavior when trying to interact with the new mailbox.
//However, when creating the new mailboxes thru the file menu, all seems to work fine
const Mail = Application('Mail');
const strId = Mail.accounts.byName('Exchange').id();
const exchange = Mail.accounts.byId(strId);
const activeClientFolder = exchange.mailboxes.byName('ActiveClient');
const SysEvents = Application('System Events');
const mail = SysEvents.processes.byName('Mail');
//next two lines insure Mail will be open and in front
mail.windows[0].actions.byName('AXRaise').perform();
mail.frontmost = true;
const mailboxMenu = mail.menuBars[0].menus.byName('Mailbox');
//below shows EXAMPLES of using .click(), keystroke(), and keyCode()
let newFolder = function (parentFolder, newFolderName, addTrailingDelay = true) {
//next line will select the parent mailbox (aka folder) where the new mailbox will be inserted
Mail.messageViewers[0].selectedMailboxes = parentFolder;
mailboxMenu.click();
delay(.2);
mailboxMenu.menuItems.byName('New Mailbox…').click();
delay(.2);
SysEvents.keystroke(newFolderName);
SysEvents.keyCode(36);
//delay is needed when creating multiple mailboxes with a loop
if (addTrailingDelay == true){
delay(1);
}
}
//now the payoff
const count = newActiveClients.length;
for(let i=0;i<count;i++){
/* Client Root Mailbox */
newFolder(activeClientFolder, newActiveClients[i], true);
/* Client Email Folders */
newFolder(activeClientFolder.mailboxes.byName(newActiveClients[i]), 'Client', true);
newFolder(activeClientFolder.mailboxes.byName(newActiveClients[i]).mailboxes.byName('Client'), 'Client_FYI_Sent');
newFolder(activeClientFolder.mailboxes.byName(newActiveClients[i]).mailboxes.byName('Client'), 'Client_FYI_Inbox');
newFolder(activeClientFolder.mailboxes.byName(newActiveClients[i]).mailboxes.byName('Client'), 'Client_FYI_Client_To');
newFolder(activeClientFolder.mailboxes.byName(newActiveClients[i]).mailboxes.byName('Client'), 'Client_From', false);
}
})()

Javascript "Click" event on disabled input type:file in Firefox

I want to make input type="file" becomes available and clicked only when I click on some element, which is also activated it (for example, stylized span).
For this I have the Javascript parameters on span:
onclick="document.getElementById('upload_hidden').Disabled = false;
document.getElementById('upload_hidden').Click();"
But the trouble is that in Firefox only first click removes the input attribute disabled and second - opens the file selection window. In Chrome - all OK: input become enabled and clicked by first span click.
Why, first click in Firefox does not work ? :(
http://jsfiddle.net/ey47G/
P.S. In firefox v21 - all OK. Firefox v25 and v26 - have this trouble.
I could imagine that the script is already ahead when it tries to click the button - but the button is still disabled
var f = document.getElementById('f');
var s = document.getElementById('s');
s.onclick = function () {
f.removeAttribute('disabled');
setTimeout(function(){ f.click(); }, 100); // run the explorer after 100 ms
}
This does work.
http://plnkr.co/edit/9syOfSJHaJ4b3bhRufpv?p=preview

Close only a specific tab with firefox extension

i'm developing a firefox extension and i want to be able to close a specific tab. For example if there are many open tabs in the browser o want to close only the tab with a specific url.
I know that i can use gBrowser.removeTab(tab) but i don't know how to get tab object.
On the other hand i can get the browser that corresponds to the url but the param of the removeTab() function must be a "tab object". How cat i get the tab object.
Any ideas?
tabbrowser.getBrowserForTab() method is actually the easiest way of associating browsers with tabs. So you would do something like this:
var tabs = gBrowser.tabs;
for (var i = tabs.length - 1; i >= 0; i--)
{
var tab = tabs[i];
var browser = gBrowser.getBrowserForTab(tab);
if (browser.currentURI && browser.currentURI.spec == "...")
gBrowser.removeTab(tab);
}
I think you can use this method: gBrowser.removeCurrentTab(); this example closes the currently selected tab.
For more code, please refers this link: https://developer.mozilla.org/en/Code_snippets/Tabbed_browser

Resources