FORUMS

MortScript examples accumulation

423 posts
Thanks Meter: 77
 
By Mort, Senior Member on 9th January 2007, 07:26 AM
Post Reply Email Thread
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
9th January 2007, 08:20 AM |#2  
_TB_TB_'s Avatar
Senior Member
Flag Ruda Śląska
Thanks Meter: 177
 
More
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
9th January 2007, 08:21 AM |#3  
_TB_TB_'s Avatar
Senior Member
Flag Ruda Śląska
Thanks Meter: 177
 
More
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
9th January 2007, 07:30 PM |#4  
GldRush98's Avatar
Senior Member
Flag Taylorville, IL.
Thanks Meter: 340
 
More
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.
9th January 2007, 08:42 PM |#5  
Senior Member
Flag Amsterdam
Thanks Meter: 35
 
More
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
9th January 2007, 08:51 PM |#6  
Senior Member
Flag Amsterdam
Thanks Meter: 35
 
More
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
9th January 2007, 09:40 PM |#7  
_TB_TB_'s Avatar
Senior Member
Flag Ruda Śląska
Thanks Meter: 177
 
More
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.
9th January 2007, 11:58 PM |#8  
oldsap's Avatar
Senior Member
Thanks Meter: 10
 
More
this is a very informative and useful thread.
i use mortscript on my T-Mobile SDA smartphone.

Alarm Script (reminder):
Attached Thumbnails
Click image for larger version

Name:	reminder.jpg
Views:	4776
Size:	8.2 KB
ID:	32941  
Attached Files
File Type: zip Alarm Script.zip - [Click for QR Code] (84.0 KB, 1391 views)
10th January 2007, 12:07 AM |#9  
oldsap's Avatar
Senior Member
Thanks Meter: 10
 
More
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
10th January 2007, 12:11 AM |#10  
oldsap's Avatar
Senior Member
Thanks Meter: 10
 
More
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
10th January 2007, 03:50 PM |#11  
OP Senior Member
Flag near Stuttgart
Thanks Meter: 77
 
More
Wow, you sure give me some work for the weekend...
Very interesting collection, thank you!
Post Reply Subscribe to Thread

Tags
mortscript, mortscript examples

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes