Author | Topic: reserved Keyword (in Codeblock) ? | |
---|---|---|
AUGE_OHR | reserved Keyword (in Codeblock) ? on Thu, 25 Jun 2009 04:06:16 +0200 hi, please look at his Code *** Code *** #include "common.ch" #include "os.ch" #define CRLF CHR(13)+CHR(10) #PRAGMA LIBRARY("ASCOM10.LIB") STATIC lVISTA := .F. PROCEDURE Main(strComputer) LOCAL objWMIService LOCAL colItems LOCAL cText LOCAL cName LOCAL bCollBlock LOCAL i,iMax LOCAL aitem := {} LOCAL aProp := {; "AccessMask",; "Archive",; "Caption",; "Compressed",; "CompressionMethod",; "CreationClassName",; "CreationDate",; "CSCreationClassName",; "CSName",; "Description",; "Drive",; "EightDotThreeFileName",; "Encrypted",; "EncryptionMethod",; "Extension",; "FileName",; "FileSize",; "FileType",; "FSCreationClassName",; "FSName",; "Hidden",; "InstallDate",; "InUseCount",; "LastAccessed",; "LastModified",; "Name",; "Path",; "Readable",; "Status",; "System" } DEFAULT strComputer TO "Localhost" CLS SET ALTER TO Win32_Directory.TXT SET ALTER ON IF "VISTA" $ OS(OS_PRODUCT) .OR.; "WIN2003" $ OS(OS_PRODUCT) .OR.; "WIN2008" $ OS(OS_PRODUCT) lVISTA := .T. ENDIF IF lVISTA objWMIService := CreateObject("WbemScripting.SWbemLocator" ):ConnectServer(strComputer, "Root\CIMv2") ELSE objWMIService := GetObject("WinMgmts:\\"+strComputer+"\Root\CIMv2") ENDIF colItems := objWMIService:ExecQuery("select * from Win32_Directory",,48) bCollBlock := {|oService,n| AADD(aItem,{ n,; oService:AccessMask,; oService:Archive,; oService:Caption,; oService:Compressed,; oService:CompressionMethod,; oService:CreationClassName,; oService:CreationDate,; oService:CSCreationClassName,; oService:CSName,; oService:Description,; oService:Drive,; oService:EightDotThreeFileName,; oService:Encrypted,; oService:EncryptionMethod,; oService:Extension,; oService:FileName,; oService:FileSize,; oService:FileType,; oService:FSCreationClassName,; oService:FSName,; oService:Hidden,; oService:InstallDate,; oService:InUseCount,; oService:LastAccessed,; oService:LastModified,; oService:Name,; oService:Path,; oService:Readable,; oService:Status,; oService:System })} ComEvalCollection(colItems, bCollBlock ) IF LEN(aItem) > 0 ? iMax := LEN(aItem[1]) FOR i := 1 TO iMax-1 ? SUBSTR(aProp[i]+SPACE(40),1,40)+":",aItem[1,i+1] NEXT ENDIF SET ALTER OFF SET ALTER TO Runshell("Win32_Directory.TXT","Notepad.exe",.T.) RETURN *** Eof *** i can not compile this Code while it say : c:\ALASKA\WMI>xpp Win32_Directory.PRG Xbase++ (R) Compiler 1.90.355 Apr 10 2009 Copyright (c) Alaska Software. All rights reserved. File: Win32_Directory.PRG Line: 113 Win32_Directory.PRG(96:0): error XBT0251: Reserved keyword 1 error(s) found in file Win32_Directory.PRG! while Code is "generated" and "other" Sample work i wonder what "Keyword" (oService:XXX) it is ? greetings by OHR Jimmy | |
AUGE_OHR | Re: reserved Keyword (in Codeblock) ? on Thu, 25 Jun 2009 04:12:55 +0200 just to be shure "generated" Code does work. here is a working Sample which can be compiled by Xbase++ *** Code *** #include "common.ch" #include "os.ch" #define CRLF CHR(13)+CHR(10) #PRAGMA LIBRARY("ASCOM10.LIB") STATIC lVISTA := .F. PROCEDURE Main(strComputer) LOCAL objWMIService LOCAL colItems LOCAL cText LOCAL cName LOCAL bCollBlock LOCAL i,iMax LOCAL aitem := {} LOCAL aProp := {; "BootDevice",; "BuildNumber",; "BuildType",; "Caption",; "CodeSet",; "CountryCode",; "CreationClassName",; "CSCreationClassName",; "CSDVersion",; "CSName",; "CurrentTimeZone",; "DataExecutionPrevention_32BitApplications",; "DataExecutionPrevention_Available",; "DataExecutionPrevention_Drivers",; "DataExecutionPrevention_SupportPolicy",; "Debug",; "Description",; "Distributed",; "EncryptionLevel",; "ForegroundApplicationBoost",; "FreePhysicalMemory",; "FreeSpaceInPagingFiles",; "FreeVirtualMemory",; "InstallDate",; "LargeSystemCache",; "LastBootUpTime",; "LocalDateTime",; "Locale",; "Manufacturer",; "MaxNumberOfProcesses",; "MaxProcessMemorySize",; "Name",; "NumberOfLicensedUsers",; "NumberOfProcesses",; "NumberOfUsers",; "Organization",; "OSLanguage",; "OSProductSuite",; "OSType",; "OtherTypeDescription",; "PlusProductID",; "PlusVersionNumber",; "Primary",; "ProductType",; "QuantumLength",; "QuantumType",; "RegisteredUser",; "SerialNumber",; "ServicePackMajorVersion",; "ServicePackMinorVersion",; "SizeStoredInPagingFiles",; "Status",; "SuiteMask",; "SystemDevice",; "SystemDirectory",; "SystemDrive",; "TotalSwapSpaceSize",; "TotalVirtualMemorySize",; "TotalVisibleMemorySize",; "Version" } DEFAULT strComputer TO "Localhost" CLS SET ALTER TO Win32_OperatingSystem.TXT SET ALTER ON IF "VISTA" $ OS(OS_PRODUCT) .OR.; "WIN2003" $ OS(OS_PRODUCT) .OR.; "WIN2008" $ OS(OS_PRODUCT) lVISTA := .T. ENDIF IF lVISTA objWMIService :=CreateObject("WbemScripting.SWbemLocator" ):ConnectServer(strComputer, "Root\CIMv2") ELSE objWMIService := GetObject("WinMgmts:\\"+strComputer+"\Root\CIMv2") ENDIF colItems := objWMIService:ExecQuery("select * from Win32_OperatingSystem",,48) bCollBlock := {|oService,n| AADD(aItem,{ n,; oService:BootDevice,; oService:BuildNumber,; oService:BuildType,; oService:Caption,; oService:CodeSet,; oService:CountryCode,; oService:CreationClassName,; oService:CSCreationClassName,; oService:CSDVersion,; oService:CSName,; oService:CurrentTimeZone,; oService:DataExecutionPrevention_32BitApplications,; oService:DataExecutionPrevention_Available,; oService:DataExecutionPrevention_Drivers,; oService:DataExecutionPrevention_SupportPolicy,; oService:Debug,; oService:Description,; oService:Distributed,; oService:EncryptionLevel,; oService:ForegroundApplicationBoost,; oService:FreePhysicalMemory,; oService:FreeSpaceInPagingFiles,; oService:FreeVirtualMemory,; oService:InstallDate,; oService:LargeSystemCache,; oService:LastBootUpTime,; oService:LocalDateTime,; oService:Locale,; oService:Manufacturer,; oService:MaxNumberOfProcesses,; oService:MaxProcessMemorySize,; oService:Name,; oService:NumberOfLicensedUsers,; oService:NumberOfProcesses,; oService:NumberOfUsers,; oService:Organization,; oService:OSLanguage,; oService:OSProductSuite,; oService:OSType,; oService:OtherTypeDescription,; oService:PlusProductID,; oService:PlusVersionNumber,; oService:Primary,; oService:ProductType,; oService:QuantumLength,; oService:QuantumType,; oService:RegisteredUser,; oService:SerialNumber,; oService:ServicePackMajorVersion,; oService:ServicePackMinorVersion,; oService:SizeStoredInPagingFiles,; oService:Status,; oService:SuiteMask,; oService:SystemDevice,; oService:SystemDirectory,; oService:SystemDrive,; oService:TotalSwapSpaceSize,; oService:TotalVirtualMemorySize,; oService:TotalVisibleMemorySize,; oService:Version })} ComEvalCollection(colItems, bCollBlock ) IF LEN(aItem) > 0 ? iMax := LEN(aItem[1]) FOR i := 1 TO iMax-1 ? SUBSTR(aProp[i]+SPACE(40),1,40)+":",aItem[1,i+1] NEXT ENDIF SET ALTER OFF SET ALTER TO Runshell("Win32_OperatingSystem.TXT","Notepad.exe",.T.) RETURN *** Eof *** greetings by OHR Jimmy | |
Andreas Herdt | Re: reserved Keyword (in Codeblock) ? on Thu, 25 Jun 2009 09:55:43 +0200 Hallo Jimmy, It is the instance variable oService:hidden the compiler does not like. Please replace this with oService:getProperty( "hidden" ) With my best regards, Andreas Herdt Alaska Software -------------------------------------------------------------------- Technical Support: support@alaska-software.com News Server: news.alaska-software.com Homepage: http://www.alaska-software.com WebKnowledgeBase: http://www.alaska-software.com/kbase.shtm Fax European Office: +49 (0) 61 96 - 77 99 99 23 Fax US Office: +1 (646) 218 1281 -------------------------------------------------------------------- AUGE_OHR schrieb: > hi, > > please look at his Code > *** Code *** > #include "common.ch" > #include "os.ch" > #define CRLF CHR(13)+CHR(10) > > #PRAGMA LIBRARY("ASCOM10.LIB") > > STATIC lVISTA := .F. > > PROCEDURE Main(strComputer) > LOCAL objWMIService > LOCAL colItems > LOCAL cText > LOCAL cName > LOCAL bCollBlock > LOCAL i,iMax > LOCAL aitem := {} > LOCAL aProp := {; > "AccessMask",; > "Archive",; > "Caption",; > "Compressed",; > "CompressionMethod",; > "CreationClassName",; > "CreationDate",; > "CSCreationClassName",; > "CSName",; > "Description",; > "Drive",; > "EightDotThreeFileName",; > "Encrypted",; > "EncryptionMethod",; > "Extension",; > "FileName",; > "FileSize",; > "FileType",; > "FSCreationClassName",; > "FSName",; > "Hidden",; > "InstallDate",; > "InUseCount",; > "LastAccessed",; > "LastModified",; > "Name",; > "Path",; > "Readable",; > "Status",; > "System" } > > DEFAULT strComputer TO "Localhost" > > CLS > SET ALTER TO Win32_Directory.TXT > SET ALTER ON > > IF "VISTA" $ OS(OS_PRODUCT) .OR.; > "WIN2003" $ OS(OS_PRODUCT) .OR.; > "WIN2008" $ OS(OS_PRODUCT) > lVISTA := .T. > ENDIF > IF lVISTA > objWMIService := > CreateObject("WbemScripting.SWbemLocator" ):ConnectServer(strComputer, > "Root\CIMv2") > ELSE > objWMIService := GetObject("WinMgmts:\\"+strComputer+"\Root\CIMv2") > ENDIF > > colItems := objWMIService:ExecQuery("select * from Win32_Directory",,48) > bCollBlock := {|oService,n| AADD(aItem,{ n,; > oService:AccessMask,; > oService:Archive,; > oService:Caption,; > oService:Compressed,; > oService:CompressionMethod,; > oService:CreationClassName,; > oService:CreationDate,; > oService:CSCreationClassName,; > oService:CSName,; > oService:Description,; > oService:Drive,; > oService:EightDotThreeFileName,; > oService:Encrypted,; > oService:EncryptionMethod,; > oService:Extension,; > oService:FileName,; > oService:FileSize,; > oService:FileType,; > oService:FSCreationClassName,; > oService:FSName,; > oService:Hidden,; > oService:InstallDate,; > oService:InUseCount,; > oService:LastAccessed,; > oService:LastModified,; > oService:Name,; > oService:Path,; > oService:Readable,; > oService:Status,; > oService:System })} > > ComEvalCollection(colItems, bCollBlock ) > > IF LEN(aItem) > 0 > ? iMax := LEN(aItem[1]) > FOR i := 1 TO iMax-1 > ? SUBSTR(aProp[i]+SPACE(40),1,40)+":",aItem[1,i+1] > NEXT > ENDIF > > SET ALTER OFF > SET ALTER TO > > Runshell("Win32_Directory.TXT","Notepad.exe",.T.) > > RETURN > *** Eof *** > i can not compile this Code while it say : > > c:\ALASKA\WMI>xpp Win32_Directory.PRG > Xbase++ (R) Compiler 1.90.355 Apr 10 2009 > Copyright (c) Alaska Software. All rights reserved. > File: Win32_Directory.PRG Line: 113 > Win32_Directory.PRG(96:0): error XBT0251: Reserved keyword > 1 error(s) found in file Win32_Directory.PRG! > > while Code is "generated" and "other" Sample work i wonder what "Keyword" > (oService:XXX) it is ? > > greetings by OHR > Jimmy > > | |
AUGE_OHR | Re: reserved Keyword (in Codeblock) ? on Thu, 25 Jun 2009 10:20:14 +0200 hi, > It is the instance variable > oService:hidden > the compiler does not like. Please replace this with > oService:getProperty( "hidden" ) ah, em, h ... i remember o:getProperty("Keyword") ... THX greetings by OHR Jimmy |