The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Get Current Username using LabTalk

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
alexisb2000 Posted - 01/05/2009 : 5:58:08 PM
Origin Ver. and SR (Select Help-->About Origin):
Operating System:

Is there a way to use LabTalk to get the current network username? For example, from MS-Access, I can use the following code to get the network username:
strusername = Environ("USERNAME")

Is there such a function in LabTalk? I need to get to a specific folder using this username and want to avoid hard-coding.

Thanks for your help.
Alexis
4   L A T E S T    R E P L I E S    (Newest First)
alexisb2000 Posted - 01/06/2009 : 2:33:40 PM
rlewis,
Thank you for taking the time to explain this to me. I am new to Origin programming and hoped there would be a way to do what you said. The steps you described worked perfectly and helped me to finalize my program.

Regards,
Alexis
rlewis Posted - 01/05/2009 : 10:07:10 PM
Under Origin 8.0 you can do something like the following ..
(a) Open the CodeBuilder workspace
(b) Create an ?????.C file (File New in the Codebuilder menu)
(c) Copy the origin C function below to the new origin C file created
(d) Add the file to the CB workspace (Right ckick System AddFiles)
(e) Compile the Origin C file (Tools Build in the CodeBuilder menu)


	string fnGetUserName()
	{
	     char szUserName[MAX_PATH];
    	     DWORD dwSize = MAX_PATH;
    	     if (GetUserName(szUserName, &dwSize)==true)
    	     {
    		string strTemp(szUserName);
    		strTemp.TrimLeft();
    		strTemp.TrimRight();
    		return (strTemp);
    	     }
    	     return ("");
	}


Under Origin 8.0 this should compile without error.
Once this is done you can then open the Origin script window
and use LT commands like

"%P=fnGetUserName()$" to retreive the username


alexisb2000 Posted - 01/05/2009 : 8:05:53 PM
Thanks for your response. I know this is a long shot but is there a way to embed one Origin C function in a LabTalk program? My program is running fine in LabTalk. I just need to get the network username programmatically.

Thanks,
Alexis
rlewis Posted - 01/05/2009 : 6:40:51 PM
To my knowledge, not with LabTalk ....
However there is an OriginC function "GetUserName" that will do the trick

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000