PDA

View Full Version : [SCRIPT] Shortkeycode.nrx



joci2000
28-04-2005, 10:31 AM
Hi Everybody,

Here is the script as i said it is working with almost all phones except 6210 and 7110.

So you can add as many shortkey as you want up to 255 just you have to apply this script many times.
But you have to use after eachother.

You need to use agrument. First the shorkeycode like *555 and after it the exact 5e0 id or definition name.

Version 1.5 now should clear the running code.
on 3310 seems not work correctly sometimes :-( but why :???:. I tested on 3330 and works correct

Other thing: this same version now seem to work correctly :???: also on 3310 :roll: it is misterious :eek:

yak
28-04-2005, 01:55 PM
new 5E0 ids are 16bit, that means we have about 65000 additional ids.

what problem do you have with long 5E0 ids? if you're using send_message() simply call send_message(0x45e0,long_id); there is no diffrence here.

if you want to handle DEFinitions, take a look at write_main_menu.nrx how the definition environment pool variables are organized, shortly it looks like this:

def/definition_name/msg (message to be send)
def/definition_name/arg (message's argument)

these are the two you should be interested in. simply check if definition's msg equals x2d(5e0) and if yes, use arg as 5E0 id.

i haven't test your script but if you cannot call for example alarm clock from your shortcode, you have to call following function after sending 5e0 message:

send_message(MSG_MENU_SHORTKEY_INFO|MSG_2P,id,0);

id is the 5e0 id you've called.

i had such a problem with my shortkeys.nrx, it took me quite a long time to track this one...

cheers
yak

joci2000
28-04-2005, 02:28 PM
new 5E0 ids are 16bit, that means we have about 65000 additional ids.

...

i had such a problem with my shortkeys.nrx, it took me quite a long time to track this one...

cheers
yak

thx your answer i will try to improve my script..
I don't try to write the code in C because something has not been clear for me yet.about messages (but i saw your homepage and i will learn from your dct-3 sdk thx for this).
I simply use arm codes to myscript like:
2130 MOV R1 "30"

and my problem was with this that how could i use MOV to longer ids for example with
A1xx -> MOV to address ?

I will try to rewrite in C
Thx again your answer.

I will upload the new one when it is ready

joci2000
28-04-2005, 06:53 PM
Hi

Ok here is the newest one long 5e0 supported..
but the text ids still not.
Yak could you help me a little more about the def finding

thx


Link removed

NokDoc
28-04-2005, 08:42 PM
Mr. Joci,

Thanks

Especially for Ur enthousiasm. ;)

NokDoc

yak
05-05-2005, 02:02 AM
like i said, definitions are groups of envpool variables. their structure looks like this:

def/<def_name>/title
def/<def_name>/desc
def/<def_name>/msg
def/<def_name>/arg
def/<def_name>/flags
def/<def_name>/action

where <def_name> is the name of a definition. so, if variable name contains the name then you can obtain for example MSG value by calling:

msg=getenv("def/"||name||"/msg")

(REXX allows you in such a case to omit these || if you want)

most of the fields are important for building menu items, as i said before in your case most important are msg and arg.

hope i helped...
yak

joci2000
05-05-2005, 07:23 AM
like i said, definitions are groups of envpool variables. their structure looks like this:

def/<def_name>/title
def/<def_name>/desc
def/<def_name>/msg
def/<def_name>/arg
def/<def_name>/flags
def/<def_name>/action

where <def_name> is the name of a definition. so, if variable name contains the name then you can obtain for example MSG value by calling:

msg=getenv("def/"||name||"/msg")

(REXX allows you in such a case to omit these || if you want)

most of the fields are important for building menu items, as i said before in your case most important are msg and arg.

hope i helped...
yak

Thx, I hope too. I will try something with this. ;)

joci2000
05-05-2005, 08:09 AM
So I finally could do it.

Big thanks to Yak who helped me how should i do it.

News: Text ids supported

Link removed

yak
05-05-2005, 05:44 PM
Superb!

This script can already be found in NokiX Archive on my page.

Keep it up!
[Yak]

szczuru
09-05-2005, 01:05 PM
joci2000, can you make new version of this script whit changes:
-Support for DEF's
-Support for other func. tables (table=0x322 func=0x00) is Immediately Power Off Phone

yak
09-05-2005, 01:43 PM
there is no such a thing as "other func tables". 5E0 is a message id, it's arg is an index in table of functions, 322 is also a message id, it has no arg (i.e. it is ignored). in other words, 5E0, 322, 226 and so on are messages id, whenever the arg is used and its meaning depends on the message id.

joci2000
09-05-2005, 04:55 PM
joci2000, can you make new version of this script whit changes:
-Support for DEF's
-Support for other func. tables (table=0x322 func=0x00) is Immediately Power Off Phone

Well in V1.2 text ids which means definitons are supported.

And for your second question.
well i don't know a lot of about this.

Yak could we locate the other message ids' table somehow?
i mean that for example the games messages id tables, because it has some args.

Thx


ßY3

joci2000
11-05-2005, 02:41 PM
Hi everybody,

i find some problem with my script.

If you use this script sometimes give error for some defs. Here is the soultion for this problem.

change this line

if msg>1000 then do; textid=getenv("def/"||name||"/arg");id=textid;id1=d2x(id);end
if msg<1000 then do;id=x2d(id1);end

to


if msg>1 then do; textid=getenv("def/"||name||"/arg");id=textid;id1=d2x(id);end
if msg<1 then do;id=x2d(id1);end

and it will work

bye

yak
13-05-2005, 10:52 AM
tracing messages isn't easy. UI task disassembling discovers some of them, please check my script dump_msg_processing.nrx (should be in _test directory in last snapshot), it will display some things that are done for some messages based on mr. nok5rev discoveries (greetings if you're reading this :)).

joci2000
13-05-2005, 12:26 PM
Thx your answer.

joci2000
15-05-2005, 05:02 PM
Here is a new version of my script.

There is some small changes only.

1.3 -support number of shortkeys up to 255
-msg problem solved for defs

link removed

CooBek
19-05-2005, 05:53 PM
Hi there! Thank You joci2000 for this script, but latest version doesn't work completely on my 6.33 NHM-5 :( I used some shortkeycodes with defs and 5e0s and nothing from it :( Maybe it is problem - i changed original shortkey code *#0000# to *#9999# and i added new shortkeycode*#0000# with other argument.

joci2000
19-05-2005, 07:22 PM
Hi there! Thank You joci2000 for this script, but latest version doesn't work completely on my 6.33 NHM-5 :( I used some shortkeycodes with defs and 5e0s and nothing from it :( Maybe it is problem - i changed original shortkey code *#0000# to *#9999# and i added new shortkeycode*#0000# with other argument.

Hi CooBek,

yes that is the problem that you rewrite the *#0000# func to 9999, because this script will clone this func to another place, to inject some jumps. if you rewrite it to 0000 and run this script the *#0000# func will be in new place.
there is a finding func in the first of this script which need *#0000#.

so you should write it back to 0000 and after when new func has been maked you can write it to 9999 again. ;)

CooBek
19-05-2005, 07:42 PM
Ok, thanks for reply

But another error got showed in nokix after compiling:



# Processing: shortkeycode.nrx *#12345 default_seccode
# 104 +++ id=x2d(id1)
# Error 15 running "E:\Program\NokiX\scripts\shortkeycode.nrx", line 104: Invalid hexadecimal or binary string
# Error 15.3: Only 0-9, a-f, A-F, and blank are valid in a hexadecimal string; found "u"

# ERROR: Script failure!
:\

joci2000
19-05-2005, 07:58 PM
Ok, thanks for reply

But another error got showed in nokix after compiling:



# Processing: shortkeycode.nrx *#12345 default_seccode
# 104 +++ id=x2d(id1)
# Error 15 running "E:\Program\NokiX\scripts\shortkeycode.nrx", line 104: Invalid hexadecimal or binary string
# Error 15.3: Only 0-9, a-f, A-F, and blank are valid in a hexadecimal string; found "u"

# ERROR: Script failure!
:\


hmm yes you are right. this will use 5e0 id and as i see it is not supported but why? i will make a new script which will support it.

here it is

link removed

ShadoW2004
01-10-2005, 12:29 PM
Why shortkeycode.nrx not supporting definitions like multiple_main_menus/toggle ?



# Processing: shortkeycode.nrx *6368 multiple_main_menus/toggle
# 104 +++ id=x2d(id1)
# Error 15 running "D:\Programs\Nokia\Moding\NokiX\scripts\shortkeycode.nrx", line 104: Invalid hexadecimal or binary string
# Error 15.3: Only 0-9, a-f, A-F, and blank are valid in a hexadecimal string; found "m"

# ERROR: Script failure!

eleoson
02-10-2005, 03:19 PM
hello i want to create shortcut key without # in the end, something like #1, #0 is this possible?

joci2000
02-10-2005, 05:35 PM
Why shortkeycode.nrx not supporting definitions like multiple_main_menus/toggle ?

Hi ShadoW2004,

well as I see the write main menu script will add this function to the phone at the end, so when you try to add it with shortkeycode this function is not available yet and this is the reason for this problem.

@eleoson

the shortkeycode function is originally on firmware, what this script doesn't modify, so you need to press # at the end of every code.

ShadoW2004
03-10-2005, 04:50 AM
And how to decide this problem?

joci2000
03-10-2005, 11:37 AM
And how to decide this problem?

well if you see the processing list you will see something like this when the nokix run the write_menu.nrx : save menu file for lately process or something simmilar to this.

it just save the menu file and it doesn't insert any new function into the firmware.

when the nokix run the "THE END" processes, then will insert the main menu function and the toggle function also.

the only way to solve this problem is to insert a line into the shortkeycode.nrx, which tell to nokix to run shortkeycode at "THE END" processes, after write_menu.nrx. you can do this with lower number than write_menu has.

the line should look like this:

RUNATEND "shortkeycode.nrx" "THE_END" (-10000);exit
you have to insert it before any process.

bye

eleoson
03-10-2005, 12:52 PM
hi great script, i have managed to create a shortcut to write message using #1#

offtopic:
is it possible to automatically clear screen on write message, because everytime i go to write message the previous message i wrote is still there.

joci2000
03-10-2005, 01:00 PM
hi great script, i have managed to create a shortcut to write message using #1#

offtopic:
is it possible to automatically clear screen on write message, because everytime i go to write message the previous message i wrote is still there.

everything is possible ;) but we should rewrite the maincode structure for it :S so if more ppl want it i will rewrite :D

ShadoW2004
03-10-2005, 03:36 PM
well if you see the processing list you will see something like this when the nokix run the write_menu.nrx : save menu file for lately process or something simmilar to this.

it just save the menu file and it doesn't insert any new function into the firmware.

when the nokix run the "THE END" processes, then will insert the main menu function and the toggle function also.

the only way to solve this problem is to insert a line into the shortkeycode.nrx, which tell to nokix to run shortkeycode at "THE END" processes, after write_menu.nrx. you can do this with lower number than write_menu has.

the line should look like this:

you have to insert it before any process.

bye


I inserted RUNATEND "shortkeycode.nrx" "THE_END" (-10000);exit before:



pool="ENVIRONMENT"
vb=value("sys/verbose",,pool)
parse arg args


But in the end it is write:

# Processing: MENU.rx THE_END
Processing menu file: D:\NokiX\menu_user.txt
Processing menu file: D:\NokiX\menu_pro.txt
Done!

# Processing: shortkeys.nrx THE_END
Shortkeys file: D:\NokiX\shortkeys.txt
Found 8 keys definitions
Inserting shortkeys code...
Done!

# Processing: CREATE_CONFIG_ID.rx THE_END
Number of IDs created: 36 nonvolatile and 2 volatile
Creating configs EEPROM table entry...
Together, the configs take 20 bytes from EEPROM.
Done!

# Processing: ADD_5E0_ID.rx THE_END
Number of original entries: 187 (0xBB)
Number of added entries : 41 (0x29)
Total number of entries : 228 (0xE4)
Updating original table...
Creating additional table...
Patching 5E0 handling functions...
Done!

# Processing: ADD_PPM_STRINGS.rx THE_END
Original strings count: 1384
Number of added strings: 193
Adding strings...
Done!

# Processing: HOOK_INTO_TASK_0.rx THE_END
Number of hooks: 2
Done!

# Processing: EEPROM.rx THE_END
Updating EEPROM table in flash.
Adding 2 entries to the table.
Done!

