Post Reply

MortScript examples accumulation

OP Mort

20th April 2012, 07:56 PM   |  #4251  
Member
Thanks Meter: 4
 
62 posts
Join Date:Joined: Oct 2010
Quote:
Originally Posted by mwalt2

Well, I figured out a simple script myself . This allows you to not use an HTC PhoneCanvas and still retain the use of the proximity sensor if your phone has one. In my case, this allows me to use Iconsoft PhonEx and have the screen turn off when next to my ear and turn on when held away from your ear.

Code:
If (RegValueExists("HKLM", "System\State\Phone", "Active Call Count") = FALSE)
RegWriteDWord("HKLM", "System\State\Phone", "PSensorStatus", 0)
ElseIf (RegValueExists("HKLM", "System\State\Phone", "Active Call Count") = TRUE)
RegWriteDWord("HKLM", "System\State\Phone", "PSensorStatus", 1)
does anybody know if there are keys/values in registry to find if
1. the phone is ringing.
2. the call is on (I believe the script mentioned above will work for that.)

it might help somebody. I wrote a script to play-pause, write the current song info in a file (because I keep losing my last pause point), and execute voice command if the music is paused. I ended up using screen off for nitrogen because poweroff or toggledisplay cause it to stop playing.

Code:
RunStatus=RegRead("HKLM","System\State\Nitrogen","Running")
If (Runstatus eq 1)
    SendCommand("Nitrogen",40001)
    sleep(1000)
    WriteFile("nitrogen-status.txt","^NL^",TRUE)
    CurrentTime = FormatTime( "y/m/d:h:i:s", TimeStamp() )
    WriteFile("nitrogen-status.txt","""CurrentTime:" & CurrentTime & "",TRUE)
    SongTitle=RegRead("HKLM","System\State\Nitrogen","SongTitle")
    WriteFile("nitrogen-status.txt","""SongTitle:" & SongTitle & "",TRUE)
    TimeElapsed=RegRead("HKLM","System\State\Nitrogen","TimeElapsed")
    WriteFile("nitrogen-status.txt","""TimeElapsed:" & TimeElapsed & "",TRUE)
    TimeTotal=RegRead("HKLM","System\State\Nitrogen","TimeTotal")
    WriteFile("nitrogen-status.txt","""TimeTotal:" & TimeTotal & "",TRUE)
    PlayStatus=RegRead("HKLM","System\State\Nitrogen","PlayStatus")
    If (PlayStatus lt 2)
        Setvolume(150)
        run("\windows\start menu\programs\voice speed dial.lnk")
        sleep(10000)
        Poweroff()
    Else
        Setvolume(200)
        run("\windows\start menu\programs\screen off.lnk")
    Endif
Else
    Setvolume(150)
    run("\windows\start menu\programs\voice speed dial.lnk")
    sleep(10000)
    Poweroff()
EndIf
Last edited by vivekiny2k; 20th April 2012 at 08:04 PM.
12th May 2012, 01:21 AM   |  #4252  
Member
Thanks Meter: 4
 
62 posts
Join Date:Joined: Oct 2010
since I coudln't find a way to get the weather on lock screen cpr file, I used following script to show weather in place of operator name when end key is pressed on lock screen. I am also think about updating the weather on double click.

Code:
If (RegValueExists("HKLM", "System\State\Phone", "Active Call Count") = FALSE)
        LockStatus=RegRead("HKLM","System\State","Lock")
        if (LockStatus gt 0)        
            WeatherStatus=RegRead("HKLM","Software\Microsoft\CHome\TitaniumWeather\CondensedPage","PluginLabel")
            Weathertime=RegRead("HKLM","Software\Microsoft\CHome\TitaniumWeather\Page1","Time")
            TimeLocation=Find(Weathertime,"Updated at")
            UpdateTime=Substr(Weathertime,TimeLocation + 10,9)
            RegWriteString("HKLM","System\State\Phone","Current Operator Name",WeatherStatus & UPdateTime)
        else
            Run("\Program Files\AEBPlus\AEBPlus.exe", 0021)
        endif
Else
    Run("\Program Files\AEBPlus\AEBPlus.exe", 0021)        
Endif
10th July 2012, 09:29 AM   |  #4253  
kastel71's Avatar
Senior Member
Thanks Meter: 27
 
117 posts
Join Date:Joined: Dec 2008
[HELP] how can I ...in Mortscript
I have a "gps.ini" file these parameters:
Code:
Port = 4
Baudrate = 56000
And I have a "sys.txt" file these parameters:
Code:
[gps]
port = "1"
baud = "4800"
I want to read the parameters values from "Port"and "Band from "gps.ini" and write them in the "sys.txt"

How can I do this with mortscript?
10th July 2012, 11:29 AM   |  #4254  
RoryB's Avatar
Recognized Developer
Flag Lexington
Thanks Meter: 683
 
2,781 posts
Join Date:Joined: Sep 2008
Donate to Me
More
Quote:
Originally Posted by kastel71

I have a "gps.ini" file these parameters:

Code:
Port = 4
Baudrate = 56000
And I have a "sys.txt" file these parameters:
Code:
[gps]
port = "1"
baud = "4800"
I want to read the parameters values from "Port"and "Band from "gps.ini" and write them in the "sys.txt"

How can I do this with mortscript?

Does your gps.ini have a [section] defined?

Quote:

9.13.3 Reading a value of an INI file (IniRead)
string = IniRead( file name, section, entry )
Reads an entry from an INI file. The section name must be passed without the brackets.
Example:
x = IniRead( "\My documents\test.ini", "Settings", "Test" )

9.13.4 Writing a value to an INI file (IniWrite)
IniWrite( file name, section, entry, value )
Writes an entry to an INI file. The section name must be passed without the brackets.
Be aware this causes MortScript to load, parse, and write the entire file. It might be better to do this
yourself (ReadFile, ForEach with split, WriteFile) if many values are modified.
Example:
IniWrite( "\My documents\test.ini", "Settings", "Test", "x" )

Quote:

IniWrite( "\path to file\sys.txt", "gps", "port", IniRead( "\path to file\gps.ini", "gps", "port") )
IniWrite( "\path to file\sys.txt", "gps", "band", IniRead( "\path to file\gps.ini", "gps", "band") )

10th July 2012, 12:23 PM   |  #4255  
kastel71's Avatar
Senior Member
Thanks Meter: 27
 
117 posts
Join Date:Joined: Dec 2008
Thank you!!!
31st July 2012, 07:03 AM   |  #4256  
Mister B's Avatar
Senior Member
Flag Ratchada (Bangkok)
Thanks Meter: 337
 
1,877 posts
Join Date:Joined: Sep 2006
More
tmail.exe ActiveWindow
on Wm6.5 what is the active window title for tmail sms & email accounts.
trying to map a buttons function for specific use while in sms & accounts but can't get ActiveWindow command to recognise tmail.
31st July 2012, 09:58 AM   |  #4257  
bbobeckyj's Avatar
Senior Member
Flag dorset
Thanks Meter: 6
 
959 posts
Join Date:Joined: Aug 2006
More
Quote:
Originally Posted by Mister B

on Wm6.5 what is the active window title for tmail sms & email accounts.
trying to map a buttons function for specific use while in sms & accounts but can't get ActiveWindow command to recognise tmail.

What happens when you use get active window?
31st July 2012, 12:00 PM   |  #4258  
Mister B's Avatar
Senior Member
Flag Ratchada (Bangkok)
Thanks Meter: 337
 
1,877 posts
Join Date:Joined: Sep 2006
More
i'm using SMS / MMS as window title & with ElseIf ActiveWindow SMS / MMS it does not see tmail window active & carries out another base command from the script.
31st July 2012, 12:02 PM   |  #4259  
jwoegerbauer's Avatar
Senior Member
Bavaria (Germany)
Thanks Meter: 197
 
576 posts
Join Date:Joined: Jul 2009
Quote:
Originally Posted by Mister B

i'm using SMS / MMS as window title & with ElseIf ActiveWindow SMS / MMS it does not see tmail window active & carries out another base command from the script.

See also here:
http://forum.xda-developers.com/showthread.php?t=313461
31st July 2012, 12:07 PM   |  #4260  
bbobeckyj's Avatar
Senior Member
Flag dorset
Thanks Meter: 6
 
959 posts
Join Date:Joined: Aug 2006
More
What happens when you use this script while tmail is active?

Sleep (5000)
Aw = activeWindow ()
Message (aw)


I recently gave up my HD2 as it started to die so unfortunately I can't test this myself, but I did keep a backup of all my WM6.5 stuff, I'm just checking through it...

Post Reply Subscribe to Thread

Tags
mortscript, mortscript examples
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes