FORUMS

How To Port Fully Featured Sony Xperia Z4 Camera

Xperia Z4’s hardware may not impress, but its software is definitely … more

Experimental TWRP Available For Moto G 2015

XDA Senior Member squid2 has posted experimental builds of TWRP for the Moto G … more

Sunday Debate: How Can We Get a No-Compromise Phone?

Join us in a fun Sunday Debate on Compromises. Come with your opinions and … more

PSA: You Can Optimize Your Note 4’s Recents Menu & RAM

The Note 4 never had the fastest Recents Menu, and despite its 3GB of RAM, … more

MortScript examples accumulation

415 posts
Thanks Meter: 75
 
By Mort, Senior Member on 9th January 2007, 07:26 AM
Post Reply Subscribe to Thread Email Thread
20th February 2012, 04:23 PM |#4241  
michoob's Avatar
Retired Recognized Developer
Flag Brussels
Thanks Meter: 64
 
Donate to Me
More
Hi mariasx, I don't think your problem comes from the "foreach record in Array", but rather from the massive amount of string operations (Replace, Find, SubStr, Split)!
There is definitly something to do around these string operations...

I do not have much time to spend, but an idea might be trying to recode the whole script to avoid using all these string operations, but to use the IniRead and IniWrite functions and to store your data in a .ini file, where you would have a .ini section per your current csv column, and a code for each task... not sure if it would be better.
 
 
21st February 2012, 02:57 PM |#4242  
Junior Member
Flag Bratislava
Thanks Meter: 1
 
More
Hi michoob

1. Thank you for answer. I did not change data(Strings operations). I tried to display different lists(Foreach record in Array) and performance was decreasing. So I think there is problem with memory and I do not know how to handle it.

2. How do you think data should be designed in INI file?

like that?

[lorem]
desc=Nam posuere iaculis
status=n
context=movies

[ipsum]
desc=pretium eu leo
status=n
context=movies
22nd February 2012, 08:30 AM |#4243  
michoob's Avatar
Retired Recognized Developer
Flag Brussels
Thanks Meter: 64
 
Donate to Me
More
1. I do not say you change the data, but you obviousely use string operations for the display in your Foreach loop, and that is why performance is decreasing. And it is not decreasing because of memory, but rather because of CPU...
You might try to use MortScript 4.3b15 if not already the case, because it is faster.

2. Nope, I would rather see it like this, but then, the data is of course less readable than a csv file (but do yo care?):
[reference]
1=lorem
2=ipsum

[desc]
1=Nam posuere iaculis
2=pretium eu leo

[status]
1=n
2=n

[context]
1=movies
2=movies
28th February 2012, 04:13 PM |#4244  
RoryB's Avatar
Recognized Developer
Flag Lexington
Thanks Meter: 758
 
Donate to Me
More
Sad to go
My Fuze no longer works. I currently have a loner Infuse 4G, but do not know what I will end up with.

I will not be able to continue development of Mortscripts, etc.

Sorry to go, but it has been fun.

I'll keep watching to see if anything comes up I need to respond to.
28th February 2012, 08:14 PM |#4245  
Junior Member
Flag Bratislava
Thanks Meter: 1
 
More
so long RoryB
RoryB, it's a pity see You leaving. What will be Mortscript replacement for you? Are you looking for it?
28th February 2012, 08:44 PM |#4246  
RoryB's Avatar
Recognized Developer
Flag Lexington
Thanks Meter: 758
 
Donate to Me
More
Quote:
Originally Posted by mariasx

RoryB, it's a pity see You leaving. What will be Mortscript replacement for you? Are you looking for it?

The loaner is a Droid, but I do not know what I'll end up with. So I am in limbo.
28th February 2012, 09:06 PM |#4247  
bbobeckyj's Avatar
Senior Member
Flag dorset
Thanks Meter: 8
 
More
Quote:
Originally Posted by RoryB

The loaner is a Droid, but I do not know what I'll end up with. So I am in limbo.

Sell it on eBay and get yourself whatever you want.
28th February 2012, 09:23 PM |#4248  
Junior Member
Flag Bratislava
Thanks Meter: 1
 
More
Quote:
Originally Posted by RoryB

The loaner is a Droid, but I do not know what I'll end up with. So I am in limbo.

I have an Android device too. For a six months I am still looking for Mortscript replacement for Android. I found some candidate like BASIC! + SQL. Even better could be Frink Programming Language but it still do not adequately meets Mortscript quallities.

I need one programming language for phone and desktop and Java is not what I am talking about. Adobe Flex is also an possible alternative.

Maybe Windows 8 will be salvation because it is Intel and also Arm processor compatible. I am curious.
11th March 2012, 11:56 AM |#4249  
lesscro's Avatar
Senior Member
Flag paris
Thanks Meter: 1,882
 
Donate to Me
More
Thx for all RoRyB... you help lot of time and insipre me more than lot of time...

See yaaa in other place...
8th April 2012, 07:02 PM |#4250  
jwoegerbauer's Avatar
Senior Member
Bavaria (Germany)
Thanks Meter: 206
 
More
Lightbulb Searching for control structure errors
I have a script with ~3,300 lines. Script is organized in parts MAIN and SUBS. Suddenly got error "Sub must not be in control structure". I know this errror only occurs if If/EndIf is not matching. Re-reading the script again and again I didn't find the missing EndIf. Hence decided to write a small script as listet next to make searching for the error cause easier
Code:
local()
Thoght I should share this script.
Last edited by jwoegerbauer; 9th April 2012 at 07:56 AM.
20th April 2012, 07:56 PM |#4251  
Member
Thanks Meter: 4
 
More
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.

Read More
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


Top Threads in Windows Mobile Software Development by ThreadRank