Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Environment variables  (Read 1889 times)

0 Members and 1 Guest are viewing this topic.

Matt Groening

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 39
    • View Profile
Environment variables
« on: October 10, 2008, 02:04:57 PM »

Hello.
I want create folders and files in Application Data.
I want use environment variables (%APPDATA%) for it.
How I can make it?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Environment variables
« Reply #1 on: October 15, 2008, 11:08:18 AM »

There's no native support. You could get an environment variable by calling Windows API function using the "extern" function in WME script.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

SoundGuy

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 196
    • View Profile
Re: Environment variables
« Reply #2 on: June 10, 2009, 03:05:55 PM »

Mnemonic - can you give an example for how to write the proper extern call to get an environment variable ?

Logged

HelLRaiseR

  • I don't want to make a Monkey Island clone :(
  • Wiki editor
  • Frequent poster
  • ****
  • Karma: 4
  • Offline Offline
  • Posts: 270
    • View Profile
    • Adventure Box Studios
Re: Environment variables
« Reply #3 on: June 15, 2009, 05:43:38 PM »


There is an exampleof the use. This case is for get a cnvironment variable.

Code: [Select]
// declaration
external "kernel32.dll" long GetEnvironmentVariable(string lpName , string lpBuffer , long nSize) ;

// use

var variable_name = "MY_VAR";
var variable_value = new String(255); // This var is passed by reference, the value of the environment variable is stored here
var value_lenght = 255;

GetEnvironmentVariable (variable_name, variable_value, value_length);
Logged
Regards,

    Fernando
 

Page created in 0.075 seconds with 23 queries.