# Processing: ADD_BITMAP.rx THE_END
Adding 1 bitmaps to system...
Done!

# Processing: RESERVE_RAM.rx THE_END
Reserved 201 (0xC9) bytes in 37 blocks.
Defaults mechanism used by 6 blocks.
Reserved blocks contain 1 bytes of gaps.
Done!

# Processing: PPMAN.rx THE_END
Rebuilding PPM block...
Done!

# Processing: shortkeycode.nrx THE_END

# Processing: shortkeycode.nrx THE_END

# Processing: shortkeycode.nrx THE_END

# Processing: shortkeycode.nrx THE_END

# Processing: shortkeycode.nrx THE_END

... etc :(

joci2000
03-10-2005, 05:21 PM
I inserted RUNATEND "shortkeycode.nrx" "THE_END" (-10000);exit before:



But in the end it is write:
...
# Processing: shortkeycode.nrx THE_END

... etc :(

as i see the problem is that nokix with runatend command could give only one parameter for script (in this case "THE END") :( or we don't know how to use it :( . may be Yak could help us to solve this.

yak
05-10-2005, 10:17 AM
an excerpt from dev_reference.txt


NAME
RUNATEND - add script execution to the end of list

SYNOPIS
RUNATEND <script>
RUNATEND <script> <params>
RUNATEND <script> <params> <priority>

FUNCTION
Adds script execution to the end of NokiX processing list (virtualy, the
script isn't actualy added to the project). You can specify the script
parameters and execution priority.

INPUTS
script
Name of script to execute.

params
Script parameters.

priority
Priority of this script in all "runatend" added scripts.
Greather value causes the script to be executed earlier.
Range: -1000 ... 1000
Default: 0

RESULT
None.

EXAMPLE
RUNATEND "my_script.nrx" "THE_END" (-100)

NOTES
This feature is usefull if you want to make some additional processing
when all scripts from the processing list are done.

the command always adds one script execution. this means that if you call it in the execution it added, it will add another one and the thing will be looped. to avoid this, you have to use runatend command ONLY in first script execution (when your script was called first time from processing list).

as an example we'll take the ADD_BITMAP.rx script.

at the very beginning of the code (after the comment) you can see:


if getenv("add_bitmap/count")="" then do /* first time */
call value "add_bitmap/count",0,pool
parse source . . script
runatend '"'script'"' "THE_END" (-160)
end

every not initialized environment pool variable has a value of "" by default. this is used here to detect, that the "add_bitmap/count" variable wasn't set yet. it is however set inside the IF-END clause so the condition CAN'T be true more than once. inside the clause we see our runatend command too. this also means, that it will be executed ONLY ONCE, in the very first script execution. the "add_bitmap/count" value itself is used then to count the number of added bitmaps (this is increaded every script call and used in the THE_END call).

all my scripts using runatend command use it together with PARSE SOURCE . . script, this instruction obtains the full path of the script it is used in. this is passed then to runatend, thanks to the "'", the path is enclosed in quotes so it is safe to have spaced in it.

passing more than one parameter is possible too. the only thing is that you have to surround all of them together with quotes. this is beacause there is virtualy only 1 parameter (nokix has also only one parameter field). but you can use PARSE ARG a,b,c to separate comma-delimetered parameters into separate variables.

hope i've cleared some things
yak

joci2000
23-03-2006, 06:00 PM
New version is available on the first post

V1.5 should clear the running code also :roll:

thx Bütyök for the clear routine ;)

on 3310 seems not work correctly :-(

druidbartek
08-04-2006, 01:38 PM
hi
@joci2000, i think U forgotten add this line to your script (only needed in newest version)

call locate "firmware_type"; type=result
:D
now it work on my 5510 also ;)

joci2000
08-04-2006, 05:27 PM
hi
@joci2000, i think U forgotten add this line to your script (only needed in newest version)

call locate "firmware_type"; type=result
:D
now it work on my 5510 also ;)

Hi

oops the only thing what i forget is to upload the newest version:roll:. I also noticed this bug and i solved it after the buggy one. Just i forget to upload. sorry 4 any inconvenience.

I now upload it,

thx for the tip ;)

newknaber
08-04-2006, 11:16 PM
tnx and more power!