Results 1 to 5 of 5
  1.    #1  
    With suggestions and ideas from jd and zbop I have thrown together a devices.ini file with device specific information. Included is a Device.mscr script that when run sets a registry entry for the device to use as an ini key into devices.ini. Using it you can extract device metadata for use in your scripts.

    Example from devices.ini
    Code:
    [Sprint Treo 700wx]
    RegKey1=HKLM|Software\Palm\Version|SoftwareVersionString|S|TREO700WX
    RegKey2=HKLM|Software\Palm\Version|SoftwareVersionString|S|SPNT
    RegKey3=HKLM|Drivers\USB\FunctionDrivers\Serial_Class|Product|S|Treo 700w
    CarrierLine=HKLM|System\State\Phone|Current Operator Name
    DeviceMfg=Palm
    Device=Treo 700wx
    DeviceStyle=Treo
    DeviceModel=700wx
    WirelessCarrier=Sprint
    All WM Treo's should be detected using the current ini. Even the oddball wireless carrier versions should be detected since the ini is set up with a catch all entry for each type of device.

    Here is an example script that shows how to use this stuff.

    Code:
    # DeviceInfo.mscr
    # 
    #  Description:
    #  This is an example script to show how to use Device.mscr and devices.ini
    #  to extract and utilize device specific metadata.
    #
    #  This script should display the device info for the device it is run on
    #  and set the carrier line to display the device key
    #
    
    
    # initialize variables
    #
    MyName      = SystemPath( "ScriptName" )
    MyPath      = SystemPath( "ScriptPath" )
    Version     = "1.0"
    PIPE        = "|"
    NL          = "^NL^"
    DeviceMap   = MyPath \ "devices.ini"
    
    
    # First check if the device key is already known from a previous run
    # 
    If ( NOT RegValueExists( "HKLM", "Software\Mort's MortScript", "Device" ) )
    
       # Call Device.mscr to determine what device this is and set the ini key
       #
       CallScript( MyPath \ "Device.mscr" )
    
    EndIf
    
    # Get the ini key to use for this device
    #
    DeviceKey = RegRead( "HKLM", "Software\Mort's MortScript", "Device" )
    
    If ( DeviceKey eq "Unknown" )
       Message( "Error: Your device could not be found in the devices.ini file. " \
                & "Please add your device info.", MyName )
    EndIf
    
    # Get the carrier line from devices.ini
    #
    CarrierLine = IniRead( DeviceMap, DeviceKey, "CarrierLine" )
    Split( CarrierLine, PIPE, FALSE, CLRoot, CLKey, CLVar )
    
    # Print the device key to the carrier line
    #
    RegWriteString( CLRoot, CLKey, CLVar, DeviceKey ) 
    
    # Print out other metadata for the device from devices.ini
    #
    DeviceMfg        = IniRead( DeviceMap, DeviceKey, "DeviceMfg" )
    Device           = IniRead( DeviceMap, DeviceKey, "Device" )
    DeviceStyle      = IniRead( DeviceMap, DeviceKey, "DeviceStyle" )
    DeviceModel      = IniRead( DeviceMap, DeviceKey, "DeviceModel" )
    WirelessCarrier  = IniRead( DeviceMap, DeviceKey, "WirelessCarrier" )
    
    Message( "DeviceMfg = " & DeviceMfg & NL & \
             "Device = " & Device & NL & \
             "DeviceStyle = " & DeviceStyle & NL & \
             "DeviceModel = " & DeviceModel & NL & \
             "WirelessCarrier = " & WirelessCarrier, MyName )
    If you have an app that needs device specific information just include Device.mscr and devices.ini with your install and modify your main script as shown in the DeviceInfo.mscr example. Add any additional metadata to devices.ini as needed.

    DeviceInfo.mscr, Device.mscr and devices.ini attached.
    Attached Files Attached Files
  2. #2  
    Nice addition
    Last edited by zbop; 05/05/2007 at 03:10 PM.
  3.    #3  
    Thanks, I should've put this together a while ago. It was a prereq for my CarrierMon script that I haven't really started yet.
  4. #4  
    Quote Originally Posted by hannip View Post
    Thanks, I should've put this together a while ago. It was a prereq for my CarrierMon script that I haven't really started yet.
    Dude, you haven't started that yet? Got everyone excited and left 'em hangin...
  5.    #5  
    Quote Originally Posted by zbop View Post
    Dude , you haven't started that yet? Got everyone excited and left 'em hangin...
    lol. I know, the excitement was deafening.

Posting Permissions