|
|||
|
1.) I have a keyListerner in flash. I noticed it doesn't work when the window is hidden or when the window isn't focused on. Is there a way to have the keyListener work even if the window is hidden or not focused on? I have a tray icon, should it run the script?
2.) I noticed that shadows (under menus, and the right-click menu on the desktop, etc.) freeze when a window is hidden, meaning that they stay there after the menu is gone. Why is this? Thank you in advance. |
|
|||
|
1. Yes, the window can only receive keyboard input when it has focus, i.e. the keystrokes are for the window has keystroke focus. If your window is hidden, you can only define some hot key combinations for it.
2. Can you post a screen shot. Thanks. |
|
|||
|
1.) How can I do that?
2.) Screenshot attached. New questions: 3.) Can you make the balloon tip appear in other places instead of on the tray icon? 4.) How to keep the getWindowsName() method constantly updated. 5.) How to use the code here(to get battery charge) and here (to uninstall a device) with the ScriptHost? I tried to play around with it, but no luck... 6.) How to rename the extention of an ico file? Not convert it, but just change the end ".ico" part to jpeg |
|
|||
|
1.
Code:
dllimport "user32.dll" stdcall Boolean RegisterHotKey(pointer, int, unsigned int, unsigned int);
dllimport "user32.dll" stdcall Boolean UnregisterHotKey(pointer, int);
dllimport "kernel32.dll" stdcall int GlobalAddAtomA(String);
var id = GlobalAddAtomA("My hot key identifier");
// registers hot key 'CTRL+ALT+Z"
RegisterHotKey(getMainWnd().handle, id, /*MOD_CONTROL | MOD_ALT*/2 | 1, /*VK_Z*/0x5A);
getMainWnd().onClose = function () {
UnregisterHotKey(this.handle, id);
}
// handles the hot key message
getMainWnd().onMessage = function (msg, wparam, lparam) {
if (msg == /*WM_HOTKEY*/0x312 && wparam == id) {
Dialogs.msgBox("The hot key combination has been pressed!");
}
}
3. yes, but too complicated to do that in ffish script 4. calling it constantly. 5. 1) PowerStatus: that's a .NET 2 property, which cannot be called in ffish script. You will have to use Win32 API instead Code:
struct {
unsigned char ACLineStatus;
unsigned char BatteryFlag;
unsigned char BatteryLifePercent;
unsigned char Reserved1;
unsigned long BatteryLifeTime;
unsigned long BatteryFullLifeTime;
} SYSTEM_POWER_STATUS;
dllimport "kernel32.dll" stdcall Boolean GetSystemPowerStatus(SYSTEM_POWER_STATUS*);
var output = new Object;
output.value = new Struct(SYSTEM_POWER_STATUS);
GetSystemPowerStatus(output);
trace(output.value.BatteryLifePercent);
6. Code:
// rename a file
function changeExt(fileName, newExt) {
var f = new File(fileName);
var pp = f.parentPath;
var name = f.name;
var index = name.lastIndexOf(".");
if (index >= 0) {
var newname = name.substring(0, index + 1);
newname += newExt;
f.move(pp + "\\" + newname);
} else {
name += "." + newExt;
f.move(pp + "\\" + name);
}
}
changeExt("c:\\url.txt", "jpg");
|
|
|||
|
In flash
Code:
import flash.external.*;
function onHotKey() {
text = flash;
myfakewindow._alpha = 0;
}
ExternalInterface.addCallback("flash_onHotKey", null, onHotKey);
Code:
Application.registerASMethods("flash_onHotKey");
dllimport "user32.dll" stdcall Boolean RegisterHotKey(pointer, int, unsigned int, unsigned int);
dllimport "user32.dll" stdcall Boolean UnregisterHotKey(pointer, int);
dllimport "kernel32.dll" stdcall int GlobalAddAtomA(String);
var id = GlobalAddAtomA("My hot key identifier");
// registers hot key 'CTRL+ALT+Z"
RegisterHotKey(getMainWnd().handle, id, /*MOD_CONTROL | MOD_ALT*/2 | 1, /*VK_Z*/0x5A);
getMainWnd().onClose = function () {
UnregisterHotKey(this.handle, id);
}
// handles the hot key message
getMainWnd().onMessage = function (msg, wparam, lparam) {
if (msg == /*WM_HOTKEY*/0x312 && wparam == id) {
flash_onHotKey();
}
}
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|