Here are a few basic UDFs that allow you to create, find, read and delete shared "Atoms" in memory between applications... see:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms649053(v=vs.85).aspxThe atoms will persist after the application has closed (unless deliberately deleted), but will be gone on a reboot.
For example,
Try making 2 scripts and create an Atom in one with something like:
GlobalAddAtom("testing123")
and run it.
then in the other, use:
Atom = GlobalFindAtom("testing123")
Message("Find",Atom)
Message("GetName",GlobalGetAtomName(Atom))
.... and it should find and display the text associated with the atom you made in the first script!
It's a good idea to read the notes in the UDFs and online about Atoms and about subsequent adds and deletes.
;Each call to GlobalAddAtom should have a corresponding call to GlobalDeleteAtom.
;Do not call GlobalDeleteAtom more times than you call GlobalAddAtom, or you may delete the atom while other clients are using it.
;Applications using Dynamic Data Exchange (DDE) should follow the rules on global atom management to prevent leaks and premature deletion.
#DefineFunction GlobalAddAtom(Name)
Kernel32=DllLoad(StrCat(DirWindows(1),"Kernel32.DLL"))
Ret = DllCall(Kernel32,long:"GlobalAddAtomA",lpstr:Name)
DllFree(Kernel32)
Return Ret
#EndFunction
#DefineFunction GlobalFindAtom(Name)
Kernel32=DllLoad(StrCat(DirWindows(1),"Kernel32.DLL"))
Ret = DllCall(Kernel32,long:"GlobalFindAtomA",lpstr:Name)
DllFree(Kernel32)
Return Ret
#EndFunction
#DefineFunction GlobalDeleteAtom(Atom)
Kernel32=DllLoad(StrCat(DirWindows(1),"Kernel32.DLL"))
Ret = DllCall(Kernel32,long:"GlobalDeleteAtom",long:Atom);(Always returns 0)
;To determine whether the function has failed, call SetLastError with ERROR_SUCCESS before calling GlobalDeleteAtom, then call GetLastError.
;If the last error code is still ERROR_SUCCESS, GlobalDeleteAtom has succeeded.
DllFree(Kernel32)
Return Ret ; Always 0
#EndFunction
#DefineFunction GlobalGetAtomName(Atom)
Kernel32=DllLoad(StrCat(DirWindows(1),"Kernel32.DLL"))
Name = BinaryAlloc(256)
BinaryEODSet(Name,0)
Len = DllCall(Kernel32,long:"GlobalGetAtomNameA",long:Atom,lpbinary:Name,long:256)
BinaryEODSet(Name,Len+1)
DllFree(Kernel32)
Ret = BinaryPeekStr(Name,0,Len)
BinaryFree(Name)
Return Ret
#EndFunction