How to make Mortscript write variable to txt? - Windows Mobile Development and Hacking General

How to make Mortscript write "x=0 Freememory()" variable to a txt file?
Is it possible?

x=FreeMemory()
WriteFile("\filename.txt",x)
Will create a file called filename.txt on the root of the device, with the free memory value in it.

Wow that was embarrasingly simple! Thanks alot!

Related

Help With Mortscript

Ive installed Mortscript on my phone and would love to know how to write this as a command
Start Resco Registry Editor
Delete String??
Simple as that,
A little help please?
fantastic_mr_q said:
Ive installed Mortscript on my phone and would love to know how to write this as a command
Start Resco Registry Editor
Delete String??
Simple as that,
A little help please?
Click to expand...
Click to collapse
OK i dont know what you meant by delete string but
the start command is pretty easy
make a simple text file with the script
#script starts here
run "\Program Files\Resco\Resco Registry Editor.exe"
#end script
#leave the quotes and replace the command inside to the quotes to whatever the path to the executable is.
rename the text file to .mscr and then you can run it.
OR...
you could read the mortscript manual and realise that it can edit the registry its self...
look a posted hack/patch i made for musicID in the XDA Devs general forum, in there you will see how to delete a registry string from morscript.
also you might get more help on morscript at the mortscript forum...

Deny or restrain installation of applications WM5

I want to deny or restrain installation of applications on the fly as an service/process or by making changes in the registry on WM5 devices. Any ideas? The app preferely in C++/C#
CAB files are installed by wceload.exe in the windows directory.
You can overwrite this file with a blank exe, or remove the CAB extension reference to it in registry under HKEY_CLASSES_ROOT.
Deny or restrain inst. of apps
Thanks, yes I've thought about this - but this isn't a very dynamic solution. When a person run a CAB I want to check if app is okay to install from a "List" - then show a popup with a message saying something like "Sorry, you are not allowed to install this application. Please contact your company IT Admin for more info".
Is the .CAB association in HKEY_CLASSES_ROOT linked to wceload - so I could run an app to validate CAB, and if ok execute wceload..?
levenum said:
CAB files are installed by wceload.exe in the windows directory.
You can overwrite this file with a blank exe, or remove the CAB extension reference to it in registry under HKEY_CLASSES_ROOT.
Click to expand...
Click to collapse
Write up a registry entry in HKEY_CLASSES_ROOT to associate .CAB files with your custom file. Then, when the user taps on a CAB file, your program reads it, compares it against its list and, if it's approved, calls WceLoad with the appropriate parameters.
The key would probably look something like this:
HKCR\cabfile\shell\open\command
(default) = "<path to your app>" "%1"
(%1 will be replaced with the path to the CAB file).
Then, if the CAB was approved, call WceLoad with the following parameters:
\windows\wceload.exe "<path to cab file>" /nodelete
Note that some apps, may call wceload.exe directly. I am not sure if Activesync does it, but I know a couple of custom installers that do.
If you really want to secure the device against unothorized software do the following:
Rename wceload.exe to something else like wceload1.exe.
Create you own wceload.exe, but make sure you capture and preserve all command line parameters in case you need to transfer them to the original file for proper installation.
This way you can be sure no one will install anything without your permission.
Olso, keep in mind wceload is used to switch themes as well. (It handles *.tsk files).
Very much..
Thank You all!!

simple mortscript question, to the mortscripters?

i know there are a lot of mortscipt experts on this forum. so i guess i should ask it here.
OK i have looked through the threads, google and the mort script manual but i cant find a way to extract the size of a file. i know i can see it under file properties. but is there a script to extract the file size.
thanks
joe
Its in the manual:
9.13.3 Get file size (FileSize)
x = FileSize( file name )
Returns the size of the file in bytes.
Furbious said:
Its in the manual:
9.13.3 Get file size (FileSize)
x = FileSize( file name )
Returns the size of the file in bytes.
Click to expand...
Click to collapse
Thank you very much, i do remember reading that but coudnt figure out the syntax for the script.
joe
Furbious said:
Its in the manual:
9.13.3 Get file size (FileSize)
x = FileSize( file name )
Returns the size of the file in bytes.
Click to expand...
Click to collapse
spoke too soon that is "not a valid function". and
9.13.3 returns file attributes like hidden,system file,read only file etc.(check attributes under file >>properties)
i need the file size.
so does anyone have another idea.
I don't think you are using the right syntax, or theres something wrong with your code.
Code:
x=filesize("\storage card\testfile.txt")
message(x)
Pops a message dialogue with the filesize, no errors
Furbious said:
I don't think you are using the right syntax, or theres something wrong with your code.
Code:
x=filesize("\storage card\testfile.txt")
message(x)
Pops a message dialogue with the filesize, no errors
Click to expand...
Click to collapse
I tried this exact script with mortscript 4 and it says
"Unknown function filesize"
i guess there is some different funtions in your version, I am using mortscriptv4, is yours different than mine?
and can someone else please try this simple script out and provide some feedback?
thankyou
joe
Get the newest version of MortScript at http://www.sto-helit.de/index.php?module=download&action=list&category=16
Currently newest is MortScript 4.01 beta 19

A tutor to write simple 'batch' script (cab)?

Hello,
I am going to write a simple script, which I am going to launch on my smartphone. This script will do some easy operations:
- copy some files from card to phone (even with 'hidden' attribute)
- modify some keys/variables in registry
- add spme keys/variables into registry
Would you tell me please where I can find a tutor to make such cab files?
Thanks in advance
best greetings!
RA
Mortscript
Looks nice, but...
joemanb said:
Mortscript
Click to expand...
Click to collapse
Thanks for your answer! But please tell me, is it the tool with they make all 'cab' files with '_setup.xml' inside? How they do such cab-s?
RA

[SOLVED]How to create a shortcut for mortscript

hello to all i have created a mortscript but i did not able to create a shortcut in startmenu with packages maker.....will anyone please help me how to create a shotcut with mortscript because packages maker only show the "exe" files.
thanks to all
1#"\Windows\Connections_OFF.mscr"
Like that. Just put in your script name, put it in a .txt file and change the extension to .lnk.
Total Commander is a great tool for making links.
Since you're using mortscript, you can also use the createshortcut command to make the shortcut, like this:
Code:
CreateShortCut("\Windows\Start Menu\Programs\MortScript\RestoreWeather.lnk","\Windows\RestoreWeather.mscr")
Farmer Ted said:
1#"\Windows\Connections_OFF.mscr"
Like that. Just put in your script name, put it in a .txt file and change the extension to .lnk.
Total Commander is a great tool for making links.
Since you're using mortscript, you can also use the createshortcut command to make the shortcut, like this:
CreateShortCut("\Windows\Start Menu\Programs\MortScript\RestoreWeather.lnk","\Windows\RestoreWeather.mscr")
Click to expand...
Click to collapse
thanks for ur reply when i add like this in my created script it does not create a shortcut
any solution??????
I didn't have the script in code tags, so it had a space in the second 'windows'; maybe that was the problem. It should work fine; my whole start menu (100+ shortcuts) is created that way. You just need to have the correct path to the script you want linked.
are i add these entries ina rgu or in my created script
They go in a mortscript; you also need to put an EXEC command into an add2config.txt file to get the script to run (and mortscript has to be cooked in).
Farmer Ted said:
They go in a mortscript; you also need to put an EXEC command into an add2config.txt file to get the script to run (and mortscript has to be cooked in).
Click to expand...
Click to collapse
Thanks once again ....i put m'y scripts into m'y Windows folder and i havé created a new note.txt and i add m'y entries like u havé marked and i rénamed thé txt to mscr but when i want to test thé script before cooking it gives a error ...i havé mortscript installed ...Will i add some thing Else in m'y script or ...is it possible to upload a sample script for creating shortcut?
Do the cheaters method, and find your file in the windows directory of your device, then select and copy, finally paste as shortcut in storage card. Move shortcut off storage card. Done.
indagroove said:
Do the cheaters method, and find your file in the windows directory of your device, then select and copy, finally paste as shortcut in storage card. Move shortcut off storage card. Done.
Click to expand...
Click to collapse
ok but i want to create a shortcut in my kitchen for cook with
shafizal said:
Thanks once again ....i put m'y scripts into m'y Windows folder and i havé created a new note.txt and i add m'y entries like u havé marked and i rénamed thé txt to mscr but when i want to test thé script before cooking it gives a error ...i havé mortscript installed ...Will i add some thing Else in m'y script or ...is it possible to upload a sample script for creating shortcut?
Click to expand...
Click to collapse
What's the error? I'm guessing there's just some syntax that's off. You should try each script one at a time (comment out all but one at a time with #'s).
Farmer Ted said:
What's the error? I'm guessing there's just some syntax that's off. You should try each script one at a time (comment out all but one at a time with #'s).
Click to expand...
Click to collapse
now its ok bro ur entries worked now and i added into config.text now its creates the shortcuts automatically after flash.....
thank u very much for ur help from begin..

Categories

Resources