Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,737,675 Members 46,024 Now Online
XDA Developers Android and Mobile Development Forum

MortScript examples accumulation

Tip us?
 
vivekiny2k
Old
(Last edited by vivekiny2k; 20th April 2012 at 08:04 PM.)
#4251  
Member
Thanks Meter 3
Posts: 59
Join Date: Oct 2010
Quote:
Originally Posted by mwalt2 View Post
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:
Select 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:
Select 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
 
vivekiny2k
Old
#4252  
Member
Thanks Meter 3
Posts: 59
Join Date: 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:
Select 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
 
kastel71
Old
#4253  
kastel71's Avatar
Senior Member
Thanks Meter 27
Posts: 117
Join Date: Dec 2008
Default [HELP] how can I ...in Mortscript

I have a "gps.ini" file these parameters:
Code:
Select Code
Port = 4
Baudrate = 56000
And I have a "sys.txt" file these parameters:
Code:
Select 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?
 
RoryB
Old
#4254  
RoryB's Avatar
Recognized Developer
Thanks Meter 680
Posts: 2,765
Join Date: Sep 2008
Location: Lexington

 
DONATE TO ME
Quote:
Originally Posted by kastel71 View Post
I have a "gps.ini" file these parameters:
Code:
Select Code
Port = 4
Baudrate = 56000
And I have a "sys.txt" file these parameters:
Code:
Select 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") )
AT&T Samsung Galaxy S III running Quantum.4
Read About Me to see what I am working on & following like CHTS, Reminder and AppTask widgets, and CHT basic function tweaks. Also, Fixed CHT restarting when you have no tasks.
Mortscript | iniEditor | regEditor| MortScripts to toggle settings
Samsung Infuse 4G drowned. If you have one check out Scott's CM10 or CM10PA Firmware
ATT Fuze (HTC RAPH110) with Energy ROM: Energy.RAPHAEL.29022.Sense2.5.Cookie.2.0.Jul.06
HTC Wizard|See about me for my ROM collection and other work
 
kastel71
Old
#4255  
kastel71's Avatar
Senior Member
Thanks Meter 27
Posts: 117
Join Date: Dec 2008
Thank you!!!
 
Mister B
Old
#4256  
Mister B's Avatar
Senior Member
Thanks Meter 331
Posts: 1,847
Join Date: Sep 2006
Location: Ratchada (Bangkok)
Default 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.
[DEVICE1] : [HD2] [EU late model, socket lcd & samsung nand]
[ROM] : [Energy Dinik 23699 Nov24]
[OS] [WindowsMobile® 6.5.x][CHT2.0.S2.5]
[RADIO] : [2.12.50.02_2]

[DEVICE2] : [Raphael] [sold]
[ROM] : [Energy Dinik 23699]
[OS] [WindowsMobile® 6.5.x]
[RADIO] : [1.14.25.05 + RILPHONE.DLL]
.
[SOFTWARE] : [Mortscript] [MyMobiler] [CeRegEditor] [SkypeMobile] [FingerKBD Eng/Thai (WVGA)] [Thai Font/Input SIP] [IM+]
 
bbobeckyj
Old
#4257  
bbobeckyj's Avatar
Senior Member
Thanks Meter 6
Posts: 961
Join Date: Aug 2006
Location: dorset
Quote:
Originally Posted by Mister B View Post
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?
 
Mister B
Old
#4258  
Mister B's Avatar
Senior Member
Thanks Meter 331
Posts: 1,847
Join Date: Sep 2006
Location: Ratchada (Bangkok)
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.
[DEVICE1] : [HD2] [EU late model, socket lcd & samsung nand]
[ROM] : [Energy Dinik 23699 Nov24]
[OS] [WindowsMobile® 6.5.x][CHT2.0.S2.5]
[RADIO] : [2.12.50.02_2]

[DEVICE2] : [Raphael] [sold]
[ROM] : [Energy Dinik 23699]
[OS] [WindowsMobile® 6.5.x]
[RADIO] : [1.14.25.05 + RILPHONE.DLL]
.
[SOFTWARE] : [Mortscript] [MyMobiler] [CeRegEditor] [SkypeMobile] [FingerKBD Eng/Thai (WVGA)] [Thai Font/Input SIP] [IM+]
 
jwoegerbauer
Old
#4259  
jwoegerbauer's Avatar
Senior Member
Thanks Meter 195
Posts: 568
Join Date: Jul 2009
Location: Bavaria (Germany)
Quote:
Originally Posted by Mister B View Post
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
My devices:
GPS: Windows Embedded CE 6.0 Professional
Phablet: Android 4.0.4
Laptop: Windows 8.1.1
Phone: Windows Phone 8.0
 
bbobeckyj
Old
#4260  
bbobeckyj's Avatar
Senior Member
Thanks Meter 6
Posts: 961
Join Date: Aug 2006
Location: dorset
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...

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

Advanced Search
Display Modes