General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Utils plugin not providing OS 'platform'
Posted by: JamesD
Date: July 18, 2009 08:04PM

This is for Mark307.

I am not getting a value when I check for the OS platform using utils.dll. I have the dll file in the kplugins folder and there is a check mark by it in preferences. That is all that I could find about installing. Here is my code:
_Snippet_Opsys{
$platform = pluginmsgex(utils, "GetOSVer", "Platform");
alert("Ops platform is  ".$platform, "Platform DEBUG", INFO);
$os = pluginmsgex(utils, "GetOSVer", "Platform") == 2 ? "NT" : "9X";
alert("Ops system is ".$os, "Choice of cmd or Command  DEBUG", INFO);
}
I get no value in the first alert which mean that I see "9X" in the second alert. I am running on XP-SP3.

Have I misunderstood an instruction?

Options: ReplyQuote
Re: Utils plugin not providing OS 'platform'
Posted by: disrupted(unlogged)
Date: July 18, 2009 10:36PM

i tried the getosver command a while back to open hosts file in notepad accordingly directly from macro.
in xp and above its c:\windows\systems32\drivers\etc\hosts in 9x it's just c:\windows\hosts.. i couldn't get it to work and eventually just made autoit get os and open hosts. i hope mark reads this and tells us how because it can be really handy to find os from macro and not externally

Options: ReplyQuote
Re: Utils plugin not providing OS 'platform'
Posted by: desga2
Date: July 18, 2009 11:50PM

You can read Windows OS version from registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

More info.

K-Meleon in Spanish

Options: ReplyQuote
Re: Utils plugin not providing OS 'platform'
Posted by: disrupted
Date: July 19, 2009 12:05AM

yes, i tried it and it works.. probably the origianl way utils is supposed to get version? i don't know..i thought it might have been -norestrict command would fix it but it didn;t

this works:
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

ostest{
$regger=("HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\ProductName");
$whatos = pluginmsgex(utils, "RegRead", $regger, STRING);
alert($whatos,"os version retrieve test" ,INFO);
}

fucktest202_BuildMenu{
setmenu("&Tools",macro,"OS VERSION TESTE",ostest);
}

$OnInit=$OnInit."fucktest202_BuildMenu;";
# -----------------------------------------------------------------
$macroModules=$macroModules."fucktest;";


this gets the os branding.. CurrentVersion instead of ProductName wll get nt version which can be handled easier in macro
nt5=2000
nt5.1=xpee
nt6.xx=vista etc

the tricky part is that for 9x systems the ino is not located in that key but under windows instead of windows nt.. but since all 9x are more or less the same..the macro can be made to execute 9x commands if the os value returned is null. the tricky part is..i don't know if paranoid vista will allow the macro to read registry especially if non-admins or roaming profile..might cause stupid errors if macro gets null value..assumes it's 9x and executes 9x command.. maybe for confirmation add additional readini if returns null.. i know in 98 the version is stored in one of those dos inis

Options: ReplyQuote
Re: Utils plugin not providing OS 'platform'
Posted by: JamesD
Date: July 19, 2009 01:19AM

@ disrupted

Thanks for the macro. I get "Microsoft Windows XP" when I run it.

I guess a null value will be win9x and not null will be any later. I am trying to automate this code.
exec("cmd /c ERASE \"".$_Secur_Paste_Path."\"");
## For user of win9x operating systems, cmd should be replaced with command in the above line
Easy enough to have two versions and choose based on the return from
 pluginmsgex(utils, "RegRead", $regger, STRING);


Options: ReplyQuote
Re: Utils plugin not providing OS 'platform'
Posted by: JujuLand
Date: July 19, 2009 08:50AM

Found in utils kplugins v0.7 by mark307
# Get OS Version
#   Gets os version by GetVersionEx Win32API
#   Field is "Major", "Minor", "Build", "Platform", "CSD", or "".
#   These are associated with dwMajorVersion, dwMinorVersion,
#   dwBuildNumber, dwPlatformId, szCSDVersion, or all.

$value = pluginmsgex(utils, "GetOSVer", $field);

# useful idiom: 9X or NT
$os = pluginmsgex(utils, "GetOSVer", "Platform") == 2 ? "NT" : "9X";

I must add that to fix the real OS, it must be used another test (for Linux users), as in this sample:
cfg_ProfileDir{
macroinfo=_("Open the profile directory");
$_windows=readfile("Z:\\etc\\group");
$_windows=""?$explorer="explorer \"":$explorer=getpref(STRING,"general.explorer")." ";
$_folder=getfolder(ProfileFolder);
$_windows=""?$_folder=$_folder."\"":&cfg_MakeTuxPath;
exec($explorer.$_folder);
}
A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc





Edited 2 time(s). Last edit at 07/19/2009 08:57AM by JujuLand.

Options: ReplyQuote
Re: Utils plugin not providing OS 'platform'
Posted by: JamesD
Date: July 19, 2009 11:48AM

@ JujuLand

The version of utils that I have is 0.0.9 according to the text file which was in the zip.

Regarding Linux, do the writeini() and readini() statements work in that ops system? I see the the MySecret encryption program has a Linux version.

What would be the correct command in Linux to erase the file?
NT exec("cmd /c ERASE \"".$_Secur_Paste_Path."\"");
9x exec("command /c ERASE \"".$_Secur_Paste_Path."\"");

Currently I have no way to test in Linux.

Options: ReplyQuote
Re: Utils plugin not providing OS 'platform'
Posted by: mark307
Date: July 19, 2009 02:47PM

Sorry, I missed an instruction.
The pluginmsgex function must have an argument to tell a type of a return value.
This is a right usage.
$value = pluginmsgex(utils, "GetOSVer", "Platform", STRING);
regards.

Options: ReplyQuote
Re: Utils plugin not providing OS 'platform'
Posted by: JamesD
Date: July 19, 2009 03:06PM

@ Mark307

Thanks. Adding STRING gets me a return of 2 on my XP system. That does mean I have to change the statement from equals to not equals in order to get a value of XP returned. I have changed my documentation as follows.
$value = pluginmsgex(utils, "GetOSVer", $field, STRING);

# useful idiom: 9X or NT
$os = pluginmsgex(utils, "GetOSVer", "Platform", STRING) != 2 ? "NT" : "9X";
$os = pluginmsgex(utils, "GetOSVer", "Platform", STRING) == 2 ? "NT" : "9X";

No change in code. I forgot to add "STRING" in one line of my test code.

Big question is whether this will work for 2000, Vista and Windows 7 ?

Does anyone know the platform numbers for 9x, 2000, Vista, and Windows 7 ?

Looks like 9x is 1 and everything else is 2. 2000, XP, Vista and Windows7 will be in another field. See this code. http://www.mvps.org/access/api/api0055.htm



Edited 2 time(s). Last edit at 07/19/2009 05:09PM by JamesD.

Options: ReplyQuote
Re: Utils plugin not providing OS 'platform'
Posted by: JujuLand
Date: July 19, 2009 08:46PM

Quote
JamesD
Regarding Linux, do the writeini() and readini() statements work in that ops system? I see the the MySecret encryption program has a Linux version."
There is no reason that it doesn't work under Linux, in fact wine. Wine has a registry.

All the modification or read I made in registry have been ok.

The version of Windows emulated by wine is XP by default (that's the reason why I say it's important after the first os test, to verificate if it would not to be Linux (wine). You can change the emulated OS for a program if you need it. I have use 'cmd' with Visual DialogScript, and it works, so, it ought to run with km macro.

Personnaly, I always use 'del' instead of erase, and it works too.

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc





Edited 1 time(s). Last edit at 07/19/2009 08:50PM by JujuLand.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.