0

Possible Duplicate:
javascript: call an embedded function from a GM script

i'm trying to write a script that will select all friends in the xbox.com message center in order to send a M2AF (message to all friends) without having to manually select all of them.

Compose.ToggleFriend('friend1')

when run in the url bar (prefixed by javascript: of course) this selects friend1 perfectly.

but when i try to implement this into a greasemonkey script it just won't work for some reason.

Community
  • 1
  • 1
Blake
  • 1

1 Answers1

4

Use this:

unsafeWindow.Compose.ToggleFriend('friend1');

unsafeWindow points in GM onto the global window-object.

Dr.Molle
  • 116,463
  • 16
  • 195
  • 201
  • I have `mylib.js` with `loadItems(elem, value)` defined. This file is loaded by the main document via ` – towi Jun 28 '12 at 15:53
  • Try **`unsafeWindow.loadItems( unsafeWindow.$("select[name='sel1']"), 3);`** – Dr.Molle Jun 28 '12 at 21:53
  • it says *unsafeWindow.$ is not a function*. I also tried `unsafeWindow.jQuery`, same thing. I thought I understood it, but... damn. I looked into `jquery.js` and of course, there is a `$` and `jQuery` function defined. hrmmm. – towi Jun 29 '12 at 09:22
  • nah, is a different problem anyway. I used an XPath Query instead of a jQuery-`$` and have the initial *me.selectedIndex is not defined* again. Must be a problem in that `LoadItems` function. thanks anyway. – towi Jun 29 '12 at 09:26