Get Environment variables

Share your advanced PureBasic knowledge/code with the community.
User avatar
doctorized
Addict
Addict
Posts: 882
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Get Environment variables

Post by doctorized »

This is an other code I 've writen.
Get all the environment variables from every OS (Tested under Windows but it should work fine under other operating Systems. Tell if not.)

Code: Select all

; Author: Wicker Man
; Date: May 22 2009
; OS: All
; Demo: No
; More codes at: www.geocities.com/kc2000labs/pb/pb.htm

If OpenWindow(0, 0, 0, 640, 520, "Environment Variables", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
	If CreateGadgetList(WindowID(0))
		ListIconGadget(0,10,10,621,500,"Variable",200,#PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
	EndIf
	
	AddGadgetColumn(0,1,"Data",400)
	If ExamineEnvironmentVariables()
		While NextEnvironmentVariable()
			AddGadgetItem(0,-1,EnvironmentVariableName()+Chr(10)+EnvironmentVariableValue())
		Wend
	EndIf

  Repeat
    EventID = WaitWindowEvent()

    If EventID = #PB_Event_CloseWindow
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

An amaaaaaaaaazing awesome code you have there, mate! :shock:
Good for people who are to shy to press F1 and look up ExamineEnvironmentVariables(). There's your code already implemented as example code. :wink:
PB 4.30

Code: Select all

onErrorGoto(?Fred)
User avatar
doctorized
Addict
Addict
Posts: 882
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Post by doctorized »

AND51 wrote:An amaaaaaaaaazing awesome code you have there, mate! :shock:
Good for people who are to shy to press F1 and look up ExamineEnvironmentVariables(). There's your code already implemented as example code. :wink:

There is people that do not know the contained commands. It is a way to inform them. No need to be spiteful with me. I just try to help.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

doctorized wrote:There is people that do not know the contained commands.
Are you serious? Will you post an code example from the help here every time someone is to lazy to RTFM?
doctorized wrote:It is a way to inform them. No need to be spiteful with me. I just try to help.
Well, I can understand him. You basically just copied the example from the help so what's the point?
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Fluid Byte wrote:You basically just copied the example from the help so what's the point?
No... The example in the help outputs the variables and their value in a console...
He changed the output to a GUI. :wink:
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Seymour Clufley
Addict
Addict
Posts: 1265
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Post by Seymour Clufley »

AND51 and Fluid Byte, aren't you being a bit unkind?
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Seymour Clufley wrote:AND51 and Fluid Byte, aren't you being a bit unkind?
No but German ...

Seriously, what is the point of posting identical examples from the help just because some idiots are to lazy to read the ****ing manual? This is insane!
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Fred
Administrator
Administrator
Posts: 18249
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Please calm down, there is no need to harsh for such things.
Post Reply