Go Back   xda-developers > Windows Mobile Development and Hacking > Windows Mobile Software Development


Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 9th January 2007, 08:26 AM
Mort Mort is offline
Senior Member
 
Join Date: Dec 2004
Location: near Stuttgart
Posts: 319
Default MortScript examples accumulation

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
Reply With Quote
Sponsored Links

  #2  
Old 9th January 2007, 09:20 AM
_TB_TB_'s Avatar
_TB_TB_ _TB_TB_ is offline
Senior Member
 
Join Date: Apr 2006
Location: Ruda Śląska
Posts: 270
Default

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
__________________

LEDUp - simple LED control program: http://forum.xda-developers.com/showthread.php?t=283302
FloatMe - a stupid, but maybe usefull 'tool': http://forum.xda-developers.com/showthread.php?t=282913
More configurable HW buttons for i780: http://forum.xda-developers.com/show....php?p=3084757
i780/Omnia unlocking: http://forum.xda-developers.com/show....php?p=3101945
Program Finder: http://forum.xda-developers.com/showthread.php?t=477489
Reply With Quote

  #3  
Old 9th January 2007, 09:21 AM
_TB_TB_'s Avatar
_TB_TB_ _TB_TB_ is offline
Senior Member
 
Join Date: Apr 2006
Location: Ruda Śląska
Posts: 270
Default

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
__________________

LEDUp - simple LED control program: http://forum.xda-developers.com/showthread.php?t=283302
FloatMe - a stupid, but maybe usefull 'tool': http://forum.xda-developers.com/showthread.php?t=282913
More configurable HW buttons for i780: http://forum.xda-developers.com/show....php?p=3084757
i780/Omnia unlocking: http://forum.xda-developers.com/show....php?p=3101945
Program Finder: http://forum.xda-developers.com/showthread.php?t=477489

Last edited by _TB_TB_; 9th January 2007 at 03:33 PM..
Reply With Quote

  #4  
Old 9th January 2007, 08:30 PM
GldRush98's Avatar
GldRush98 GldRush98 is offline
Senior Member
 
Join Date: Jun 2006
Location: Taylorville, IL.
Posts: 625
Default

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.
__________________
---Current---
AT&T Fuze
ROM: EnergyROM 'Photon' Standard - Nov. 9th - Windows Mobile 6.5.1 CE OS 5.2.23504
Radio: 1.14.25.35
SPL: 1.90.3 Olinex

---Past---
AT&T 8525
ROM: Nastar - Windows Mobile 6.5 CE OS 5.2.23016
Radio: 1.54.07.00
IPL: 1.04 | SPL: 2.10.Olipro

Last edited by GldRush98; 9th November 2009 at 05:09 AM.. Reason: removed dead link, sorry
Reply With Quote

  #5  
Old 9th January 2007, 09:42 PM
le_cactus le_cactus is offline
Senior Member
 
Join Date: Nov 2005
Location: Amsterdam
Posts: 215
Default 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
Reply With Quote

  #6  
Old 9th January 2007, 09:51 PM
le_cactus le_cactus is offline
Senior Member
 
Join Date: Nov 2005
Location: Amsterdam
Posts: 215
Default 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

Cheers,
Cacti
Reply With Quote

  #7  
Old 9th January 2007, 10:40 PM
_TB_TB_'s Avatar
_TB_TB_ _TB_TB_ is offline
Senior Member
 
Join Date: Apr 2006
Location: Ruda Śląska
Posts: 270
Default

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

LEDUp - simple LED control program: http://forum.xda-developers.com/showthread.php?t=283302
FloatMe - a stupid, but maybe usefull 'tool': http://forum.xda-developers.com/showthread.php?t=282913
More configurable HW buttons for i780: http://forum.xda-developers.com/show....php?p=3084757
i780/Omnia unlocking: http://forum.xda-developers.com/show....php?p=3101945
Program Finder: http://forum.xda-developers.com/showthread.php?t=477489
Reply With Quote

  #8  
Old 10th January 2007, 12:58 AM
oldsap's Avatar
oldsap oldsap is offline
Senior Member
 
Join Date: Apr 2006
Posts: 909
Default

this is a very informative and useful thread.
i use mortscript on my T-Mobile SDA smartphone.

Alarm Script (reminder):
Attached Images
File Type: jpg reminder.jpg (8.2 KB, 3231 views)
Attached Files
File Type: zip Alarm Script.zip (84.0 KB, 748 views)
__________________
http://oldsap.blogspot.com

SpeakerPhone Auto ON - Automatically turn on your speakerphone
OS Profiler - Volume Profile Scheduler.
DontSleep Wifi - will automatically turn on your wifi while preventing your device from going into sleep mode.
OS Logger - Log your SMS on your Calendar
i780 Flashing Guide
CNitrogen - Titanium Plugin for Nitrogen Music Player
SMSer - send multiple sms to multiple contacts
Reply With Quote

  #9  
Old 10th January 2007, 01:07 AM
oldsap's Avatar
oldsap oldsap is offline
Senior Member
 
Join Date: Apr 2006
Posts: 909
Default 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
__________________
http://oldsap.blogspot.com

SpeakerPhone Auto ON - Automatically turn on your speakerphone
OS Profiler - Volume Profile Scheduler.
DontSleep Wifi - will automatically turn on your wifi while preventing your device from going into sleep mode.
OS Logger - Log your SMS on your Calendar
i780 Flashing Guide
CNitrogen - Titanium Plugin for Nitrogen Music Player
SMSer - send multiple sms to multiple contacts
Reply With Quote

  #10  
Old 10th January 2007, 01:11 AM
oldsap's Avatar
oldsap oldsap is offline
Senior Member
 
Join Date: Apr 2006
Posts: 909
Default 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
__________________
http://oldsap.blogspot.com

SpeakerPhone Auto ON - Automatically turn on your speakerphone
OS Profiler - Volume Profile Scheduler.
DontSleep Wifi - will automatically turn on your wifi while preventing your device from going into sleep mode.
OS Logger - Log your SMS on your Calendar
i780 Flashing Guide
CNitrogen - Titanium Plugin for Nitrogen Music Player
SMSer - send multiple sms to multiple contacts
Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:34 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.