Trigger (auto execute) an application when opening file
- Author
- Message
-
Offline
- Posts: 23
- Joined: Sat Jun 14, 2014 3:56 am
And it's me again, sorry about this...
-edit- (solved original problem I posted in this post, but now I found out my applications hangs when I re-open a file that is already open).
So I need a way to put all the full paths of the currently open documents in a string.
The closest thing I found was this:
viewtopic.php?p=16297#p16297
-edit- (solved original problem I posted in this post, but now I found out my applications hangs when I re-open a file that is already open).
So I need a way to put all the full paths of the currently open documents in a string.
The closest thing I found was this:
viewtopic.php?p=16297#p16297
-
Offline
- Posts: 23
- Joined: Sat Jun 14, 2014 3:56 am
@Instructor
When you open a file it sends the filepath to the external (my) application.
If I send a string with all the currently opened filepaths in it with it, I can check if the filepath that is send to be processed already exists in the filelist string. (and then decide to continue, or not).
But the EOD_WINDOW_EXIST sounds way more effective and elegent.
Makes my chosen path seem strange indeed.
My thanks for the EOD_WINDOW_EXIST and GetFileList.js!!!
(I can always use that code!)
When you open a file it sends the filepath to the external (my) application.
If I send a string with all the currently opened filepaths in it with it, I can check if the filepath that is send to be processed already exists in the filelist string. (and then decide to continue, or not).
But the EOD_WINDOW_EXIST sounds way more effective and elegent.
Makes my chosen path seem strange indeed.
My thanks for the EOD_WINDOW_EXIST and GetFileList.js!!!
(I can always use that code!)
-
Offline
- Posts: 23
- Joined: Sat Jun 14, 2014 3:56 am
AkelPad.MemRead, example?
Sorry to kick this up.
Could someone give a AkelPad.MemRead example, based on the following filemapping path => "Global\\AkelPad"
An external script opens "Global\\AkelPad" and writes a path to that location. Now I need a .js script that can read it.
I think the green comment already gives a start, but I can't get it to work.
I basic example would help a lot.
FileMappingExample.js[/code]
Could someone give a AkelPad.MemRead example, based on the following filemapping path => "Global\\AkelPad"
An external script opens "Global\\AkelPad" and writes a path to that location. Now I need a .js script that can read it.
I think the green comment already gives a start, but I can't get it to work.
I basic example would help a lot.
FileMappingExample.js
Code: Select all
var hMainWnd=AkelPad.GetMainWnd();
var hMem;
var szName;
var szMem;
var dwMemSize=1000;
if (szName=AkelPad.MemAlloc(16))
{
AkelPad.MemCopy(szName, "Global\\AkelPad", 0 /*DT_ANSI*/);
//Create named memory object.
if (hMem=AkelPad.SendMessage(hMainWnd, 1305 /*AKD_MEMCREATE*/, szName, dwMemSize))
{
if (szMem=AkelPad.SendMessage(hMainWnd, 1306 /*AKD_MEMMAP*/, hMem, dwMemSize))
{
AkelPad.MemCopy(szMem, "Test", 0 /*DT_ANSI*/);
AkelPad.SendMessage(hMainWnd, 1307 /*AKD_MEMUNMAP*/, szMem, 0);
}
//Call external application. This application should call:
//hMem=OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, "Global\\AkelPad");
//szMem=MapViewOfFile(hMem, FILE_MAP_ALL_ACCESS, 0, 0, 1000);
//Read szMem.
//UnmapViewOfFile(szMem);
AkelPad.SendMessage(hMainWnd, 1308 /*AKD_MEMCLOSE*/, hMem, 0);
}
AkelPad.MemFree(szName);
}
-
Offline
- Site Admin
- Posts: 6311
- Joined: Thu Jul 06, 2006 7:20 am
Code: Select all
var hMainWnd=AkelPad.GetMainWnd();
var hMem;
var szName;
var szMem;
var pMem="";
var dwMemSize=1000;
if (szName=AkelPad.MemAlloc(16))
{
AkelPad.MemCopy(szName, "Global\\AkelPad", 0 /*DT_ANSI*/);
//Create named memory object.
if (hMem=AkelPad.SendMessage(hMainWnd, 1305 /*AKD_MEMCREATE*/, szName, dwMemSize))
{
if (szMem=AkelPad.SendMessage(hMainWnd, 1306 /*AKD_MEMMAP*/, hMem, dwMemSize))
{
AkelPad.MemCopy(szMem, "Test", 0 /*DT_ANSI*/);
AkelPad.SendMessage(hMainWnd, 1307 /*AKD_MEMUNMAP*/, szMem, 0);
}
//Call external application. This application should call:
//hMem=OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, "Global\\AkelPad");
//szMem=MapViewOfFile(hMem, FILE_MAP_ALL_ACCESS, 0, 0, 1000);
//Read szMem.
//UnmapViewOfFile(szMem);
if (szMem=AkelPad.SendMessage(hMainWnd, 1306 /*AKD_MEMMAP*/, hMem, dwMemSize))
{
pMem=AkelPad.MemRead(szMem, 0 /*DT_ANSI*/);
AkelPad.SendMessage(hMainWnd, 1307 /*AKD_MEMUNMAP*/, szMem, 0);
}
WScript.Echo(pMem);
AkelPad.SendMessage(hMainWnd, 1308 /*AKD_MEMCLOSE*/, hMem, 0);
}
AkelPad.MemFree(szName);
}
-
Offline
- Posts: 1
- Joined: Fri Aug 11, 2017 12:18 pm
- Contact: