Results 1 to 19 of 19
  1.    #1  
    How do we pull this off.Not that hard really.Here is a start.

    Timer script
    ###################################################
    #REFRESH.mscr-REFRESH
    ErrorLevel ("syntax")

    Q = RegRead ("HKLM", ????\????\????\????", "????" )
    If ( Q = ? )<-------Power on/off value or roaming value for start of PLUGIN.mscr
    CallScript( "\Program Files\TREO ALERT\PLUGIN.mscr" )
    Sleep 500
    U = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "FRESH" )
    If ( U = 1 )
    RegWriteDword System\CurrentControlSet\Control\Power\State\led", "FRESH" , 2 )
    EndIf

    #Executes the script again after 30 seconds
    Rerun = Timestamp()+30
    RunAt( Rerun, "\Program Files\TREO ALERT\REFRESH.mscr" )
    ###################################################
    Each case can be a script.Each script has a fresh value

    #Case one
    U = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "FRESH" )
    If ( U = 1 )
    RegWriteString "HKLM","System\State\Phone","Current Operator Name",TREO ALERT INFO
    RegWriteString "HKLM","Software\Microsoft\Ril","CarrierName",TREO ALERT INFO
    EndIf

    #Case TWO
    P = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "FRESH" )
    If ( P = 2 )
    RegWriteString "HKLM","System\State\Phone","Current Operator Name",XCAST INFO
    RegWriteString "HKLM","Software\Microsoft\Ril","CarrierName",XCAST INFO
    RegWriteDword System\CurrentControlSet\Control\Power\State\led", "FRESH" , 1 )
    EndIf


    ####################################################

    We now have created a loop with refresh of carrier plugin for 2 scripts every 30 sec...
    Last edited by slingbox; 04/11/2007 at 03:51 PM.
  2. #2  
    A script running every 30 seconds is more expensive that it seems. Remember, it has to load mortscript from flash memory. Then the executable has to decompress (because Mortscript is UPXed), then it must load the mscr file and interpret it.

    Endless loop plz
  3.    #3  
    not endless.It,s not calling the plugin if
    Q = RegRead ("HKLM", ????\????\????\????", "????" )
    If ( Q = ? )<-------Power on/off value or roaming value for start of PLUGIN.mscr
    CallScript( "\Program Files\TREO ALERT\PLUGIN.mscr" )
    EndIf

    So there is no overload because the plugin.mscr is not being called when device is off.
    I have the loop set at 30 sec for Treo alerts getting refresh with no issue at all
  4.    #4  
    or heck if the comfe level is to low set it at 60 sec
  5. #5  
    i dont know if this will help or not, but this is what i did you refresh my carrier plugin and have it display changes made.

    #writer - writes in carrier string

    While(1)
    TA = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Treo Alert" )
    P = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Profile", )
    B = RegRead ("HKLM", "System\State\Battery", "Percentage", )
    WriterString = "Alert " & %TA% & " - " & "Profile " & %P% & " - " & %B% & "%"
    RegWriteString "HKLM","System\State\Phone","Current Operator Name", %WriterString%
    sleep 5000
    EndWhile

    those three values are changed with the scripts that run them. the writer scripts just reads every 5 seconds and changes if needed. i have used taskman to see how much cpu usage is being used and did think it was that much. i could be wrong.

    the script could be as easy as this.

    #writer - writes in carrier string

    #create the Follower setting spot
    a = RegValueExists ("HKLM", "xxx\xxx\xxx\xxx", "whatever")
    If (A = 0)
    RegWriteString ("HKLM", "xxx\xxx\xxx\xxx", "whatever", "empty" )

    While(1)
    WriterString = RegRead ("HKLM", "xxx\xxx\xxx\xxx", "whatever" )
    RegWriteString "HKLM","System\State\Phone","Current Operator Name", %WriterString%
    sleep ?????
    EndWhile

    then when ever an app needs to write something to the carrier plugin thay would just write it in the ("HKLM", "xxx\xxx\xxx\xxx", "whatever" )

    is this to much of a battery drain to just run all the time. i have 3 scripts running all the time, doing kind of the same thing and i havent noticed any difference. altho i did think about it, that's why i did the taskman thing. taskman shows cpu usage on the 3 scripts run less than 1.80. is that too much?
  6.    #6  
    See thats my worrie is battery drain cody.I trying to find that value that will start and stop refresh. value on/off or roaming value.I have treo alerts at 30 refresh and it works great.When I turn off phone im trying to stop the regwritestring for there is no need..

    Thats what this is all about

    Q = RegRead ("HKLM", ????\????\????\????", "????" )
    If ( Q = ? )<-------Power on/off value or roaming value for start of PLUGIN.mscr
    CallScript( "\Program Files\TREO ALERT\PLUGIN.mscr" )
  7. #7  
    Suggestion. I think hannip suggested something similar a few days ago.

    All apps that need to write to the carrier status line write instead to a common txt file. The latest Mort alpha supports iniWrite function, btw. Either way, there'll be a "slot" or section in the file reserved for your app. If it ain't there... create a section it and stuff your data. Example format:

    [settings]
    AppRepeatInterval = 2 min
    DisplayDelay = 2 sec
    PersistentDisplay = TreoAlert

    [xcast]
    "Line 1 data"
    "Line 2 data"
    "Line 2 data"
    [/xcast]

    [TreoAlert]
    "Line 1 data"
    [/TreoAlert]

    etc.


    The app runs, reads the file, displays the data, sets the next run time, then exits.

    -- JDC
    Last edited by jdcochran; 04/11/2007 at 09:51 PM.
  8.    #8  
    Very Cool
  9. #9  
    hey sling. I think it's time we learn this .ini thing. that seems too cool.

    jd been using it for a while with xcast, but I can't seem to open an ini file to see/learn what's in there.

    1. how or what do you write/read ini files with?

    2. how or what does a script write/read the ini files? and even create.

    can someone get me started by pointing me in the right direction?

    .ini for dummies maybe? lol.

    thanks, cody
  10. #10  
    Quote Originally Posted by codyppc View Post
    hey sling. I think it's time we learn this .ini thing. that seems too cool.

    jd been using it for a while with xcast, but I can't seem to open an ini file to see/learn what's in there.

    1. how or what do you write/read ini files with?

    2. how or what does a script write/read the ini files? and even create.

    can someone get me started by pointing me in the right direction?

    .ini for dummies maybe? lol.

    thanks, cody
    An INI file is a simple ASCII text file. You can open it up using Notepad, Wordpad, or even MS Word on the PC. On a PPC, you can open it up using Notes.

    Here's a section of the code in my script that creates an INI file....

    Code:
      cDateINI = "\Program Files" \ "cDate.ini"
    
    # ================================================================
    #
    # If this is the initial run, it will read the values from 
    # HKLM\System\State\Phone\Current Operator Name
    # HKLM\Software\Microsoft\Ril
    #
    # Then creates an INI file with the original values and places the
    # ini file in %AppLocation%.  This will make it easy to recover 
    # original values.
    #
    # ----------------------------------------------------------------
    
      cDateINIloc=FileExists(%cDateINI%)
    
      If (%cDateINIloc% = "0" )
      OperatorName=RegRead ("HKLM","System\State\Phone","Current Operator Name")
      CarrierName=RegRead ("HKLM","Software\Microsoft\Ril","CarrierName")
    
      WriteFile (%cDateINI%, "# =======================================", 0)
      WriteFile (%cDateINI%, "^NL^", 1)
      WriteFile (%cDateINI%, "# INI file automatically created by cDate app.", 1)
      WriteFile (%cDateINI%, "^NL^", 1)
      WriteFile (%cDateINI%, "# Contains original values of Carrier field", 1)
      WriteFile (%cDateINI%, "^NL^", 1)
      WriteFile (%cDateINI%, "# ---------------------------------------", 1)
      WriteFile (%cDateINI%, "^NL^", 1)
      WriteFile (%cDateINI%, "[Carrier]", 1)
      WriteFile (%cDateINI%, "^NL^", 1)
      WriteFile (%cDateINI%, "OperatorName=", 1)
      WriteFile (%cDateINI%, %OperatorName%, 1)
      WriteFile (%cDateINI%, "^NL^", 1)
      WriteFile (%cDateINI%, "CarrierName=", 1)
      WriteFile (%cDateINI%, %CarrierName%, 1)
      WriteFile (%cDateINI%, "^NL^", 1)
      EndIf
    When created, the file looks like this...
    Code:
    # =======================================
    # INI file automatically created by cDate app.
    # Contains original values of Carrier field
    # ---------------------------------------
    [Carrier]
    OperatorName=Sprint
    CarrierName=Sprint
    You can probably look at Xcast for examples on how to read the file.

    In the above example...
    Code:
      WriteFile (%cDateINI%, "OperatorName=", 1)
      WriteFile (%cDateINI%, %OperatorName%, 1)
      WriteFile (%cDateINI%, "^NL^", 1)
    %cDateINI% = the file name, including the path.

    The 1 or 0 denotes appends or creates the file. The first line written should always be a 0.

    ^NL^ is a Carriage Return (^CR^) and Line Feed (^LF^). If I omitted the ^NL^, the above line would read like this...

    Code:
    [Carrier]OperatorName=SprintCarrierName=Sprint
  11. #11  
    I have been working on something very similar, based on my idea from Multi-text.

    The main script supports reading values from an ini and also supports scrolling text, flashing text and static text displays for each entry.

    I have more work to do, including making it default to just display of text if no control string is written in the ini file.

    Script looks like this:
    Code:
    #BannerPlay.mscr
    #
    # I'm guessing I didn't conform to all the coding standards, but this is only a test...
    
    ThisScriptPath = SystemPath("ScriptPath")
    ThisScriptName = SystemPath("ScriptName") & SystemPath("ScriptExt")
    #
    # This is how long to wait between scroll moves
    CharDelay = 200
    
    # This is the delays for flash on and ofF
    FlashOnDelay = 1500
    FlashOffDelay = 500
    ##################################################################
    
    # The Carrier area uses a proportional font, so we can't 
    # calculate how wide the string is ahead of time.
    # This is an easy way of padding the spaces
    BlankString = "                                             "
    BlankStringLen = 45
    ##################################################################
    
    # This is the character used as a delimiter in the displayed string.
    Delimiter = "|"
    ##################################################################
    
    # This is how many characters we write to reg key each display
    CarrierStringLen = 40
    ##################################################################
    
    # Hard Code the Phone Type Until a suitable sub is developed
    PhoneType = "700w"
    ##################################################################
    
    # This is the ini file which contains the strings to display
    inifilename = ThisScriptPath \ "bannerplay.ini"
    
    If ( PhoneType EQ "Unknown" )
    Message (" Unknown Phone Type....Exiting" )
    Exit
    EndIf
    
    If ( PhoneType EQ "700w" )
    #debug Message( "700w Detected " )
    RegKey = "Software\Microsoft\RIL"
    RegKeyValName = "CarrierName" 
    EndIf
    
    If ( PhoneType EQ "700wx" )
    #debug Message( "700wx Detected" )
    RegKey = "System\State\Phone"
    RegKeyValName = "Current Operator Name" 
    EndIf
    
    # This may want to be something other than while(1) in the future.  I hate 
    # While(1)'s and have argued against them in the past.....
     
    While(1)
    # Haul the strings in we want to display in succession
    ForEach sectionname in iniSections (inifilename)
    
    #debug message ("Section: " & sectionname)
    ForEach keyname, BannerMsg in iniKeys ( inifilename, sectionname )
    
    #debug message (BannerMsg)
    
    # Separate the string into component parts
    
    Split (BannerMsg, "|", 0, MsgParts)
    
    # do special things if it is a regsitry key
    If (sectionname EQ "registry")
       Split (MsgParts[1], ",", 1, RegParts)
       MsgParts[1] = RegRead( RegParts[1], RegParts[2], RegParts[3])
       MsgParts[1] = MsgParts[2] & MsgParts[1] & MsgParts[4]
       MsgParts[2] = MsgParts[3]
    #debug   message(MsgParts[1])
    EndIf
    
    StrLenString = MsgParts[1]
    controlString = MsgParts[2]
    #debug message("String: " & MsgParts[1] & "^CR^" & "Control: " & controlstring)
    # I didn't see a strlen() function, so I wrote this simple sub.
    # It assumes StrLenString as the string to measure and puts the length in StrLength
    Call StrLen
    
    BannerMsg = MsgParts[1]
    
    ForEach cntrl in split (MsgParts[2], "," ,0)
    
    #debug message (cntrl)
    
    x = find ("FLSER", substr (cntrl, 1, 1) )
    y = find ("123456789", substr(cntrl, 2, 1))
    
    Switch(x)
    
    # This is F (= Flash)
    Case (1) 
    Repeat (y)
    #debug message ("Flash: " & y & " times.")
    Call FlashBanner
    EndRepeat
    
    # This is L (= Left Scroll) 
    Case (2)
    #debug message ("Left scroll: " & y & " times.")
    Repeat (y)
    Call BannerScrollLeft
    EndRepeat
    
    # This is S (= Static)
    Case (3)
    #debug message ("Static: " & y & " seconds.")
    BannerString = MsgParts[1]
    Call WriteBanner
    Sleep(y * 1000)
    
    # This is E (= Erase)
    Case (4)
    #debug message ("Erase: " & y & " seconds.")
    BannerString = BlankString
    Call WriteBanner
    Sleep(y * 1000)l
    
    # This is R (= Right)
    Case (5)
    #debug message ("Right scroll: " & y & " times.")
    Repeat (y)
    Call BannerScrollRight
    EndRepeat
    
    EndSwitch
    
    EndForEach
    
    sleep (100)
    EndForEach
    
    sleep(100)
    EndForEach
    
    sleep(1000)
    EndWhile
    # Sleep and do this again at the next interval
    Exit
    
    ###### End of Main Program  ## Subroutines follow ######
    Sub CheckPhoneType
    
    #This is where the phone type will be detected, once we figure out a reliable way to do that.
    #For now, it is hard coded.
    # if Phone cannot be detected, this should set PhoneType to "Error" or "Unknown", etc.
    
    PhoneType = "700w"
    
    EndSub
    
    
    
    Sub BannerScrollRight
    
    # This is how many times we need to put something up during the scrolling
    x = StrLength + BlankStringLen
    
    # This  is padding to adjust for prop fonts..will need to be tweaked
    x = x + 5
    
    # Build a string which is The String + blank to make the scroll simple
    TempStr = BlankString & BannerMsg & BlankString
    
    i = x
    # Run the loop to scroll through the string
    Repeat (x)
    # This is the string that gets displayed each scroll time segment
    BannerString = Substr ( TempStr, i, CarrierStringLen) 
    # Call the sub which does the simple reg write
    Call WriteBanner
    # Sleep according to the appropriate delay
    Sleep (CharDelay)
    # Index character in the string
    i = i - 1
    # Repeat it
    EndRepeat
    
    # We are done
    EndSub
    
    
    Sub BannerScrollLeft
    
    # This is how many times we need to put something up during the scrolling
    x = StrLength + BlankStringLen
    
    # This  is padding to adjust for prop fonts..will need to be tweaked
    x = x + 5
    
    # Build a string which is blank + The String + blank to make the scroll simple
    TempStr = BlankString & BannerMsg & BlankString
    
    i = 1
    # Run the loop to scroll through the string
    Repeat (x)
    # This is the string that gets displayed each scroll time segment
    BannerString = Substr ( TempStr, i, CarrierStringLen) 
    # Call the sub which does the simple reg write
    Call WriteBanner
    # Sleep according to the appropriate delay
    Sleep (CharDelay)
    # Index character in the string
    i = i + 1
    # Repeat it
    EndRepeat
    
    # We are done
    EndSub
    
    
    Sub FlashBanner
    
    # Put it up, wait, then erase it
    BannerString = BannerMsg
    Call WriteBanner
    Sleep(FlashOnDelay)
    BannerString = BlankString
    Call WriteBanner
    Sleep(FlashOffDelay)
    
    EndSub
    
    
    
    Sub WriteBanner
    
    # Simple reg write
    RegWriteString ("HKLM", RegKey, RegKeyValName, BannerString )
    
    EndSub
    
    Sub StrLen
    
    # Try to figure out a string length!
    # Set StrLenString to the string being measured
    # Sets variable StrLength to the length of StrLenString
    
    If (StrLenString EQ "")
    StrLength = 0
    message ("Bad string...exiting....")
    Exit
    Else
    
    x=1
    
    While(SubStr(StrLenString,1,x) NE StrLenString)
    x = x + 1
    EndWhile
    
    StrLength = x
    #debug message ("Stringlength: " & x)
    EndIf
    
    EndSub
    Ini file looks like this:
    Code:
    # Syntax
    # [Sectionname1]
    # Key1 = value1
    # Key2 = value2
    # Key3 = value3
    # [Sectionname2]
    #
    # Section names are a way of showing outside apps where to put their data
    #
    # Key = "Value"
    #
    # Value is a string with the text to display and a control sequence
    # The "|" character separates the display and control texts
    #
    # Controls:
    # Rx : Right scroll; x times; x = 0 to 9
    # Lx : Left scroll; x times;  x = 0 to 9
    # Sx : Static display; x seconds; x = 0 to 9
    #
    # Banner does not care about the actual section names, but the script that 
    # populates the keys does!
    # 
    # Regsitry Values are pulled out of the registry as the program runs
    # Syntax:
    # 
    # Key = "HKxx, key, value|Stringtodisplay|ControlString|AdditionalTextTodisplay"
    #
    # This will display as: "Stringtodisplay""Value""AdditionalTextTodisplay"
    # The quotes don't show up....
    # see Batterylevel below for an example
    #
    # The values under [Xcast] could be stored here by Xcast as it updates.
    # The use of Xcast is only an example
    [Xcast]
    Temperature = "Temperature: 30F and falling|F3,S3"
    Humidity = "Relative Humidity: 20% |S3"
    Date = "Wednesday April 11, 2007|F2,S5"
    [Registry]
    BatteryLevel = "HKLM, system\State\Battery, Percentage|Battery Level: |S5|%"
    Needs some fine tuning, including:
    1. rearrange the order of operations to speed it up
    2. put the script statics in the ini file
    3. fine tune to the "latest" Mortscript version
    4. I'm throwing it out to the masses for comments.

    My question: What version of Mortscript is "the latest" that we should be using to write these scripts????
    Last edited by reverged; 04/12/2007 at 11:33 AM. Reason: changed [quotes] to [codes]
  12. #12  
    What device(s) is this script for? I have a Cingular 750 and do not see HKLM\Software\Microsoft\Ril\CarrierName in the reg.
    Treo 750 - Cingular/ATT
  13. #13  
    Quote Originally Posted by conekkted View Post
    What device(s) is this script for? I have a Cingular 750 and do not see HKLM\Software\Microsoft\Ril\CarrierName in the reg.
    I have the 700w and hard coded this script to that device.
    I'm not sure where the 750 writes the carrier info.
  14. #14  
    Quote Originally Posted by reverged View Post
    ...
    My question: What version of Mortscript is "the latest" that we should be using to write these scripts????
    From the Mort himself:

    "a9 now is out, too. However, it's mostly internal changes, and might be less stable than a8. Also, keep in mind it's still alpha state, there are major interal reworks since 4.0."

    Translated, that means 4.1a9, which is an unstable alpha release. Suggest that the "latest" for anyone creating code today for the masses --- 4.0.

    -- JDC
  15. #15  
    Quote Originally Posted by conekkted View Post
    What device(s) is this script for? I have a Cingular 750 and do not see HKLM\Software\Microsoft\Ril\CarrierName in the reg.
    How many times do we need to re-visit this? I'd like to calmly and passively suggest that someone that has owned more than one PPC phone, or someone that has created code for more than 2 platforms, please create a spreadsheet, put it in a new thread, and we'll help you update it from time to time.

    It could contain these subtle nuances that we keep re-visiting. I'd do it, but I'm just too lazy.



    -- JDC
  16. #16  
    Quote Originally Posted by reverged View Post
    I have the 700w and hard coded this script to that device.
    I'm not sure where the 750 writes the carrier info.
    HKLM\System\State\Phone\Current Operator Name
    Last edited by scottymomo; 04/24/2007 at 11:37 AM. Reason: Fixed the right reg key for the 750
    Palm III > HS Visor > Treo 600 > Treo 650 > Treo 750 > Treo Pro > PrePlus GSM

    "95% of all software issues are due to USER ERROR."
  17. #17  
    Sorry that I haven't been able to help with this guys. Work has been killing me lately and I have a full weekend lined up. Looks like you are all working it out without me, but if something is not done by next weekend I'll pick it up.
  18. #18  
    my mistake above... it's current operator name not current carrier operator name on the 750
    Palm III > HS Visor > Treo 600 > Treo 650 > Treo 750 > Treo Pro > PrePlus GSM

    "95% of all software issues are due to USER ERROR."
  19.    #19  
    What a refreshing thread

Posting Permissions