Get Username from Windows system login

53 views
Skip to first unread message

Jha

unread,
May 23, 2008, 4:13:58 AM5/23/08
to TiddlyWiki
I am not good with coding which was the main reason for choosing
TiddlyWiki, if anyone can help, it would be great.

I use Tiddlywiki in a group as a CMS and would like to know if there
is any plugin which can help me find out the person who last updated
the tiddlywiki. I want the UserName to be taken automatially as
Windows Login name.

Say I login to my computer using the username "Jha" and open
tiddlywiki to edit it. This code/plugin can pull the system userName
"Jha" and set it as tiddlywiki's username. After saving TiddlyWiki,
the tiddler i edited should show "Jha" as the person who edited it.

FND

unread,
May 23, 2008, 4:29:29 AM5/23/08
to Tiddl...@googlegroups.com
> I want the UserName to be taken automatially as Windows Login name.

I highly doubt JavaScript has access to that kind of information - in
fact, I hope it does not; imagine any random website could retrieve your
account name or other environment variables...

However, it might be possible with ActiveX (Internet Explorer only).
The code might look something like the following (put this into a
tiddler tagged with "systemConfig"):
---------------
var ws = new ActiveXObject("wscript.shell");
config.options.txtUserName = ws.ExpandEnvironmentStrings("%username%");
---------------
(entirely untested, as I'm on Linux)

HTH.


-- F.

Jha

unread,
May 23, 2008, 4:58:13 AM5/23/08
to TiddlyWiki
It might sound silly, but what do i name the tiddler which contains
this code?

FND

unread,
May 23, 2008, 5:00:36 AM5/23/08
to Tiddl...@googlegroups.com
> It might sound silly, but what do i name the tiddler which contains
> this code?

Anything you like (e.g. [[Evil Witchery]]).
The important part is the "systemConfig" tag, which causes the tiddler
contents to be interpreted/processed/evaluated as JavaScript code.


-- F.

Jha

unread,
May 23, 2008, 5:45:33 AM5/23/08
to TiddlyWiki
Thanks a lot!! that works like a gem Internet Explorer.
If i got it right, this ActiveX works only with Windows, and if i am
running Firefox in it, it can also do the same job, right?

FND

unread,
May 23, 2008, 5:48:41 AM5/23/08
to Tiddl...@googlegroups.com
> If i got it right, this ActiveX works only with Windows, and if i am
> running Firefox in it, it can also do the same job, right?

This works only when using Windows *and* Internet Explorer.
Other browsers do not support ActiveX by default - however, there seems
to be an ActiveX plugin for Firefox:
http://support.mozilla.com/en-US/kb/ActiveX
http://kb.mozillazine.org/ActiveX


-- F.

Jha

unread,
May 23, 2008, 6:07:41 AM5/23/08
to TiddlyWiki
Thanks for helping me out with the situation. Hope i get similarly
great solution for my other issue (Sync time). Thanks a lot once
again.

Jha

unread,
May 23, 2008, 11:52:32 PM5/23/08
to TiddlyWiki
I came accross a problem when I had to use my tiddlyWiki on another
system which has IE6 (mine has IE7). When i tried opening the
tiddlyWiki it gave me an error "Problem were encountered loading
plugins. See PluginManager for details". I checked the plugin manager
and found that the plugin which holds the ActiveX code to retrieve the
UserName has an error. The error says "Error:Automation server can't
create object". Couldn't figure out the reason for this error.

On May 23, 2:00 pm, FND <F...@gmx.net> wrote:

Jha

unread,
May 24, 2008, 12:15:55 AM5/24/08
to TiddlyWiki
I have fixed the issue with IE6 by enabling an option in Internet
Option "Security" tab - "Initialize and script ActiveX controls not
marked as safe".
> > -- F.- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages