MortScript examples accumulation

Search This thread

Mort

Senior Member
Dec 7, 2004
423
78
near Stuttgart
www.sto-helit.de
Hi there,

since I realized MortScript finally got to some use here, too, and I'm currently building an updated site, I wanted to gather some scripts which I could offer as examples on my page. Of course with a link to any origin you want - that way the author gets the credits, and I don't need to keep up with the latest update all the time... ;)
Since I lost track of all the threads and scripts, I'd be nice if you could send me the interesting topics (a reply might be useful for others, too, but PM or contact formular or forum on mort.sto-helit.de is fine, too...).

TIA,
Mort
 
  • Like
Reactions: augustinionut

_TB_TB_

Senior Member
Apr 5, 2006
449
176
Ruda Śląska
suzume.pl
The 'clicky' thing:
Code:
if question "Please set the Camera app to photo mode before executing this script. Additionally, please remember to disable <<Reviev After Capture>> option in Camera before running this script! Run the script?","Important note"
 setbacklight 1,1
 Input limit, 1, "Total images to capture","MultiCapture"
 if equals "",%limit%
  set limit,10
 endif
 set total,0
 Input delayer, 1, "Capture interval (seconds)","MultiCapture"
 set delayer,%delayer%*1000
 if equals %delayer%,0
  set delayer,1000
 endif
 %czas%=%delayer%*%limit%/1000
%czas_m%=%czas%/60
 %czas%="Total capture time: "&%czas%&" seconds, this is "&%czas_m%&" minutes."
 message %czas%,"MultiCapture"
 if question "Lock the touchscreen?","Touchscreen lock"
  run tpdisable.exe
 endif
 run camera.exe
 WaitForActive "Camera",10
 setbacklight 0,0
 while wndActive "Camera"
  SendCR "Camera"
  sleep %delayer%
  %total%=%total%+1
  if equals %total%,%limit%
   Close "Camera"
  endif
 endwhile
 run tpenable.exe
 %total%="Images captured: " & %total%
 message %total%,"Done"
endif
It does some pictures at regular interval, locking screen (using TPEnable/TPDisable).

The other script:
Code:
if wndActive "Camera"
 regReadDword HKCU,"Software","tplock",lok
 if equals %lok%,1
  run "\windows\tpenable.exe"
  regWriteDword HKCU,"Software","tplock",0
  message "Screen unlocked.","Device lock"
 else
  run "\windows\tpdisable.exe"
  regWriteDword HKCU,"Software","tplock",1
 endif
else
 run "\windows\alttab.exe"
endif
I have it bound to 'Record' button on my BA. If the camera is active, it locks the touchscreen (TPEnable/Disable again). If not - it executes SPBPocketPlus's AltTab.

MortScript rulez;)
 

_TB_TB_

Senior Member
Apr 5, 2006
449
176
Ruda Śląska
suzume.pl
I have one more, but a buggy one - it updates the Camera image capture dir to dd_mm_yyy. Will post it later on today... :)
Code:
if not regKeyExists HKCU,"Software\IA Style\IA CameraWizard(Pocket PC)\2.21\Strings","xImage folder"
 regReadString HKCU,"Software\IA Style\IA CameraWizard(Pocket PC)\2.21\Strings","Image folder",pth
 %msg%="This is the first time you use this script. The current image store path is: "&%pth%
 message %msg%
 if question "Run the Camera to change this value?"
 runwait "camera.exe"
 endif
 regReadString HKCU,"Software\IA Style\IA CameraWizard(Pocket PC)\2.21\Strings","Image folder",pth
 RegWriteString HKCU,"Software\IA Style\IA CameraWizard(Pocket PC)\2.21\Strings","xImage folder",%pth%
 if question "Update the capture dir now?"
 regReadString HKCU,"Software\IA Style\IA CameraWizard(Pocket PC)\2.21\Strings","Image folder",pth
 else
 exit
 endif 
endif

GetTime dat, "Y_m_d"
regReadString HKCU,"Software\IA Style\IA CameraWizard(Pocket PC)\2.21\Strings","xImage folder",pth
%dat%=%pth%&"\"&%dat%
MkDir %dat%
RegWriteString HKCU,"Software\IA Style\IA CameraWizard(Pocket PC)\2.21\Strings","Image folder",%dat%
%dat%="Image capture folder updated to "&%dat%
SleepMessage 5,%dat%,"Capture folder updated",1
 
Last edited:

GldRush98

Senior Member
Jun 3, 2006
2,314
337
Taylorville, IL.
www.GldRush98.com
Here is a short & sweet script I wrote that asks you if you'd like to rotate your screen before running TomTom then rotates it back when TomTom exits. This is useful because when driving, TomTom looks better in landscape mode, but there are times when just walking around and stuff it's better in portrait mode.
No credit needed really because of it's simplicity.
Edit: Sorry, I deleted the file off my server a while back when I was doing some spring cleaning... I don't have a copy of it any where.
Really it was just a couple mortscript commands. Anyone who spends 5 minutes and reads the mortscript documentation can figure it out.

BTW, I LOVE mortscript. It's very handy and I see it becoming more useful as the needs arise.
 
Last edited:

le_cactus

Senior Member
Nov 25, 2005
568
35
Amsterdam
BT Sync

Hi,

I couldn't live without it. The following script connects Bluetooth through ActiveSync and Syncs. The connection will remain active until the script is started again, or the connection is closed manually.

Code:
If NOT wndExists "Connected to MEDIACENTER"
  RegReadDWord HKLM, System\State\Hardware, Bluetooth, Bluetooth
  If Expression %Bluetooth% <= 8
    Set BluetoothWas, "Off"
    Run "\Windows\ToggleBTH.exe"
    Sleep 3000
  EndIf
  Run "\Windows\rnaapp.exe", -n -m -e"MEDIACENTER"
  WaitFor "Connected to MEDIACENTER", 15
  Run "\Windows\udp2tcp.exe"
  Run "\Windows\rapiclnt.exe", -dppp_peer
  Run "\Windows\repllog.exe", /remote /sched /h
  Sleep 1000
  RegWriteDWord HKLM, System\State\Hardware, Cradled, 1
  While wndExists "Connected to MEDIACENTER"
    Sleep 1000
  EndWhile
  Run "\Program Files\MortScript\TKill.exe", UDP to TCP proxy
  Run "\Program Files\MortScript\TKill.exe", Remote API Client
  Run "\Program Files\MortScript\TKill.exe", ActiveSync
  If equals %BluetoothWas%, "Off"
    Run "\Windows\ToggleBTH.exe"
  EndIf
Else
  Run "\Program Files\MortScript\TKill.exe", Connected to MEDIACENTER
EndIf

Needless to say you need to replace MEDIACENTER with the name of your own BT Connection.
ToggleBTH turns on the BlueTooth radio if it wasn't already on, and turns it off again is the connection is dropped.
TKill really kills the various processes when done; killing them with MortScript's internal commands didn't seem stable.

Cheers,
Cacti
 

le_cactus

Senior Member
Nov 25, 2005
568
35
Amsterdam
GPRS Sync

Code:
# Witch operator are we on?
RegReadString HKLM, System\State\Phone, Current Operator Name, Operator
If Equals %Operator%, "Orange"
    Set Orange, "On"
EndIf

# Orange Active? Switch to T-Mobile.
If Equals %Operator%, "Orange"
  Run "\Windows\STK.exe"
  SendUp STK Service
  SendUp STK Service
  SendDown STK Service
  SendCR STK Service
  Sleep 500
  Minimize STK Service
EndIf

# Is T-Mobile Active?
RegReadString HKLM, System\State\Phone, Current Operator Name, Operator
While Not Equals %Operator%, "T-Mobile NL"
  Sleep 1000
  RegReadString HKLM, System\State\Phone, Current Operator Name, Operator
EndWhile

# GPRS Notificatie opslaan en daar uitzetten
RegReadDWord HKCU, ControlPanel\Notifications\{8ddf46e7-56ed-4750-9e58-afc6ce486d03}, Options, GPRSConnectNotification
RegWriteDWord HKCU, ControlPanel\Notifications\{8ddf46e7-56ed-4750-9e58-afc6ce486d03}, Options, 0

#Activesync
If wndExists "ActivSync"
  Set ActiveSync, "On"
EndIf
Run "\Windows\repllog.exe", /h /sched /remote
Sleep 500
MouseClick ActiveSync 20, 310
Sleep 500
Minimize ActiveSync
RegReadDWord HKCU, Software\Microsoft\ActiveSync\Partners\{4FF3ACFA-3E07-42E1-83D9-4F04714CDC0B}, LastSyncSuccess, LastSyncSuccess
RegReadDWord HKCU, Software\Microsoft\ActiveSync\Partners\{4FF3ACFA-3E07-42E1-83D9-4F04714CDC0B}, LastSyncSuccess, NewSyncSuccess
While Equals %NewSyncSuccess%, %LastSyncSuccess%
  Sleep 1000
  RegReadDWord HKCU, Software\Microsoft\ActiveSync\Partners\{4FF3ACFA-3E07-42E1-83D9-4F04714CDC0B}, LastSyncSuccess, NewSyncSuccess
EndWhile
RegWriteDWord HKCU, ControlPanel\Notifications\{8ddf46e7-56ed-4750-9e58-afc6ce486d03}, Options, %GPRSConnectNotification%
If not Equals %ActiveSync%, "On"
  Run "\Program Files\MortScript\TKill.exe", ActiveSync
EndIf
If Equals %Orange%, "On"
  Run "\Windows\STK.exe"
  SendUp STK Service
  SendUp STK Service
  SendCR STK Service
  Sleep 1000
  Minimize STK Service
  Minimize STK Service
EndIf

This script ActiveSyncs over GPRS. I use a Dual SIM, (Orange & T-Mobile) and only the T-Mobile subscription have GPRS. So the script first determines if T-Mobile is active. If not is switches SIM. After that it just starts ActiveSync and syncs the {4FF3ACFA-3E07-42E1-83D9-4F04714CDC0B} partnership. After it finishes is swichtes SIMs again; I'm mainly on the Orange SIM.

I use the same methode before starting TomTom so my traffic information can be downloaded while driving.

If someone is interested I also have a script that (allong with some other little proggies) starts TomTom automaticly when I connect the power connector, but only if my carkit is connected.

MortScript makes me very lazy :D

Cheers,
Cacti
 

_TB_TB_

Senior Member
Apr 5, 2006
449
176
Ruda Śląska
suzume.pl
Code:
RegWriteString HKLM,Drivers\active\73,Name,COM6:
if question "Enable BT/GPS before running OziExplorer?","OziExplorer"
 run "\program files\vijay555\vjvolubilis\vjvolubilis.exe", -blueon
 runwait "\storage card2\oziexplorer\oziexplorerce.exe"
 run "\program files\vijay555\vjvolubilis\vjvolubilis.exe", -blueoff
else
 if question "Run OziExplorer anyway?","OziExplorer"
  run "\storage card2\oziexplorer\oziexplorerce.exe"
 endif
endif
Yay, does anyone use OziExplorerCE? :) I sometimes do;)
The script above utilizes vijay's VJVolubilis (great app, imho) to enable Bluetooth. It also adds 'fake' COM port in order to allow proper OziExplorerCE GPS configuration.
 

oldsap

Senior Member
Apr 4, 2006
1,100
10
oldsap.blogspot.com
this is a very informative and useful thread.
i use mortscript on my T-Mobile SDA smartphone.

Alarm Script (reminder):
 

Attachments

  • reminder.jpg
    reminder.jpg
    8.2 KB · Views: 4,784

oldsap

Senior Member
Apr 4, 2006
1,100
10
oldsap.blogspot.com
Cleanup Recently Used Programs

This script removes the list of recently used programs in the Start Menu.

Code:
if question ("Do you want to cleanup the Recent Programs from your Start Menu?","oldSAP's Cleanup")
x=0
While NOT (x = 12)
RegWriteString ("HKCU","Software\Microsoft\Shell\TaskSwitch",%x%,"")
x=x+1
EndWhile
if question ("You need to restart your device to see the effect.  Restart Now?","oldSAP's Cleenup")
Reset
EndIf
EndIf
 

oldsap

Senior Member
Apr 4, 2006
1,100
10
oldsap.blogspot.com
Copy/Paste

Copy and Paste script

Code:
num=Input ( "1=Copy All  2=Copy Word(s)  3=Copy Line 4=Paste ", "oldSAP Copy/Paste",1 )
if equals %num%, "1" 
SendCtrlKey A
SendCtrlKey C 
Else
if equals %num%, "2" 
x=Input("How many words do you want to copy?","no. of words",1)
Repeat %x%
SendRight( "", 1, 1 )
EndRepeat
SendCtrlKey C
Else
if equals %num%, "3" 
SendEnd( "", 0, 1 )
SendCtrlKey C
Else
if equals %num%, "4" 
SendCtrlKey V
Else
EndIf
 

senergy

Senior Member
Oct 26, 2006
140
10
here is a very basic script, I use it for apps that I want to stay alive until I close the app, eg GPS software, in particular Destinator.
Note, for some reason the volume part doesnt seem to work as it should.

Code:
#Basic script to set no timeouts and full brightness while using Destinator
#Read registry settings
#volume is not working for some reason
#Volume = RegRead ("HKCU", "ControlPanel\Volume\","Volume")
BattSuspendTimeout = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout")
ACSuspendTimeout = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout")
BatteryTimeout = RegRead ("HKCU", "ControlPanel\Backlight", "BatteryTimeout")
ACTimeout = RegRead ("HKCU", "ControlPanel\Backlight", "ACTimeout")
Brightness = RegRead ("HKCU", "ControlPanel\Backlight", "Brightness")
ACBrightness = RegRead ("HKCU", "ControlPanel\Backlight", "ACBrightness")

#Set registry settings
#RegWriteDword ("HKCU", "ControlPanel\Volume\","Volume", 2576980377)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout",0)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout",0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "Brightness", 10)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACBrightness", 10)

#Change application to run here
RunWait ("\DestinatorApps\Destinator\DestiRobot.exe")

#Set registry settings back to normal use mode
#RegWriteDword ("HKCU", "ControlPanel\Volume\","Volume", Volume)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout",BattSuspendTimeout)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout",ACSuspendTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", BatteryTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", ACTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "Brightness", Brightness)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACBrightness", ACBrightness)
 

Jeff

Senior Member
Sep 17, 2003
189
27
Brussels, Belgium
Great to see such a collection of genius in just ONE post!

It is probably a good idea to inform our captive audience that a majority of these scripts will work only with Mort's 4.0 RC3 version (or at least not the 3.1 version) so if you are having some problems launching these wonderful scripts download the Release Candidtate:

h++p://www.sto-helit.de/downloads/pocketpc/MortScript-4.0RC3.zip
(hope you don't mind me posting the link Mort)...

"Live long and Script!"
 

Mort

Senior Member
Dec 7, 2004
423
78
near Stuttgart
www.sto-helit.de
There's RC5 around at the "site to come": http://mort.sto-helit.de (see http://www.sto-helit.de for why there are two sites... ;)). It's mostly bugfixes. In RC4 I added the possibility to access COM ports, but I still have to update the manual... On that site, you'll also soon be able to find the scripts posted here...
There's also a new beta of MortButtons and the MortButton skins are migrated. But there's still a lot to do, esp. regarding MortPlayer...
 

Quilliam

Senior Member
Dec 30, 2006
53
0
Need some help with the BT sound.
I got the bellow mortscript (posted by senergy) on my phone. And when I click on it it runs. But when I try to listen to sound over bluetooth it still goes directly to voicecommand regardless if I click yes or no. Am I doing something wrong? (using mortscript version 4)


EDIT:

Figured out the problem and removed bad script (Was using another cut and paste, this one did work!)

Orginaly posted by senergy

#basic mortscript to enable bt sound

#question
Switch (question ( "Do you want BT sound?", "Question", "YesNo"))
case (1)
RegWriteDword ("HKLM","Software\OEM\VoiceCommand","LaunchApEnable",0)
RegWriteDword ("HKLM","Software\OEM\VoiceCommand","VoiceCmdDuration",86400)
case (0)
RegWriteDword ("HKLM","Software\OEM\VoiceCommand","LaunchApEnable",1)
RegWriteDword ("HKLM","Software\OEM\VoiceCommand","VoiceCmdDuration",30)
endSwitch
 
Last edited:

Wolfje

Member
Feb 12, 2005
13
0
Mortscript Press Button

Can someone please help me with this script, it should (amongst others) press Warning Message key in Navigon Mobile Navigator 6 but it doesn't always.
Probably because startuptime varies? I'm not sure about remaining script either......

# Position of MN6 Button to press
Set Position_X, "170"
Set Position_Y, "290"

# Set Bluetooth On
run "\Program Files\vijay555\VJVolubilis\VJVolubilis.exe", -blueon

# Start Navigon including FlitsNav
Run "\My Documents\POIWarner\FlitsNav.exe"
WaitForActive "Mobile Navigator 6", 60000
GetColorAt %Position_X%, %Position_Y%, colorStart
# Waiting time in milliseconds
Sleep 35000
Set true, "1"
While equals %true%, "1"
Sleep 1000
GetColorAt %Position_X%, %Position_Y%, color
If not equals %color%, %colorStart%
If wndActive "Mobile Navigator 6"
Sleep 1000
MouseClick "Mobile Navigator 6", %Position_X%, %Position_Y%
EndIf
Set true, "0"
EndIf
EndWhile

# Kills FlitsNav and Bluetooth after exit MN6
Runwait ("\SDMMC\MN6\MN6.exe")
run "\Program Files\vijay555\VJTaskKiller\VJTaskKiller.exe", FlitsNav
run "\Program Files\vijay555\VJVolubilis\VJVolubilis.exe", -blueoff
 

mistrix

Senior Member
Nov 13, 2005
73
0
MortScript

Here`s some of my stuff, unfortunately mostly still on the "old" syntax.

I´ve started to rebuff some of the scripts (new syntax, mostly new concepts) but ran out of time during the last month.

I try to create "modules" for recurring tasks, to be called from within other scripts or, if appliccable, to be capable run standalone as well. Most of the module expect variables to be set, hence must be called using callscript.

Here is a newer one to display status messages and a kind of countdown. Once kicked off it runs on its own, refreshes (if required, i.e. if the status display needs to change) every second displaying the content of the registry value "info" until the registry value "DoShow" toggles. During the process a given startvalue (approximated duration) is decreased like a countdown and restartet if necessary.

This one is started with run, to have it operate totally independent, hence content is communicated via registry values.

Code:
# Modul zum Zeigen von Status / Info messages 
# uebergeben per Reg. Werten
#
#  HGH 11-26/06
#
errorlevel warn
#
if ( \ 
      NOT \ 
      ( \
      RegValueExists \
         ("HKCU", "Software\Mistrix\ShowStat","DoShow") \
      AND \
      RegValueExists \
         ("HKCU", "Software\Mistrix\ShowStat","RefCycle") \
      AND \
      RegValueExists \
         ("HKCU", "Software\Mistrix\ShowStat","Info") \
      AND \
      RegValueExists \
         ("HKCU","Software\Mistrix\ShowStat","InfoHeader") \
      AND \
      RegValueExists \
         ("HKCU", "Software\Mistrix\ShowStat", "OKAllow") \
      ) \
   )
   message ( \
      "RegWerte nicht gefunden", \
      SystemPath("ScriptName") \
      & SystemPath("ScriptExt") \
      )
   exit
EndIf
#
# "Gesamtzeit" aus  Reg lesen
GCycle = RegRead ("HKCU", "Software\Mistrix\ShowStat", \
                          "RefCycle")
#
TStampStart = TimeStamp ()
#
while (RegRead ("HKCU", "Software\Mistrix\ShowStat", \
                          "DoShow") = 1)
   InfAlt = RegRead ("HKCU", "Software\Mistrix\ShowStat", \
                          "Info")
   If (TimeStamp () - TStampStart > GCycle )
      TStampStart = TimeStamp ()
   EndIf
   ShowCycle = GCycle - TimeStamp () + TStampStart
   Sleepmessage \
         ( \
         ShowCycle , \
         InfAlt, \
         RegRead ("HKCU", "Software\Mistrix\ShowStat", \
                          "InfoHeader"), \
         1, \
         RegRead ("HKCU", "Software\Mistrix\ShowStat", \
                         "DoShow") <> 1 OR InfAlt ne RegRead \  
                         ("HKCU", "Software\Mistrix\ShowStat", \
                          "Info") \
         )
         #
         # ggf. (OKAllow=1) warten, 
         # bis sich ein Status geaendert hat
         while ( \
            RegRead ("HKCU", "Software\Mistrix\ShowStat", \
                         "DoShow") = 1 AND InfAlt eq RegRead \  
                         ("HKCU", "Software\Mistrix\ShowStat", \
                         "Info") AND RegRead ("HKCU", \
                         "Software\Mistrix\ShowStat", \
                         "OKAllow") = 1 \
         )
            sleep (1000)
         EndWhile
#
EndWhile
#
exit

Next is an example, how to use it. There could be any
code instead of the sleeps,
just reload "Info" whenever you want to have your
status display updated...

Code:
# TestRahmen fuer Status / Info messages 
# mittels ShowStat.mscr
#
#  HGH 11-26/06
#
errorlevel warn
#
# Setzen der Reg. Werte - set the registry values
# Stausmeldungen aktiv - activate status display
RegWriteDword ("HKCU", "Software\Mistrix\ShowStat", \
                          "DoShow", 1)
# Darf der User Message wegcklicken? - 
# may the user cancel status display
RegWriteDword ("HKCU", "Software\Mistrix\ShowStat", \
                          "OKAllow", 1)
# "Gesamtzeit" - approximated total time
RegWriteDword ("HKCU", "Software\Mistrix\ShowStat", \
                          "RefCycle", 30)
# InfoHeader - title
RegWriteString ("HKCU", "Software\Mistrix\ShowStat", \
                          "InfoHeader", "TestStati" )
# InfoText - status text
RegWriteString ("HKCU", "Software\Mistrix\ShowStat", \
                          "Info", "Status1" )
#
# Starten der Show Info Routine - status modul start
run ( SystemPath("ScriptPath") \ "ShowStat.mscr")
#
sleep (8000)
#
# neuer Infotext - new status content
RegWriteString ("HKCU", "Software\Mistrix\ShowStat", \
                          "Info", "Status2" )
#
sleep (12000)
#
# neuer Infotext - new status content
RegWriteString ("HKCU", "Software\Mistrix\ShowStat", \
                          "Info", "Status3" )
#
sleep (5000)
#
# Statusmeldungen inaktiv - status display off
RegWriteDword ("HKCU", "Software\Mistrix\ShowStat", \
                          "DoShow", 0)
#
exit
 
Last edited:

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
    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
    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.