MortScript examples accumulation

Search This thread

sudist

Senior Member
Jun 30, 2007
114
0
Perpignan
Mortscript on PC

Hello mortscripters,

I use this to connect my PC to my router :
exec="c:\windows\system32\netsh.exe"
params="wlan connect ssid=LesArcades name=LesArcades"
Run(exec,params)

It works fine, but a window is popping up!
Is it possible to hide this popup window?

Thanks for possible answers :)
 

RoryB

Inactive Recognized Developer
Sep 4, 2008
2,921
766
Lexington
Hello mortscripters,

I use this to connect my PC to my router :


It works fine, but a window is popping up!
Is it possible to hide this popup window?

Thanks for possible answers :)

You need the name of the window that pops up so you can close it with
Code:
Close( window )

You could add to your script this code to get the window name and then change to use that name in the code above.
Code:
sleep(2000)
ActiveWindow()

You might want to keep the sleep to wait a little for the window to finish opening before you try to close it.
 
D

Deleted member 1890170

Guest
You need the name of the window that pops up so you can close it with
Code:
Close( window )

You could add to your script this code to get the window name and then change to use that name in the code above.
Code:
sleep(2000)
ActiveWindow()

You might want to keep the sleep to wait a little for the window to finish opening before you try to close it.

Here (another?) code snippet to get the window name from current active process
Code:
Sub GetWindowFromProcess(exepth)
Local()
ret=""
wndarr=FindWindows("",ANYWHERE,0,1,0)
If(NOT IsEmpty(wndarr))
	ForEach wnd In Array(wndarr)
		If(ret EQ "")
			If(wnd NE "")
				If(exepth EQ WindowProcess(wnd,1))
					ret=wnd
				EndIf
			EndIf
		EndIf
		Sleep(1)
	EndForEach
EndIf
Return(ret)
EndSub
 

sudist

Senior Member
Jun 30, 2007
114
0
Perpignan
Hi jwoegerbauer,

Thanks for the answer, but I worked on my 'problem', and found another solution :)

In my script, I've put :

exec="c:\windows\system32\wscript.exe"
params="c:\WifiOn.vbs"
Run(exec,params)


And the WifiOn.vbs contains :

CreateObject("WScript.Shell").Run "netsh wlan connect ssid=LesArcades name=LesArcades", 0, True


No popup :)
Have a nice day Mortscripters
 

vivekiny2k

Senior Member
Oct 31, 2010
69
4
I just acquired an android phone. What's the best language to start scripting in android if I am coming from mortscript? I want to do things like call a number, pause, run an app, read files etc.

I would rather work with an interpreter than a compiler.
 

vivekiny2k

Senior Member
Oct 31, 2010
69
4
Wrote this to prefix each image file with it's modify date, so i can view them in correct order. I would have used create date but some of my older phones totally screwed that field up.

It looks crude because I put minimal time in it. it will need customization for each new folder. I could make it more intelligent but not inclined to put any more time that needed.

BTW, it works on PC too.

Code:
message("in")
ForEach found In Files("\storage card\DCIM\100MEDIA\I*.jpg")
    name=found
    createtime = formattime("Ymd",filemodifytime(found))
    newname10 = part(name,'\',2)
    newname11 = part(name,'\',3)
    newname12 = part(name,'\',4)
    newname1 = part(name,'\',5)
 #   newname2= part(newname1,'_',2) 
  #  newname3= part (newname2,'.',1)
   #  newname4= part(newname1,'_',1)
    # message(createtime)
    newname5= ('\' & newname10 & '\'& newname11 & '\'& newname12 & '\' & createtime & '_' & newname1)
    # 3 & '_' & newname4 & '.jpg')
    # message(found)    
    # message(newname5)
    rename(found,newname5)
#    exit    
EndForEach
 
D

Deleted member 1890170

Guest
fileMask="I*.jpg"
startDir="\storage card\DCIM\100MEDIA"
recurse=1

@RenameFiles(startDir,fileMask,recurse)

Sub RenameFiles(startDir,fileMask,recurse)
Local()
ForEach found In Files(startDir\fileMask)
time=FormatTime("Ymd",FileModifyTime(found))
name=FileBase(found)
newFullFilePathName=FilePath(found)&"\"&SubStr(name,1,1,)&time&FileExt(found)
Rename(found,newFullFilePathName)
Sleep(1)
EndForEach
If(recurse)
ForEach startDir2 In Directories(startDir\"*")
@RenameFiles(startDir2,fileMask,recurse)
EndForEach
EndIf
EndSub
 
Last edited by a moderator:

roker beriman

Member
Sep 22, 2010
49
29
Pekalongan - Indonesia
help me....

I want to write a registry value to a file.home.xml

example.home.xml =
__________________
<text label="H = 500" w="320" halign="center" x="0" y="3" font-weight="bold" />
_________________

I want to change "H = 500" with "H = "Reg Value""
I've use this :

__________________________
icon=ReadFile("\Application Data\Home\example.home.xml")
location=Find(icon,"H =")

loc=location + 3

name=SubStr(icon,loc,20)

janda=Part(name,"""",2)

Perawan=RegRead("HKLM", "Software\Microsoft\CHome\TitaniumWeather\Page1","H")

Copy("\Application Data\Home\example.home.xml","\Application Data\Home\example.home.xml")

test=ReadFile("\Application Data\Home\example.home.xml")
Jandakembang = Replace(test,Janda,Perawan)
SetFileAttribs("\Application Data\Home\example.home.xml",FALSE)
WriteFile("\Windows\janda.xml",Jandakembang)
Copy( "\Windows\janda.xml", "\Application Data\Home\example.home.xml", TRUE)
Delete("\Windows\janda.xml")

Message("Updating Weather... Enjoy!","ALERT")

______________________________


but it doesn't work as I want, the result of example.home.xml =

_______________
<text label="H = 500" 32°"320" halign="center" x="0" y="3" font-weight="bold" />
_____________

anyone can help me how to make the result become =
_________
<text label="H = 32°" halign="center" x="0" y="3" font-weight="bold" />
____________


thanks advance...
 

RoryB

Inactive Recognized Developer
Sep 4, 2008
2,921
766
Lexington
help me....

I want to write a registry value to a file.home.xml

example.home.xml =
__________________
<text label="H = 500" w="320" halign="center" x="0" y="3" font-weight="bold" />
_________________

I want to change "H = 500" with "H = "Reg Value""
I've use this :

__________________________
icon=ReadFile("\Application Data\Home\example.home.xml")
location=Find(icon,"H =")

loc=location + 3

name=SubStr(icon,loc,20)

janda=Part(name,"""",2)

Perawan=RegRead("HKLM", "Software\Microsoft\CHome\TitaniumWeather\Page1","H")

Copy("\Application Data\Home\example.home.xml","\Application Data\Home\example.home.xml")

test=ReadFile("\Application Data\Home\example.home.xml")
Jandakembang = Replace(test,Janda,Perawan)
SetFileAttribs("\Application Data\Home\example.home.xml",FALSE)
WriteFile("\Windows\janda.xml",Jandakembang)
Copy( "\Windows\janda.xml", "\Application Data\Home\example.home.xml", TRUE)
Delete("\Windows\janda.xml")

Message("Updating Weather... Enjoy!","ALERT")

______________________________


but it doesn't work as I want, the result of example.home.xml =

_______________
<text label="H = 500" 32°"320" halign="center" x="0" y="3" font-weight="bold" />
_____________

anyone can help me how to make the result become =
_________
<text label="H = 32°" halign="center" x="0" y="3" font-weight="bold" />
____________


thanks advance...
What is the value of RegRead("HKLM", "Software\Microsoft\CHome\TitaniumWeather\Page1"," H")?
Are there spaces on either side of the = symbol or am I just misreading that?
What about spaces between each item and previous quote? H = 500" w="320"
Are you trying to get rid of the "w=320" part?
 
  • Like
Reactions: roker beriman

roker beriman

Member
Sep 22, 2010
49
29
Pekalongan - Indonesia
What is the value of RegRead("HKLM", "Software\Microsoft\CHome\TitaniumWeather\Page1"," H")?
Are there spaces on either side of the = symbol or am I just misreading that?
What about spaces between each item and previous quote? H = 500" w="320"
Are you trying to get rid of the "w=320" part?

the value of HKLM/software/Microsoft/Chome/titaniumWeather is :
H = 33°

no, I just want to change the value of TextLabel="H = 500" with RegValue above.



I try to update Titanium weather on Facade Homescreen.
 

RoryB

Inactive Recognized Developer
Sep 4, 2008
2,921
766
Lexington
Does H always equal three digits in both locations?

Are there blank spaces?

Sent from my SAMSUNG-SGH-I747 using xda app-developers app
 
Last edited:
D

Deleted member 1890170

Guest
I'ld not process the .XML-file at a whole, but only the line related: Probably this can simplify things. Here my idea presented as a code snippet (untested so far!!!):

Code:
xmlFile="<full_file_path_name_here>"
regVal=""&RegRead("HKLM","Software\Microsoft\CHome\TitaniumWeather\Page 1","H")
If(regVal NE "")
	xmlRead=""&ReadFile(xmlFile)
	If(xmlRead NE "")
		xmlWork=Array()
		xmlLines=Split(xmlRead,"^NL^")
		If(ElementCount(xmlLines))
			index=0
			ForEach currLine In Array(xmlLines)
				index+=1
				xmlWork[index]=currLine
				// search in line for "H
				If(Find(currLine,'"H'))
					currlineParts=Split(currLine," ")
					// currlineParts[1] looks like <text label="H = 500"
					// exchange
					currlineParts[1]='<text label="H = '&regVal&'"'
					xmlWork[index]=Join(currlineParts," ")
				EndIf
			EndForEach
			If(index)
				xmlWrite=Join(xmlWork,"^NL^")
				WriteFile(xmlFile,xmlWrite,0)
			EndIf
		EndIf
	EndIf
EndIf

Only an idea. There is always another way, usually a better one... :)
 
Last edited by a moderator:

roker beriman

Member
Sep 22, 2010
49
29
Pekalongan - Indonesia
I'ld not process the .XML-file at a whole, but only the line related: Probably this can simplify things. Here my idea presented as a code snippet (untested so far!!!):

Code:
xmlFile="<full_file_path_name_here>"
regVal=""&RegRead("HKLM","Software\Microsoft\CHome\TitaniumWeather\Page 1","H")
If(regVal NE "")
	xmlRead=""&ReadFile(xmlFile)
	If(xmlRead NE "")
		xmlWork=Array()
		xmlLines=Split(xmlRead,"^NL^")
		If(ElementCount(xmlLines))
			index=0
			ForEach currLine In Array(xmlLines)
				index+=1
				xmlWork[index]=currLine
				// search in line for "H
				If(Find(currLine,'"H'))
					currlineParts=Split(currLine," ")
					// currlineParts[1] looks like <text label="H = 500"
					// exchange
					currlineParts[1]='<text label="H = '&regVal&'"'
					xmlWork[index]=Join(currlineParts," ")
				EndIf
			EndForEach
			If(index)
				xmlWrite=Join(xmlWork,"^NL^")
				WriteFile(xmlFile,xmlWrite,0)
			EndIf
		EndIf
	EndIf
EndIf

Only an idea. There is always another way, usually a better one... :)

Thanks for the idea,


problem solved, I use this script :

icon=ReadFile("\Application Data\Home\Darkedge.home.xml")
location1=Find (icon,"H :")

loc1=location1

name1=SubStr(icon,loc1)

janda1=Part(name1,"""",1)

Perawan1=RegRead("HKLM", "Software\Microsoft\CHome\Darkedge\Clock","Hilo")

Copy("\Application Data\Home\Darkedge.home.xml","\Application Data\Home\Darkedge.home.xml")

Darkedge1=ReadFile("\Application Data\Home\Darkedge.home.xml")
Jandakembang1 = Replace(Darkedge1,Janda1,Perawan1)
SetFileAttribs("\Application Data\Home\Darkedge.home.xml",FALSE)
WriteFile("\Windows\janda.xml",Jandakembang1)
Copy( "\Windows\janda.xml", "\Application Data\Home\Darkedge.home.xml", TRUE)

WeatherIcon=RegRead("HKLM", "Software\Microsoft\CHome\TitaniumWeather\Page1","CurrentIcon")
SetFileAttribs("\Windows\Darkedge\weather.png", 0, 0)
Delete ("\Windows\Darkedge\weather.png")
Copy (WeatherIcon,"\Windows\Darkedge\weather.png")

SleepMessage("3","Updating Titanium Weather... Enjoy!","Darkedge")

Run ("\Program Files\Facade\FacadeHelper.exe","Roload")
WaitForActive("Facade: Schedule",10)
SendSpecial (112)
exit
 

aca2302

Member
Dec 30, 2008
6
0
this is posible please halp

usb host wince
sometimes we mast have/known "VID&pid" of device

how to write script to read vid%pid from usb device

example help:

egsiste driver end apps "232usb"/ usb2com
that driver and apps read vid&pid from usb device and register device in,
"hklm/drivers/usb/loadclients/XXXX_YYYY_N"
xxxx is VID
yyyy is PID
in decimal

Question,
How we read that key and use VID&PID convert to hex or not and input for oder drivers

Best regards
 
D

Deleted member 1890170

Guest
Can NOT be done with Mortscript! The APIs needed aren't included in Mortscript.
 

aca2302

Member
Dec 30, 2008
6
0
Can NOT be done with Mortscript! The APIs needed aren't included in Mortscript.

Thanks jwoegerbauer for cuick answer,
but do we have register with usb2com and than
with mort scrip read key "hklm/drivers/usb/loadclients/XXXX_YYYY_N" and use vid&pid,
and deregiste (delete that key) and input in oder format for oder driver, devices?

Thanks in advance, and sorry for my englisch
 
D

Deleted member 1890170

Guest
Obviously I totally misunderstood your 1st post. :)

In HKLM\System\CurrentControlSet\Enum\USB\Vid_<vid>&Pid_<pid> the 4-character (byte) values <vid> and <pid> are always stored in hexadecimal format. So simply read in the USB-device's registry key and extract the hexadecimal values you are looking for.

How I would code it (draft):

Code:
// assume error
found_usb_device=0
If(RegKeyExists("HKLM","System\CurrentControlSet\Enum\USB"))
	ForEach usb_device In RegSubKeys("HKLM","System\CurrentControlSet\Enum\USB")
		pos_vid=0
		pos_pid=0
		If(usb_device NE "")
			// subkey looks like Vid_<vid>&Pid_<pid>
			// search for vendor ID
			pos_vid=Find(usb_device,"Vid_")
			// vid found?
			If(pos_vid)
				// advance 4 characters
				pos_vid+=4
				// read next 4 charcters (bytes)
				vid=SubStr(usb_device,pos_vid,4)
				// search for product ID
				pos_pid=Find(usb_device,"Pid_")
				// pid found ?
				If(pos_pid)
					// advance 4 characters
					pos_pid+=4
					// read next 4 characters (bytes)
					pid=SubStr(usb_device,pos_pid,4)
				EndIf
			EndIf
			If(pos_vid&&pos_pid)
				Message("USB device found:^NL^VID "&vid&^NL^PID"&pid)
				// indicate success
                                found_usb_device+=1
			EndIf
		EndIf
	EndForEach
EndIf
If(NOT found_usb_device)
	Message("No USB device found")
EndIf

Of course UNTESTED !!!
 
Last edited by a moderator:

aca2302

Member
Dec 30, 2008
6
0
Hy Jwoegerbauer,


Test device HD2 energy rom, Dft leo USB host
I look and try Yours code and i have some errors ( if without if )

Here is a reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_4097]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_4097\Default]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_4097\Default\8]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_4097\Default\8\MODEM_PPP_PORT]
"Dll"="PPPVSP.DLL"
"Prefix"="COM"

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\2800_26993_0]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\2800_26993_0\Default]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\2800_26993_0\Default\255_255]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\2800_26993_0Default\255_255\HUAWEI_MODEM_PORT]
"Prefix"="COM"
"Dll"="PPPVSP.DLL"

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\2800_26993_0\Default\8]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\2800_26993_0\Default\8\HUAWEI_MODEM_PORT]
"Prefix"="COM"
"Dll"="PPPVSP.DLL"

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\1133_49243_21504]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\1133_49243_21504\Default]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\1133_49243_21504\Default\Default]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\1133_49243_21504\Default\Default\USBMouse]
"Cursor"=dword:00000001
"Mode"=dword:00000000
"Dll"="USBMouse"

Every usb devices is stored under "loadClients sub key in format VID_PID_N
Example last line hklm.........loadclients\1133_49243_21504\...........
in this line 1133 is a PID, and 49243 is a VID
How can wi use key name "1133_49243_21504" and split key text VID_PID_N to
PID=1133
VID=49243
Num=21504

Thanks In advance,

---------- Post added at 02:58 PM ---------- Previous post was at 02:40 PM ----------

==============================================================================================

Hy Jwoegerbauer,

Itry somting
But Idont know english weru well


Code
#####LIST_LOAD_CLIENTS_DRIVERS####

#include\load.txt


root = "HKLM"
path= "Drivers\USB\LoadClients"
nam = ""
val = ""


#---
ForEach k in regSubKeys (root,path)
#ForEach v,d in regValues (root,path & "\" & k)
#If (Find (d,val) && nam eq RegRead (root,path & "\" & key,"Name"))
#Message ("kluc: " & v & "^NL^znacenje: " & root & "\" & path & "\" & k)


#Run \load.txt, &number&
#SetClipText %number%

#i=( root,path,\ & k)
#WriteFile \load.txt,%K%^NL^
Sleep(500)
Message ("Key: " & k & "^NL^PID: " & d & "^NL^VID: " & d,root & "\" & path )

#EndForEach
EndForEach
-------------------------------------------------------------------------------------------------------------------------------------

Test device HD2 energy rom, Dft leo USB host
I look and try Yours code and i have some errors ( if without if )

Here is a reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_4097]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_4097\Default]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_4097\Default\8]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_4097\Default\8\MODEM_PPP_PORT]
"Dll"="PPPVSP.DLL"
"Prefix"="COM"

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\2800_26993_0]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\2800_26993_0\Default]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\2800_26993_0\Default\255_255]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\2800_26993_0Default\255_255\HUAWEI_MODEM_PORT]
"Prefix"="COM"
"Dll"="PPPVSP.DLL"

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\2800_26993_0\Default\8]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\2800_26993_0\Default\8\HUAWEI_MODEM_PORT]
"Prefix"="COM"
"Dll"="PPPVSP.DLL"

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\1133_49243_21504]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\1133_49243_21504\Default]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\1133_49243_21504\Default\Default]

[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\1133_49243_21504\Default\Default\USBMouse]
"Cursor"=dword:00000001
"Mode"=dword:00000000
"Dll"="USBMouse"

Every usb devices is stored under "loadClients sub key in format VID_PID_N
Example last line hklm.........loadclients\1133_49243_21504\...........
in this line 1133 is a PID, and 49243 is a VID
How can wi use key name "1133_49243_21504" and split key text VID_PID_N to
PID=1133
VID=49243
Num=21504

Thanks In advance,


---------- Post added at 03:28 PM ---------- Previous post was at 02:58 PM ----------

Hy Jwoegerbauer,

I ad "EndIf" at the end of code and it works,
Yors Code with (LoadClints), I think poss_PID is not "0", must be after poss_vid


// assume error
found_usb_device=0
If(RegKeyExists("HKLM","drivers\usb\loadclients"))
ForEach usb_device In RegSubKeys("HKLM","drivers\usb\loadclients")
pos_vid=0
pos_pid=0
If(usb_device NE "")
// subkey looks like Vid_<vid>&Pid_<pid>
// search for vendor ID
pos_vid=Find(usb_device,"Vid_")
// vid found?
If(pos_vid)
// advance 4 characters
pos_vid+=4
// read next 4 charcters (bytes)
vid=SubStr(usb_device,pos_vid,4)
// search for product ID
pos_pid=Find(usb_device,"Pid_")
// pid found ?
If(pos_pid)
// advance 4 characters
pos_pid+=4
// read next 4 characters (bytes)
pid=SubStr(usb_device,pos_pid,4)
EndIf
EndIf
If(pos_vid&&pos_pid)
Message("USB device found:^NL^VID "&vid&^NL^PID"&pid)
// indicate success
found_usb_device+=1
EndIf
EndIf
EndForEach
EndIf
If(NOT found_usb_device)
Message("No USB device found")
EndIf


Thanks, Best Regards
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    MortScripts to toggle settings

    Thread started today for MortScripts that can be used in CHTS. They started as a supplement to CHTS, but they can be used outside it too.

    So far I have radio band changer and sound profile changer scripts.

    MortScripts to toggle settings
    2
    D
    Deleted member 1890170
    fileMask="I*.jpg"
    startDir="\storage card\DCIM\100MEDIA"
    recurse=1

    @RenameFiles(startDir,fileMask,recurse)

    Sub RenameFiles(startDir,fileMask,recurse)
    Local()
    ForEach found In Files(startDir\fileMask)
    time=FormatTime("Ymd",FileModifyTime(found))
    name=FileBase(found)
    newFullFilePathName=FilePath(found)&"\"&SubStr(name,1,1,)&time&FileExt(found)
    Rename(found,newFullFilePathName)
    Sleep(1)
    EndForEach
    If(recurse)
    ForEach startDir2 In Directories(startDir\"*")
    @RenameFiles(startDir2,fileMask,recurse)
    EndForEach
    EndIf
    EndSub
    2
    D
    Deleted member 1890170
    Is anywhere a small graphic menu to get inspiration?
    By-look here: http://forum.xda-developers.com/showthread.php?t=1368340
    1
    Hello, I've a problem.

    I would want to create a script to set the registry of system of mine pna C220.
    In this way to every reset this script runs and in automatic configures the registry for me and launch my software preferred (pollicino).

    This is the script:
    Code:
    Errorlevel ("off")
    
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power", "DisableGwesPowerOff", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\ActivityTimers\UserActivity", "Timeout", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\ActivityTimers\SystemActivity", "Timeout", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\State\UserIdle", "Default", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\State\SystemIdle", "Default", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "BattSystemIdle", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "BattUserIdle", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "ACSystemIdle", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "ACUserIdle", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "ACSuspend", "0")
    #RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "BattSuspend", "0")
    #RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "BatteryPoll", "0")
    
    #RegDeleteKey ("HKLM", "System\CurrentControlSet\Control\Power\ActivityTimers", True, True)
    #RegDeleteKey ("HKLM", "System\CurrentControlSet\Control\Power\State\SystemIdle", True, True)
    #RegDeleteKey ("HKLM", "System\CurrentControlSet\Control\Power\State\UserIdle", True, True)
    #RegDeleteKey ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", True, True)
    
    #SetVolume (255)
    
    Run("\Storage Card\Pollicino\Pollicino.exe")
    #Sleep (15000)
    Waitfor("Pollicino", 1000)
    while (WndActive ("Pollicino"))
    sleep(100)
    endwhile
    Kill("Pollicino.exe")
    
    
    Exit
    
    #*********************************************************************
    Is the script correct?

    Well, I have try to launch it but I have read this errore message:
    ".mscr and .mortrun extension registered.
    Please run any .mscr/.mortrun file ..."

    What's the problem? Is the Wrong script or other?

    I have set a button to launch this script:
    Code:
    ICONXPBUTTON
    X = 36
    Y = 71
    Command = \Storage Card\Pollicino.exe
    SizeNormal = 48
    SizePushed = 48
    Gray = no
    ScaleAlpha = 100
    IconNormal = \my flash disk\C220\skin\icons\Pollicino.ico
    Gray = no
    ScaleAlpha = 100
    IconPushed = \my flash disk\C220\skin\icons\Pollicino.ico

    In Storage Card I have:
    - Pollicino folder (inside Pollicino.exe)
    - Mosrtscript.exe (v.4.2)
    - Pollicino.exe (Mortscript.exe (v.4.2) renamed)
    - Pollicino.mscr
    - setup.dll
    - mortzip.dll

    Please help me

    Well, the script itself looks good, except you've commented out all your registry commands... take out the "#" from each line, if you actually want them to run.

    However, if you want to use an EXE file to launch a MortScript like you are trying to do, you don't rename MortScript.exe to Pollicino.exe, you rename Autorun.exe to Pollicino.exe. Also, you do not need setup.dll or mortzip.dll, those are if you are making a cab file.

    Although looking at it, you have the button launch \Storage Card\Pollicino.exe... is that supposed to be the one that launches the script? If so, the script needs to be in \Storage Card\Pollicino.mscr, and there should be \Storage Card\MortScript.exe there also (if it's not there, it looks for an installed version on your device). Better to have those in a folder, would think, and change the button launching to launch from the folder. I'm assuming that \Storage Card\Pollicino\Pollicino.exe is NOT supposed to be running a script, but some other program?

    Edit:
    It seems to me that this:
    Code:
    Run("\Storage Card\Pollicino\Pollicino.exe")
    #Sleep (15000)
    Waitfor("Pollicino", 1000)
    while (WndActive ("Pollicino"))
    sleep(100)
    endwhile
    Kill("Pollicino.exe")
    could most likely be changed to this:
    Code:
    RunWait("\Storage Card\Pollicino\Pollicino.exe")
    Assuming that the program closes itself, of course... Or do you want to have it killed when the window is no longer active?
    1
    I have done tinkered with PNA devices. Is the CE running on them the same as a PDA? I did a quick search and it seems to say the CE running on a PNA has limited access to CE functions. Maybe it does not allow wildcards as a result of this.