PDA

View Full Version : MortScript examples accumulation


Pages : [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Mort
9th January 2007, 08:26 AM
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

_TB_TB_
9th January 2007, 09:20 AM
The 'clicky' thing:

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:

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_
9th January 2007, 09:21 AM
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... :)

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

GldRush98
9th January 2007, 08:30 PM
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.

le_cactus
9th January 2007, 09:42 PM
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.

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
9th January 2007, 09:51 PM
# 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_
9th January 2007, 10:40 PM
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
10th January 2007, 12:58 AM
this is a very informative and useful thread.
i use mortscript on my T-Mobile SDA smartphone.

Alarm Script (reminder):

oldsap
10th January 2007, 01:07 AM
This script removes the list of recently used programs in the Start Menu.

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
10th January 2007, 01:11 AM
Copy and Paste script

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

Mort
10th January 2007, 04:50 PM
Wow, you sure give me some work for the weekend... ;)
Very interesting collection, thank you!

hannip
11th January 2007, 09:25 PM
I have a collection of scripts at this link.

http://discussion.treocentral.com/showthread.php?t=132525

_TB_TB_
11th January 2007, 11:53 PM
Yay, I see LEDUp in use :D

(gotta switch to MortScript 4, 3.5 seems to be a bit old... ;) )

senergy
12th January 2007, 01:31 AM
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.


#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
12th January 2007, 07:55 AM
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
14th January 2007, 11:44 AM
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...

senergy
17th January 2007, 11:48 PM
Mort,
I noticed their is RC7 now, what has changed since RC4.. Is there a changelog we can view?

Quilliam
18th January 2007, 06:21 AM
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

Wolfje
29th January 2007, 07:09 PM
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
29th January 2007, 10:42 PM
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.


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


# 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

mistrix
29th January 2007, 10:47 PM
Here`s one module to log scripted actions in a standardized manner (last entry first, date, indented, limited number of lines - rest is cut of...):


# Traegt mit uebergebenen Werten %LogEntry% mit
# Kopfzeile aus Datum und %LogProg% als obersten Block
# in %LogFile% (default: \My Documents\FHGHLog.txt) ein
# und begrenzt dieses dabei duch Abschneiden am Ende
#
## auf %LogLineCount% (default 500) Zeilen
## derzeit hart gecodet
#
# Call
# [set Logfile, ..]
# set LogProg, ..
# set LogEntry, ..
# [set LogLineCount, ..]
# GetSystemPath ScriptPath, spath
# GetSystemPath ScriptName, sname
# GetSystemPath ScriptExt, sext
# set LogProg, %spath% \ %sname% & %sext%
# set RunPath, %spath% & "\DoLog.mscr"
# CallScript %RunPath%
errorlevel warn
# if {%LogLineCount% eq ""}
set LogLineCount, 500
# default 500
# endif
set LogBufn, ""
if {%LogFile% eq ""}
set LogFile, "\My Documents\FHGHlog.txt"
endif
if FileExists %LogFile%
ReadFile %LogFile%, LogBuf
else
Set LogBuf, "Created " & %StartDate% & " (no file found)"
endif
GetTime LogDate, "Y-m-d_H-i-s"
set LogBufn, %LogDate% & " " & %LogProg%
# LogEntry einruecken
set i, 0
ForEach line in split %LogEntry%, "^LF^", 0
line = Part( line, "^CR^", 1, 1)
set i, %i% +1
set LogBufn, %LogBufn% & "^NL^ " & %line%
EndForEach
set Logbuf, %LogBufn% & "^NL^^NL^" & %LogBuf%
#
# Anzahl Zeilen begrenzen
set i, 0
set LogBufn, ""
ForEach line in split %LogBuf%, "^LF^", 0
line = Part( line, "^CR^", 1, 0)
set i, %i% +1
if {%i% <= %LogLineCount%}
set LogBufn, %LogBufn% & %line%
if {%i% < %LogLineCount%}
set LogBufn, %LogBufn% & "^NL^"
endif
endif
EndForEach
WriteFile %LogFile%, %LogBufn%
exit

mistrix
29th January 2007, 10:56 PM
...and one that deletes all but a given amount (TargetCount) of files in a folder (TargetPath) that match a search pattern (TargetSpec). It sorts and hence deletes the oldest files, if the filenames contain time stamps.


# Tool zum Loeschen von allen bis auf n (TargetCount) Files
# einer bestimmten Spezifikation (TargetSpec)
# in einem benannten Pfad (TargetPath).
# Es verbleiben die letzten n einer alphanumerisch sortierten Fileliste
#
# Call:
# set TargetPath, "..."
# set TargetSpec, "*..."
# [set TargetCount, <> 3]
# [set DoLog, <> 1]
# [set LogName, <> "\My Documents\FHGHlog.txt"]
# set runpath, "\HGHProggies\Mort\DeleteButOf.mscr"
# callscript %runpath%
#
errorlevel warn
#
# erwartete Variablen / Defaults
#
if {%TargetPath% eq ""}
message "Kein Zielverzeichnis angegeben! ^LF^^LF^-> EXIT", "DeleteButOf"
exit
endif
if {%TargetSpec% eq ""}
message "Keine Spezifikation angegeben! ^LF^^LF^-> EXIT", "DeleteButOf"
exit
endif
if {%TargetCount% eq ""}
set TargetCount, 3
endif
if {%DoLog% eq ""}
set DoLog, 1
# 0=keinen Log schreiben
endif
#
#
if {%DoLog% = 1}
if {%LogName% ne ""}
set Logfile, %LogName%
endif
GetSystemPath ScriptPath, spath
GetSystemPath ScriptName, sname
GetSystemPath ScriptExt, sext
#
set LogEntry, "Keep " & %TargetCount% \
& " of """ & %TargetSpec% & """ in " & %TargetPath%
endif
#
# neu
set i, 0
repeat %TargetCount%
set i, %i%+1
RegWriteString HKCU,Software\Mistrix\DeleteButOf,{"Buf" & %i%},""
endrepeat
ForEach FoundFile in files {%TargetPath% \ %TargetSpec%}
set i, 1
while {%i% <= %TargetCount%}
set DelFile, ""
set j, %i%+1
RegReadString HKCU,Software\Mistrix\DeleteButOf, \
{"buf" & %i%}, KeepFile
if {%FoundFile% gt %KeepFile%}
if {%i% = 1}
set DelFile, %KeepFile%
endif
RegWriteString HKCU,Software\Mistrix\DeleteButOf, \
{"Buf" & %i%}, %FoundFile%
if {%i% < %TargetCount%}
RegReadString HKCU,Software\Mistrix\DeleteButOf, \
{"buf" & %j%}, NextKeepFile
if {%FoundFile% gt %NextKeepFile%}
RegWriteString HKCU,Software\Mistrix\DeleteButOf, \
{"Buf" & %i%}, %NextKeepFile%
# Keep(i+1) einen runter kopieren
endif
endif
else
if {%i% = 1}
set DelFile, %FoundFile%
endif
endif
set i, %j%
if {%DelFile% ne ""}
if FileExists %DelFile%
delete %DelFile%
set LogEntry, %LogEntry% & "^NL^delete: " & %DelFile%
set DelFile, ""
endif
endif
endwhile
EndForEach
#
# ggf. Keeps ausgeben und log schreiben
if {%DoLog% = 1}
set i, 0
repeat %TargetCount%
set i, %i%+1
RegReadString HKCU,Software\Mistrix\DeleteButOf, \
{"buf" & %i%}, KeepFile
set LogEntry, %LogEntry% & "^NL^keep : " \
& %KeepFile%
EndRepeat
set LogProg, %spath% \ %sname% & %sext%
set RunPath, "\HGHProggies\Mort\DoLog.mscr"
CallScript %runpath%
endif
errorlevel critical
RegDeleteKey HKCU,Software\Mistrix\DeleteButOf, 1, 1
exit

mistrix
29th January 2007, 11:13 PM
...to convert a decimal number to hex or bin, capable to provide a desired nibble only (p.e. if you´re interested, wheather a special bit is set or not; can be obtained way easier using the binary logic / masks) or formatted text as "answer".

At least the choice part could probably be done smarter, p.e. using find() versus something like "0123456789ABCDEF".

This one operates on its own as well as called from another script.


# wandelt %idZahl% (dez) in
# hex oder bin, wie in %Basis% (2 oder 16)
# liefert ev. nur gesuchtes nibbel %ZNib% (1-based, dez)
# oder nur %Nibs% Nibble, bei %ZNib% = ""
# Ergebnis in %Erg%; "X" bei Fehler
# oder in High Bit, wenn %idZahl% > %Basis% ^ %Nibs%
#
#
#
Errorlevel warn
#
# ggf. Eingabe der zu konvertierenden Zahl
#
if {%idZahl% Eq ""}
Input idZahl,1,"Bitte Dezimalzahl eingeben","DezDecode.mscr"
set disp,1
endif
set dZahl, %idZahl%
if {%dZahl% Eq "" or %dZahl% < 0 or \
%dZahl% > 1073741824}
if (%disp% = 1}
Message \
"Nur Ganzzahl > 0 < 1073741824 zulaessig! Abbruch."\
,"DezDecode.mscr"
else
set Erg, "X"
endif
exit
endif
#
# Defaults,
# wenn ohne extern gesetzte (Callscript) Var: idZahl gecallt
if {%disp% = 1}
Input Basis,1,"Bitte Basis 2 (default) oder 16 eingeben", \
"DezDecode.mscr"
endif
if {%Basis% Eq "" or %Basis% <> 16}
set Basis, 2
# default binaer
set MaxNibs, 31
else
set MaxNibs, 8
endif
#
if {%disp% = 1}
Input Nibs, 1, {"Bitte Anzahl Stellen, max. " & %MaxNibs% \
& " (default) eingeben"}, "DezDecode.mscr"
endif
if {%Nibs% Eq "" or %Nibs% > %MaxNibs% or %Nibs% <= 0}
set Nibs, %MaxNibs%
endif
#
#
if {%disp% = 1}
Input ZNib, 1, \
"Bitte Zielbit oder """" (keins, default) eingeben",\
"DezDecode.mscr"
endif
if {%ZNib% > %Nibs% or %ZNib% < 1}
set ZNibs, ""
# bei ungueltigem Zielbit alle bits
endif
#
set Erg, ""
# Ergebnisstring
#
set Exp, %Nibs%-1
# - 1
# Exponent 0 based
#
set AktNib, %Basis%
Repeat {%Exp%-1}
set AktNib, %AktNib% * %Basis%
EndRepeat
# High Nibble Wert
#
set AktNibDez, %dZahl% / %AktNib%
#
#
while { %Exp% >= 0}
if {%AktNibDez% > %basis%}
# Dezimalzahl zu gross, kann nur vorne passieren
set ErgNib, "X"
else
Switch %AktNibDez%
# akt nibble in dez (=bin)
case 0,1,2,3,4,5,6,7,8,9
set ErgNib, %AktNibDez%
case 10
set ErgNib, "A"
case 11
set ErgNib, "B"
case 12
set ErgNib, "C"
case 13
set ErgNib, "D"
case 14
set ErgNib, "E"
case 15
set ErgNib, "F"
EndSwitch
endif
if {%ZNib% ne "" and (%ZNib% - 1) = %Exp%}
# Zielbit gesetzt und erreicht
set Erg, %ErgNib%
if {%disp% = 1}
message {"Nibble " & %ZNib% & " (Basis " & %Basis% \
& ") von " & %idZahl% & " = " & %Erg%}, \
"DezDecode.mscr"
endif
exit
else
set Erg, %Erg% & %ErgNib%
endif
set Exp, %Exp% - 1
set dZahl, %dZahl% - %AktNib% * %AktNibDez%
set AktNib, %AktNib% / %Basis%
if {%AktNib% > 0}
set AktNibDez, %dZahl% / %AktNib%
endif
EndWhile
#
#
if {%dzahl% <> 0}
set Erg, "X"
Message "Keine Loesung gefunden! Abbruch.",\
"DezDecode.mscr"
exit
endif
set i, 0
ForEach char in charsOf %Erg%
set i, %i% + 1
EndForEach
set groups, %i% / 4
set i, 4-(%i% - %groups% * 4)
set i, %i%-(%i%/4)*4
set Ergd, ""
if {%groups% > 0}
ForEach char in charsOf %Erg%
set ErgD, %ErgD% & %char%
set i, %i% + 1
if {%i% = 4 }
set ErgD, %ErgD% & " "
set i, 0
endif
EndForEach
else
set ErgD, %Erg%
endif
if {%disp% = 1}
message {%idZahl% & " zur Basis " & %Basis% & \
"=^NL^" & %ErgD%}, \
"DezDecode.mscr"
endif
#
set nibs, ""
# falls mehrfach gecallt
exit

Erukat
5th February 2007, 10:48 PM
I want to write a script for missed calls or sms messages that plays a soundfile every 5 minutes. Where can I find information about missed sms messages or calls in the registry (WM2003 Se)?

graemelisa
6th February 2007, 03:21 AM
I am not a programmer but have created a number of mortscript 'scripts'

The first Sync's with Avantgo - With the later version's (of Avantgo) it will not sync automatically when you ActiveSync. Another program can run a program when you ActiveSync - my 'program' is the sript below. It checks when Avantgo was last synced - I have it set to re sync not sooner than 3 hours after it was last done - you need a text file to store the time. It also then rely's on a few MouseClicks which may differ to your screen.

The second is to solve what might be a fairly unique annoyance. My mobile when not answered diverts not to my voicemail but to a 'manned' answering service. This real person takes the message and then sends me a text message - any phone number in this text message is in brackets (""). With a normal mobile phone (not pocket pc) you just hit dial and it calls back those numbers.

This script works in the normal 'inbox', spb diary and even in 'tasks' (must enter a number in tasks in brackets!), it checks which window is active (spb window has no name) and proceeds accordingly. You need vijay555's dialer program (free) for the script to work.

As I am not a programmer, while they work fine I am sure these scripts could be improved - any suggestions let me know.


Sync with Avantgo

ReadFile \Storage Card\Programs\MortRunner\AvantGo.TXT,a
GetTime b
Set c,%a% + 10800
If expression %c% < %b%
Run \Storage\AvantGo Client\AvantGo.exe
WriteFile \Storage Card\Programs\MortRunner\AvantGo.TXT,%b%
WaitFor AvantGo,15
MouseClick 20,310
Sleep 1000
MouseClick 20,175
Sleep 120000
Show Desktop
Close AvantGo
Else
EndIf

Copy phone number from text messages

GetActiveWindow nvm
ErrorLevel off
If equals %nvm%, ""
GetWindowText 28,173, sms
GetPart %sms%, """", 1, 2, number
SetClipText %number%
Sleep 10
run \Program Files\vijay555\VJDialer.exe, %number%
WaitFor "Phone - Dialing...", 5
MouseClick 170,170
SleepMessage 10, %sms%, "SMS Message", 1
EndIf
If equals %nvm%, "Messaging"
GetWindowText 6,88, sms
GetPart %sms%, """", 1, 2, number
SetClipText %number%
Sleep 10
run \Program Files\vijay555\VJDialer.exe, %number%
WaitFor "Phone - Dialing...", 5
MouseClick 170,170
SleepMessage 10, %sms%, "SMS Message", 1
EndIf
If equals %nvm%, "Tasks"
MouseClick 100,40
Sleep 500
MouseClick 5,310
Sleep 500
MouseClick 40,230
Sleep 500
GetClipText sms
GetPart %sms%, """", 1, 2, number
SetClipText %number%
Sleep 10
run \Program Files\vijay555\VJDialer.exe, %number%
WaitFor "Phone - Dialing...", 5
MouseClick 170,170
SleepMessage 10, %sms%, "SMS Message", 1
EndIf

Mort
9th February 2007, 02:25 PM
Where can I find information about missed sms messages or calls in the registry (WM2003 Se)?
Not at all. Those informations are in databases, and I didn't plan to add access fuctions to MortScript because this would require quite some work and memory and would be very system dependant.
Esp. finding out about missed messages is quite complicated work, you have to open the messaging account with COM, and iterate over all contained messages and query the read status.

Treo_newb
16th February 2007, 05:59 PM
For use on the 700wx/w giving keylight control to turn off keylights also changing screen dim.when you make selection press ok you get voice alert telling you the setting you have chosen.
A script and a pic:) Manager-Alerts folder not included.
I have it in cab. download over at treo central
--------------------------------------------------------------------------
Choice "Power","(((KEYLIGHT BACKLIGHT MANAGER)))","KEYLIGHT OFF-Screen 60 sec","KEYLIGHT ON--Screen 60 sec","KEYLIGHT OFF-Screen 30 sec","KEYLIGHT ON--Screen 30 sec","BACKLIGHT MANAGER"
Case 1
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 1 )
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 1 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\On", "kyl0:", 4 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "kyl0:", 4 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "bkl1:", 0 )
%i% = 10
if expression %i% > 1
PlaySound "\Program Files\MortScript\Manager-Alerts\key1.wav"
sleep 0
%i% = %i% -1
endIf
# set custom levels
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 60 )
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 60 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "bkl1:", 1 )
Sleep 500
ToggleDisplay(on)
Case 2
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 1 )
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 1 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\On", "kyl0:", 0 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "kyl0:", 0 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "bkl1:", 0 )
%i% = 10
if expression %i% > 1
PlaySound "\Program Files\MortScript\Manager-Alerts\key2.wav"
sleep 0
%i% = %i% -1
endIf
# set custom levels
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 60 )
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 60 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "kyl0:", 4 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "bkl1:", 1 )
Sleep 500
ToggleDisplay(on)
Case 3
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 1 )
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 1 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\On", "kyl0:", 4 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "kyl0:", 4 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "bkl1:", 0 )
%i% = 10
if expression %i% > 1
PlaySound "\Program Files\MortScript\Manager-Alerts\key3.wav"
sleep 0
%i% = %i% -1
endIf
# set custom levels
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 30 )
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 30 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "bkl1:", 1 )
Sleep 500
ToggleDisplay(on)
Case 4
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 1 )
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 1 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\On", "kyl0:", 0 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "kyl0:", 0 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "bkl1:", 0 )
%i% = 10
if expression %i% > 1
PlaySound "\Program Files\MortScript\Manager-Alerts\key4.wav"
sleep 0
%i% = %i% -1
endIf
# set custom levels
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 30 )
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 30 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "kyl0:", 4 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\BackL ightOff", "bkl1:", 1 )
Sleep 500
ToggleDisplay(on)
Case 5
Run "\Program Files\MortScript\Manager-Alerts\Backlight.lnk"
EndChoice
--------------------------------------------------------------------------
Phil C

daedalia
19th February 2007, 02:41 PM
Simple script to wake up the device and load your favourite audio player when you connect your BT stereo headset. When you disconnect the headset, the player is closed & the device is put back to sleep. Great for my car audio system, now I just get in turn on the stereo and I'm bopping away.

I have a more advanced script that handles MSI Blueplayer properly if anyone is interested.

Needs to be run from the Windows\Start up folder. If you have a mono headset you may have to alter this to route audio through to your headset.

RunCheck = 0
Application = "\Program Files\MSI\BluePlayer\MPOBCE.exe"
WindowName = "MSI BluePlayer"

While (1)
HandsFreeState = RegRead("HKLM", "System\State\Hardware", "Handsfree")
If (HandsFreeState = 1 && RunCheck = 0)
ToggleDisplay(1)

# - The following 4 lines prevent the device powering off & set the backlight to a short period of
# - time, handy for basic audio players.
SleepTimeout = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout")
ScreenTimeout = RegRead ("HKCU", "ControlPanel\Backlight", "BatteryTimeout")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout",0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 20)

Run (Application)

RunCheck = 1
EndIf

If (HandsFreeState = 0 && RunCheck = 1)

If (wndExists (WindowName))
Close(WindowName)
EndIf

# - Restore device power saving settings.
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout",SleepTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", ScreenTimeout)

ToggleDisplay(0)
RunCheck = 0
EndIf

Sleep (1000)
EndWhile

Really chuffed with Mortscipt, well done. A donation is on it's way

esseff
20th February 2007, 01:27 AM
I want to write a script for missed calls or sms messages that plays a soundfile every 5 minutes. Where can I find information about missed sms messages or calls in the registry (WM2003 Se)?

I would so love to find a simple app that does this (PhoneAlarm is way to bloated). Just a beep once every min would suit me fine.

As mentioned by Mort, it seems to be a tricky thing to implement so there is very little out there that does this.

Developers take note: A challenge

V J
20th February 2007, 10:05 AM
I use MortScript to change ringprofiles. Basically, I have put a number of .wma and .wav files (including files that only contain silence) in a folder in My Documents. The sounds I have assigned (both for normal, sms, and specific contacts which have a ringtone assigned in Contacts) are in a different place (called ring_normal, ring_sms, ring_family, ring_work, ...). I have 4 scripts (1 for each profile), which copies the appropriate files to the files that are assigned (overwriting them). Luckily, WM doesn't cache them, so it works instantly. By using a silent file, I can have the functionality of a call filter (e.g. if the contacts that have assigned ring_work as a ringtone, and this ringtone is now replaced by silence, it will not make a sound for these contacts). The scripts also set an indiction on the todayscreen, but this isn't perfect yet (it changes the skin of rltoday, but I still need to reload it manually; the text added is only shown after the todayscreen refreshes):

Default:
# MortScript to change the ringtone profile to default, Dec. 2006

# copy the ringtone files
copy "\My Documents\Ringtones\sll2.wma", "\Windows\Rings\ring_normal.wma", 1
copy "\My Documents\Ringtones\sll9.wma", "\Windows\Rings\ring_family.wma", 1
copy "\My Documents\Ringtones\sll1.wma", "\Windows\Rings\ring_work.wma", 1
copy "\My Documents\Ringtones\magnificent.wma", "\Windows\Rings\ring_nzvc.wma", 1
copy "\My Documents\Ringtones\star_trekkin.wma", "\Windows\Rings\ring_jurgen.wma", 1
copy "\My Documents\Ringtones\sll9_short.wav", "\Windows\ring_sms.wav", 1

# choose vibrate
If question {"Profile set to ""default""^LF^Set vibrate?"},"Vibrate?"
RegWriteString HKCU,"ControlPanel\Sounds\RingTone0","Script","av3pw1r"
Else
RegWriteString HKCU,"ControlPanel\Sounds\RingTone0","Script","apw1r"
EndIf

# set today-indication (in rlToday)
copy "\Program Files\rlToday\VJ\basic_skin.xml", "\Program Files\rlToday\VJ\skin.xml", 1

# set today-indication (blank = default)
RegWriteString HKLM,"Software\Microsoft\Shell\DeviceBeta","Today",""

Message {"Profile set to ""default"" ^LF^no filter"},"Status"


Night (no vibration as it is laying down, some groups are set to silent as is SMS):
# MortScript to change the ringtone profile to night

# copy the ringtone files
copy "\My Documents\Ringtones\silence.wma", "\Windows\Rings\ring_normal.wma", 1
copy "\My Documents\Ringtones\sll9.wma", "\Windows\Rings\ring_family.wma", 1
copy "\My Documents\Ringtones\sll1.wma", "\Windows\Rings\ring_work.wma", 1
copy "\My Documents\Ringtones\magnificent.wma", "\Windows\Rings\ring_nzvc.wma", 1
copy "\My Documents\Ringtones\silence.wma", "\Windows\Rings\ring_jurgen.wma", 1
copy "\My Documents\Ringtones\silence.wav", "\Windows\ring_sms.wav", 1

RegWriteString HKCU,"ControlPanel\Sounds\RingTone0","Script","apw1r"

# set today-indication (in rlToday)
copy "\Program Files\rlToday\VJ\night_skin.xml", "\Program Files\rlToday\VJ\skin.xml", 1

# set today-indication (blank = default)
RegWriteString HKLM,"Software\Microsoft\Shell\DeviceBeta","Today","night"

Message {"Profile set to ""night"" ^LF^filter on family/work/nzvc^LF^vibrate off"},"Status"


Other profiles I use are similar. I then also have some scripts to change registry settings easily when I need to hard reset.

BT name
RegReadString HKCU,"Software\Microsoft\Bluetooth\Settings","LocalName",currentname
Input name,0,{"Current name: " & %currentname% & " Enter new bluetooth name:"},"Change bluetooth name"

If equals %name%,""
Message {"Bluetooth name NOT changed"},"Status"
Else
RegWriteString HKCU,"Software\Microsoft\Bluetooth\Settings","LocalName",%name%
Message {"Bluetooth name changed to " & %name%},"Status"
EndIf


change BT A2DP settings
# MortScript to adjust the Bluetooth A2DP quality

set bitpool, "1"

While not ((%bitpool% eq "") or (%bitpool% eq "30") or (%bitpool% eq "40") or (%bitpool% eq "48") or (%bitpool% eq "58") )
Input bitpool,1,"Enter the Bitpool value (quality: low=30, 40, 48, 58=high)","Set bitpool"
EndWhile

If not (%bitpool% eq "")
RegWriteDWord HKLM,"Software\Microsoft\Bluetooth\A2DP\Settings",BitPool,%bitpool%
message {"bitpool set to " & %bitpool% & "."} ,"status"
If question {"Use real stereo (yes), or the default joint stereo (no)."},"Stereo setting"
RegWriteDWord HKLM,"Software\Microsoft\Bluetooth\A2DP\Settings",UseJointStereo,0
message {"Real stereo set."},"status"
Else
RegWriteDWord HKLM,"Software\Microsoft\Bluetooth\A2DP\Settings",UseJointStereo,1
message {"Joint stereo set."},"status"
EndIf
Else
message {"Cancelled."},"status"
EndIf


Wireless today item
# MortScript to add a wireless today item
# Today item
RegWriteDWord HKLM,"SOFTWARE\Microsoft\Today\Items\""Wireless""","Flags",0
RegWriteDWord HKLM,"SOFTWARE\Microsoft\Today\Items\""Wireless""","Options",0
RegWriteString HKLM,"SOFTWARE\Microsoft\Today\Items\""Wireless""","DLL","netui.dll"
RegWriteDWord HKLM,"SOFTWARE\Microsoft\Today\Items\""Wireless""","Order",0
RegWriteDWord HKLM,"SOFTWARE\Microsoft\Today\Items\""Wireless""","Enabled",1
RegWriteDWord HKLM,"SOFTWARE\Microsoft\Today\Items\""Wireless""","Type",4

# Make clickable, link to CommManager
RegWriteString HKLM,"ControlPanel\WrlsMgr","Redirect","\Windows\CommManager.exe"

If question {"Today item created. A soft reset is required. ^CR^Reset now?"},"Reset"
Reset
Else
message {"The Today item will not be available until a soft reset."},"Information"
EndIf



Jörg

PS: If anyone has a better suggestion for displaying the active ring profile, please let me know! :)

Treo_newb
21st February 2007, 06:43 PM
I would so love to find a simple app that does this (PhoneAlarm is way to bloated). Just a beep once every min would suit me fine.

As mentioned by Mort, it seems to be a tricky thing to implement so there is very little out there that does this.

Developers take note: A challengeWhat I got so far.
__________________________________________________ _______________
# Reminder.mscr - Monitors notifications and turns on and off the alert chime accordingly.
#

# initialize variables
Ringersw = 1

# start notification check loop
While ( 1 )

# check the registry for any notifications
Notify = RegValueExists( "HKLM", "System\State\Shell\Notifications\Active", "CLSID" )

#check the ringer switch on/off
Ringersw = RegRead( "HKLM", "System\State\Hardware\", "Ringer" )

# turn on the sound if any notifications are pending whenever Ringer on. Keep turning on each iteration since
# the OS turns it off whenever there is a new notification.
If ( Notify && Ringersw )
Run "\Program Files\MortScript\Manager-Alerts\Alert.mscr"
LedOn = TRUE
EndIf

# turn off sound if no notifications are pending
If ( NOT Notify )
KillScript ("Alert.mscr")
EndIf

# wait 1 seconds
Sleep( 2000 )
EndWhile
__________________________________________________ _______________
The Alert .mscr Script

#Alert.mscr-alert
ToggleDisplay (on)
%i% = 10
if expression %i% > 1
PlaySound "\Program Files\MortScript\Manager-Alerts\Reminder.wav"
sleep 800
%i% = %i% -1
endIf

__________________________________________________ _______________

Problem.
I can not figure out timestamps to save my life:eek:
any one can build a chime-reminder script that alert you every 2 min we are set.I can tie that into alert.mscr

We then have are missed call/v-mail/sms repeating alert for wm

neomagik
27th February 2007, 10:33 AM
Can anyone tell me how I get my script to run once certain criteria have been achieved?

For example I wish for the following script to run once a specific registry change is set but I can’t seem to get it to work automatically. The script does work but I have to invoke it myself.

What I require is for the A2DP ‘Set as Wireless Stereo’ to connect upon recognition that the handsfree profile has been enabled.

I’ve been trying the “While” command as well but no joy with that either. Can a script be continually running in the background but dormant until certain criteria are set?

The following script is in my Windows/StartUp folder.

#Check state of Handsfree profile
HandsFreeEnabled = RegRead("HKLM", "System\State\Hardware", "Handsfree")

#Connect A2DP if in Handsfree profile
If (HandsFreeEnabled = 1)

Run "Windows\Shortcut to Bluetooth Devices.lnk"
Sleep 2000
MouseDown "Settings", 39, 106
sleep 1000
MouseUp "Settings", 39, 106
Sleep 500
SendUp
SendCR
Sleep 1000
MouseDown "Settings", 106, 39
Sleep 500
MouseUp "Settings", 234, 39
Sleep 1000
Close "Settings"
Sleep 2000
EndIf

markvan
27th February 2007, 11:00 PM
Just do this:

While(1)
{Your Code}
Sleep(5000)
EndWhile

This will process your code every five seconds.

Treo_newb
28th February 2007, 02:29 PM
I would so love to find a simple app that does this (PhoneAlarm is way to bloated). Just a beep once every min would suit me fine.

As mentioned by Mort, it seems to be a tricky thing to implement so there is very little out there that does this.

Developers take note: A challengeIt was built for the Treo WM.It may work on the diffrent devices as well.
3 script become one giving a a reminder beep every 2 min when you have unattended -missed call/Voice mail/sms text.When pending is cleared reminder beep is as well.I put it in cab for easy download. devolpers chip in-hannip/Scottymomo/slingbox.
http://discussion.treocentral.com/showthread.php?t=137887

################################################## ##
#ALERT.mscr-Gives alert for all to enjoy when messages pending.
#
# check dependencies
If ( NOT FileExists( "\Program Files\MortScript\Chime.mscr" ) )
Message ( "Installation of Chime.mscr is required! Exiting...", "ALERT script" )
Exit
EndIf

# initialize variables
Notify = FALSE
ChimeIsOn = FALSE
Ringersw = 1

# start notification check loop
While ( 1 )

# check the registry for any notifications
Notify = RegValueExists( "HKLM", "System\State\Shell\Notifications\Active", "CLSID" )

#check the ringer switch on/off
Ringersw = RegRead( "HKLM", "System\State\Hardware\", "Ringer" )

# turn on Chime if any notifications are pending whenever Ringer on.
If ( Notify && Ringersw && NOT ChimeIsOn )
CallScript( "\Program Files\MortScript\REMINDER\Chime.mscr" )
ChimeIsOn = TRUE
EndIf

# turn off the Chime if no notifications are pending
If ( ChimeIsOn && NOT Notify )
RemoveNotifications( "\Program Files\MortScript\REMINDER\Chime.mscr" )
ChimeIsOn = FALSE
EndIf
# wait 5 seconds
Sleep( 5000 )

EndWhile

################################################## ##
#
# Chime.mscr - Plays the file of your choice
#
ErrorLevel ("syntax")



#play whatever wav file you want
CallScript("\Program Files\MortScript\REMINDER\wav.mscr")

#Set when the script should run again, 2 minutes from the current time
Rerun = Timestamp()+120
RunAt( Rerun, "\Program Files\MortScript\REMINDER\Chime.mscr" )
################################################## ##
#wav.mscr-Makes noise
%i% = 10
if expression %i% > 1
PlaySound "\Program Files\MortScript\REMINDER\notify.wav"
sleep 1000
%i% = %i% -1
endIf

daedalia
1st March 2007, 01:53 PM
neomagik; my previous post is exactly what you are after but there's your code modified to my script below. Markvan's loop will work but you have to check if the code has been executed otherwise it will run on every loop while the headset is connected and you probably don't want that.

RunCheck = 0
While (1)
HandsFreeState = RegRead("HKLM", "System\State\Hardware", "Handsfree")
If (HandsFreeState = 1 && RunCheck = 0)
ToggleDisplay(1)
Run "Windows\Shortcut to Bluetooth Devices.lnk"
Sleep 2000
MouseDown "Settings", 39, 106
Sleep 1000
MouseUp "Settings", 39, 106
Sleep 500
SendUp
SendCR
Sleep 1000
MouseDown "Settings", 106, 39
Sleep 500
MouseUp "Settings", 234, 39
Sleep 1000
Close "Settings"
Sleep 2000
RunCheck = 1
EndIf

If (HandsFreeState = 0 && RunCheck = 1)
# - Enter any code you wish to execute on disconnect here.
ToggleDisplay(0)
RunCheck = 0
EndIf

Sleep (1000)
EndWhile

Actually looking at your code I'm a bit confused as to what you are trying to achieve. Wireless audio is a service like handsfree which should be enabled when you connect to your BT device, ie when "HKLM\System\State\Hardware\Handsfree" gets set to 1 so there is no need to go through the settings to enable it. Usually the BT audio device will connect when turned on or when you press a button on the device and that is what you are listening for with the "HKLM\System\State\Hardware\Handsfree" key. If you tap & hold on your BT device under the bluetooth settings and select edit you should see handsfree & wireless stereo services with check boxes next to them. If ticked they will be enabled on connection.

Try the script in my previous post, that wakes the device up & loads an audio player automatically when a BT Stereo Headset is connected. When you disconnect the program is closed & the device put back to sleep.

dragonedge
1st March 2007, 08:33 PM
Could anyone possibly upload the cab or exe file for this program.

The site seems to be down, I'm not 100% sure cause its all in german and google translation isn't that great but i did click on just about everything in sight with no luck.

Thanks.

Curious D
2nd March 2007, 07:04 AM
What I would do is have a batch file to toggle BTaudio, then SpeakingClock, then toggle BTaudio off. I would like to link the batch file to Voice Speed Dial and have the clock program funnel the time to the BT headset. Anyone have ideas on how to write such a batch file on Mortscript? Thanks.

Update: Sorry. The manual had the info. Thanks anyways.

neomagik
2nd March 2007, 02:38 PM
Thanks Markvan and daedalia,

daedalia, I've actually managed to get it working now and your absolutely right, the wireless audio SHOULD connect with the handsfree profile but it doesn't. The wireless audio device that I'm using is a Pioneer DEH P75BT car stereo. There are two bluetooth modes on the stereo, "BT Audio" and "Telephone". The Telephone (Handsfree) will automatically "search & connect" to the phone but the BT Audio doesn't even have this option and will not connect unless I manually set it, hence the reason for the script.

I'm now searching for the location of the registry entry that enables the "Set as Wireless Stereo" so that I can remove the screen tap simulations in the script and replace them for the "RegWrite" command.

I thought I'd found it here:
HKLM > SOFTWARE > Microsoft > Bluetooth > Device > Pioneer BT Unit > Services > Wireless Stereo > enabled

but it appears that it is enabled permanently, even when bluetooth is switched off.

somainer
3rd March 2007, 06:42 PM
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.

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 - thanks for the script! I used it as a model for creating my own - which toggles between inititating an activesync connection via bluetooth and turning bluetooth off on my phone.


#AS_via_BT_toggle.mscr
If (ReadFile("\Program Files\MortScript\ASviaBT_toggle_LastState.txt")=0)
Run("\Windows\Start Menu\ActiveSync.lnk")
Sleep (4000)
SendRightSoft()
SendKeys("6")
SendLeftSoft()
WriteFile("\Program Files\MortScript\ASviaBT_toggle_LastState.txt",1)
Else
Run("\Windows\Start Menu\Accessories\ToggleBTh.exe")
WriteFile("\Program Files\MortScript\ASviaBT_toggle_LastState.txt",0)
EndIf

anyone know where I can find out the registry keys and range of values possible for determining bluetooth status on my Cingular 3125 phone (manufactured by HTC) running WM 5.0. I tried the pathway provided by le_cactus (actually, modifed slightyl to reflect recent chagnes in MortSCript), but get an error message that no such registy key exists. Is there some kind of repository for this info? As a workaround for not being able to determine the bluetooth status directly, I based the if/then part of the script (i.e., the part that drives the toggle function) on the value in the file "ASviaBT_toggle_LastState.txt (0 = Bluetooth was turnde off last tiem the script was run; 1 = ActiveSync via Bluetooth was intitiated last time). it works fine, particularly for my purposes since I only use Bluetooth for syncing, but it's not as elegant as the registry query by le_cactus.

cheers, greg (of team somainer)

Treo_newb
5th March 2007, 02:06 AM
le_cactus - thanks for the script! I used it as a model for creating my own - which toggles between inititating an activesync connection via bluetooth and turning bluetooth off on my phone.


#AS_via_BT_toggle.mscr
If (ReadFile("\Program Files\MortScript\ASviaBT_toggle_LastState.txt")=0)
Run("\Windows\Start Menu\ActiveSync.lnk")
Sleep (4000)
SendRightSoft()
SendKeys("6")
SendLeftSoft()
WriteFile("\Program Files\MortScript\ASviaBT_toggle_LastState.txt",1)
Else
Run("\Windows\Start Menu\Accessories\ToggleBTh.exe")
WriteFile("\Program Files\MortScript\ASviaBT_toggle_LastState.txt",0)
EndIf

anyone know where I can find out the registry keys and range of values possible for determining bluetooth status on my Cingular 3125 phone (manufactured by HTC) running WM 5.0. I tried the pathway provided by le_cactus (actually, modifed slightyl to reflect recent chagnes in MortSCript), but get an error message that no such registy key exists. Is there some kind of repository for this info? As a workaround for not being able to determine the bluetooth status directly, I based the if/then part of the script (i.e., the part that drives the toggle function) on the value in the file "ASviaBT_toggle_LastState.txt (0 = Bluetooth was turnde off last tiem the script was run; 1 = ActiveSync via Bluetooth was intitiated last time). it works fine, particularly for my purposes since I only use Bluetooth for syncing, but it's not as elegant as the registry query by le_cactus.

cheers, greg (of team somainer)

Try here

B = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\State", "Bluetooth" )

If ( B = 1 )
Call Blueon
Else
If ( B = 0 )
Call Blueoff

Curious D
5th March 2007, 07:53 AM
Hi. I have been looking at this thread and came across part of a script written by le_cactus:

RegReadDWord HKLM, System\State\Hardware, Bluetooth, Bluetooth
If Expression %Bluetooth% <= 8
Set BluetoothWas, "Off"

Does this direct the device to see if the BT is on and if so, then shut it down? I have linked BTaudioToggle and Speakingclock together, but unfortunately, sometimes the BT does not disengage before BTaudioToggle starts causing it to toggle the headset off and the time then goes through the speakers rather than the headset. I'm looking for a way to ensure the BT is disengaged (but not shut off) before starting up the rest of the script. Does the above script do this and will it work for the 8125? Thanks.

_TB_TB_
5th March 2007, 07:55 PM
Generic registry value changer with two examples ;)

# Generic Registry string value setter
# Written by TB for fun ;)

valuelabel[1] = "Today text"
valueroot[1] = "HKLM"
valuepath[1] = "Software\\microsoft\\Shell\\DeviceBeta"
valuename[1] = "Today"
title[1] = "Today text changer"

valuelabel[2] = "BT name"
valueroot[2] = "HKCU"
valuepath[2] = "Software\\microsoft\\bluetooth\\settings"
valuename[2] = "LocalName"
title[2] = "BT name changer"

x = Choice("Universal Changer","Select an option to customize:",1,999, title)

if(x eq 0)
exit

nowynapis = Input("Current "&valuelabel[x]&" is: """ &RegRead(valueroot[x], valuepath[x], valuename[x])&""". Specify new "&valuelabel[x]&":", title[x])
If(Question("Set the new "&valuelabel[x]&" to """&nowynapis&"""?^CR^Tap ""No"" to leave it unchanged.", title[x], "YesNo"))
RegWriteString(valueroot[x], valuepath[x], valuename[x], nowynapis)
endif


add more lines as:

valuelabel[next_free_index] = "Label to be displayed within the texts"
valueroot[next_free_index] = "ROOT_KEY" (HKLM, HKCU, HKCR)
valuepath[next_free_index] = "Path\\with\\double\\backslashes"
valuename[next_free_index] = "NameOfTheValueToSet"
title[next_free_index] = "Title for boxes and list entry"

somainer
6th March 2007, 05:32 PM
Try here

B = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\State", "Bluetooth" )

If ( B = 1 )
Call Blueon
Else
If ( B = 0 )
Call Blueoff

thanks for the suggestion! oddly, it only works some of the time. not sure if there is some delay in updating the registry and/or reading from it, or if my use of ToggleBTh has any effect. but the reg value doesn't appear to return to 0 consistently after turning bluetooth off - I confirmed this by crafting a script that simply writes the registry value to a file - WriteFile("\Program Files\MortScript\BTstatus.txt", RegRead ("HKLM", "System\CurrentControlSet\Control\Power\State", "Bluetooth"))

oh well... my original solution, albeit not an elegant, seems to be working well enough, so I guess I will stick with that.

daedalia
7th March 2007, 09:50 AM
Thanks Markvan and daedalia,

daedalia, I've actually managed to get it working now and your absolutely right, the wireless audio SHOULD connect with the handsfree profile but it doesn't. The wireless audio device that I'm using is a Pioneer DEH P75BT car stereo. There are two bluetooth modes on the stereo, "BT Audio" and "Telephone". The Telephone (Handsfree) will automatically "search & connect" to the phone but the BT Audio doesn't even have this option and will not connect unless I manually set it, hence the reason for the script.

I'm now searching for the location of the registry entry that enables the "Set as Wireless Stereo" so that I can remove the screen tap simulations in the script and replace them for the "RegWrite" command.

I thought I'd found it here:
HKLM > SOFTWARE > Microsoft > Bluetooth > Device > Pioneer BT Unit > Services > Wireless Stereo > enabled

but it appears that it is enabled permanently, even when bluetooth is switched off.

Ahh, the mouse clicks are probably the only way then, I think that reg setting stores whether you have checked the Wireless Stereo box. What's the BT audio quality like on that model of stereo?

neomagik
7th March 2007, 10:34 AM
The quality is excellent, equal to that of playing an mp3 disc in the stereo.

_TB_TB_
9th March 2007, 04:56 PM
# Generic Registry string and dword value setter
# Some sample tweaks below...
# Written by TB for fun ;)

valuelabel[1] = "Today text"
valueroot[1] = "HKLM"
valuepath[1] = "Software\\microsoft\\Shell\\DeviceBeta"
valuename[1] = "Today"
title[1] = "Today text changer"
type[1] = "String"

valuelabel[2] = "BT name"
valueroot[2] = "HKCU"
valuepath[2] = "Software\\microsoft\\bluetooth\\settings"
valuename[2] = "LocalName"
title[2] = "BT name changer"
type[2] = "String"

valuelabel[3] = "Device name"
valueroot[3] = "HKLM"
valuepath[3] = "Ident"
valuename[3] = "Name"
title[3] = "Device name changer"
type[3] = "String"

valuelabel[4] = "Device description"
valueroot[4] = "HKLM"
valuepath[4] = "Ident"
valuename[4] = "Desc"
title[4] = "Device description changer"
type[4] = "String"

valuelabel[5] = "IR OBEX state"
valueroot[5] = "HKLM"
valuepath[5] = "SOFTWARE\\Microsoft\\Obex"
valuename[5] = "IsEnabled"
title[5] = "IR OBEX enabler (0=off, 1=on)"
type[5] = "Dword"
default[5] = 0

valuelabel[6] = "Hide Roaming icon"
valueroot[6] = "HKLM"
valuepath[6] = "Drivers\\BuiltIn\\RIL"
valuename[6] = "DisableRoamingIndicator"
title[6] = "Roaming icon display (0=on, 1=off)"
type[6] = "Dword"
default[6] = 0

valuelabel[7] = "Hide SMS sent msg"
valueroot[7] = "HKLM"
valuepath[7] = "SOFTWARE\\Microsoft\\Inbox\\Settings"
valuename[7] = "SMSNoSentMsg"
title[7] = "SMS Sent msg (0=off, 1=on)"
type[7] = "Dword"
default[7] = 0

valuelabel[8] = "Delivery reports always on"
valueroot[8] = "HKCU"
valuepath[8] = "SOFTWARE\\Microsoft\\Inbox\\Settings"
valuename[8] = "SMSDeliveryNotify"
title[8] = "Delivery reports (0=off, 1=on)"
type[8] = "Dword"
default[8] = 0

valuelabel[9] = "ClearType Gamma"
valueroot[9] = "HKLM"
valuepath[9] = "System\\GDI\\Gamma"
valuename[9] = "Gamma Value"
title[9] = "ClearType Gamma (Default=1500)"
type[9] = "Dword"
default[9] = 1500

valuelabel[10] = "ClearType disabled on landscape"
valueroot[10] = "HKLM"
valuepath[10] = "System\\GDI\\ClearTypeSettings"
valuename[10] = "OffOnRotation"
title[10] = "ClearType disabled on rotation (0=enabled, 1=disabled on rot.)"
type[10] = "Dword"
default[10] = 1

valuelabel[11] = "Windows animation"
valueroot[11] = "HKLM"
valuepath[11] = "System\\GWE"
valuename[11] = "Animate"
title[11] = "Animation: windows (0=off, 1=on)"
type[11] = "Dword"
default[11] = 0

valuelabel[12] = "Menus animation"
valueroot[12] = "HKLM"
valuepath[12] = "System\\GWE\\Menu"
valuename[12] = "AniType"
title[12] = "Animation: menus (0=off, 6=on)"
type[12] = "Dword"
default[12] = 6

valuelabel[13] = "Wait cursor interval"
valueroot[13] = "HKLM"
valuepath[13] = "System\\GWE"
valuename[13] = "CursorFrameInterval"
title[13] = "Animation: pinwheel;) (100=default ms)"
type[13] = "Dword"
default[13] = 100

x = Choice("Universal Changer","Select an option to customize:", 1, 999, title)

if(x eq 0)
exit
else
nowynapis = Input("Current "&valuelabel[x]&" is: """ &RegRead(valueroot[x], valuepath[x], valuename[x])&""". Specify new

"&valuelabel[x]&":", title[x], (type[x] eq "Dword"))
if((nowynapis eq "")&&(type[x] eq "Dword"))
nowynapis = default[x]
endif
If(Question("Set the new "&valuelabel[x]&" to """&nowynapis&"""?^CR^Tap ""No"" to leave it unchanged.", title[x], "YesNo"))
if(type[x] eq "String")
RegWriteString(valueroot[x], valuepath[x], valuename[x], nowynapis)
else
RegWriteDword(valueroot[x], valuepath[x], valuename[x], nowynapis)
endif
endif
endif
Expanded version of my previous script, some tweaks added... ;)

meroupow
11th March 2007, 12:56 PM
Is there a way to control WIFI with regkeys?

I would like to turn on wifi before connect to network and copy the latest podcasts from my computer to my pda.

I tried VJVolubilis but it doesn't work for wifi with my P3600 although it's working for bluetooth...

_TB_TB_
11th March 2007, 03:40 PM
Browse the VJVolubilis thread - someone posted there WiFiTempOn.exe and WiFiTempOff.exe. it may help.

Treo_newb
11th March 2007, 04:49 PM
TomTom Stealth
A pretty cool little script that turns off treo 700wx/w keylights on tomtom navagation Start.You must have Slinghann Treo keylight installed for the below to work.That can be found,
http://discussion.treocentral.com/showthread.php?t=137887

I Put togther a combo zip yesterday that has Them both in cab
download.Resource files are on board so pretty shortcut are had
http://discussion.treocentral.com/showthread.php?t=138588

Phil C
__________________________________________________ _______________
# TomTom Stealth.mscr - Diables keylight on TomTom Navagation start
##########SLiNG CReATiONs##############
#Notes-Treo keylight mscr location-Mortscript folder
#
Run( "\Program Files\Navigator\TomTom Navigator.exe" )
Z = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\On", "kyl0:" )

If ( Z = 0 )
Call Slinghann

Sub Slinghann

CallScript( "\Program Files\MortScript\Treo Keylight.mscr" )

meroupow
19th March 2007, 12:08 PM
Browse the VJVolubilis thread - someone posted there WiFiTempOn.exe and WiFiTempOff.exe. it may help.

thanks,
WiFiTempOn.exe and WiFiTempOff.exe are working fine for me.

I am making a podcast synchronisation script that is working in 4 steps:
- make a file listing of all files in my podcast directory on my PC with (filename, filesize, filecreatetime)

- sort this list by date and keep only the latest podcasts names within a predefined size limit

- delete all podcasts files on my storage card that are not in the sorted list

- copy all podcasts files in the sorted list from PC to PPC (using wifi)

It is working ok but my sorting algorithme is poor and slow:



# this script takes a CSV text list of (filename, filesize, date), sorts it by date and creates a list of (filename, filesize, date) where sum of filesize < limit
#initialisation
limit=iniread(systempath("ScriptPath") \ "config.ini","general","limit")
podcasts_list_path=systempath("ScriptPath") \ "podcasts_list.txt"
podcasts_list_sorted=systempath("ScriptPath") \ "podcasts_list_sorted.txt"
podcasts_list=readfile(podcasts_list_path)
writefile(podcasts_list_sorted,"",0)

#load list of podcasts on remote PC in an array
i=1
foreach line in split (podcasts_list, "^CR^",1)
list[i]=line
i=i+1
endforeach

#sort list of podcasts by date
repeat(i-3)
x=1
repeat(i-3)
d1=part(list[x],";",3)
d2=part(list[x+1],";",3)
if (d1<d2)
list[0]=list[x]
list[x]=list[x+1]
list[x+1]=list[0]
endif
x=x+1
endrepeat
endrepeat

#write the list of podcasts to be copied to ppc according to size limit
size=0
size_sync=0
foreach line in array list
size=size+part(line,";",2)
if (size<limit)
line_nl=line & "^NL^"
writefile(podcasts_list_sorted, line_nl, 1)
size_sync=size_sync+part(line,";",2)
endif
endforeach

mes="Synchronised data= " & size_sync/1024 & " over " & size/1024
message(mes)



Does anybody have a way to improve it?

Once it is finished I will share th script.

Treo_newb
24th March 2007, 06:52 AM
BUILT FOR TREO 700 WX/W
__________________________________________________ ______________
#ALERT CONTROL.mscr-Sends Hit to Remind mscr and Ledup.


# initialize variables
Notify = FALSE
ChimeIsOn = FALSE


# start notification check loop
While ( 1 )

# check the registry for any notifications
Notify = RegValueExists( "HKLM", "System\State\Shell\Notifications\Active", "CLSID" )

#check the ALERT
ALERT = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ALERT" )


# turn on Chime if any notifications are pending whenever Ringer on.
If ( Notify && NOT ChimeIsOn && ALERT )
RunWait( "\Windows\LEDUp.exe", "0 1" )
CallScript( "\Program Files\TREO ALERT\REMIND.mscr" )
ChimeIsOn = TRUE
EndIf

# turn off the Chime if no notifications are pending
If ( ChimeIsOn && NOT Notify )
RunWait( "\Windows\LEDUp.exe", "0 0" )
RemoveNotifications( "\Program Files\TREO ALERT\REMIND.mscr" )
ChimeIsOn = FALSE
EndIf
# wait 1 seconds
Sleep( 2000 )

EndWhile
################################################## ##
################################################## ##

#TREOSET.mscr -Turn on/off Treo Alert working with icon

A = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ALERT" )

If ( A = 0 )
Call ALERTON
Else
Call ALERTOFF
EndIf

Sleep 500
ToggleDisplay(on)

Sub ALERTON

RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ALERT", 1 )
RegWriteString "HKLM","System\State\Phone","Current Operator Name", TREO ALERT- ACTIVE

EndSub

Sub ALERTOFF

RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ALERT", 0 )
RegWriteString "HKLM","System\State\Phone","Current Operator Name", TREO ALERT- OFF
Run ( "\Windows\LEDUp.exe", "0 0" )
RemoveNotifications( "\Program Files\TREO ALERT\REMIND.mscr" )


EndSub
################################################## ##
#Start.mscr-A short cut added to Start up folder for soft reset Carrier bar also droping reg string

Sleep 5000
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ALERT", 0 )
Sleep 10000
RegWriteString "HKLM","System\State\Phone","Current Operator Name", TREO ALERT- HELLO

################################################## ##

#
# REMIND.mscr - Controls Reminder repeat
#
ErrorLevel ("syntax")

PlaySound "Program Files\TREO ALERT\Reminder.wav"


Run( "\Program Files\TREO ALERT\VIB.mscr" )

Sleep 1000

#Set when the script should run again, 2 minutes from the current time
Rerun = Timestamp()+120
RunAt( Rerun, "\Program Files\TREO ALERT\REMIND.mscr" )

################################################## ##

#VIB.mscr - vib vib and more vib

V = RegRead( "HKLM", "System\State\Hardware\", "Ringer" )
If ( V = 0 )
Run ( "\Windows\LEDUp.exe", "1 1" )
Sleep 1200
Run ( "\Windows\LEDUp.exe", "1 0" )
################################################## ##

One icon tap turns on treo alert .Once active if there are missed calls/v-mail/text/email the led
Will blink and theres also a reminder sound every 2 min till pending missed are cleared.
If you put your ringer on mute the vib alert reminder will turn on every 2 min as well.The vib
alert length is from 7 - 10 sec so you will be alerted.
This build is far more superior-Dependable to past beta builds.It took me a coupel days to get there and now it,s here.I do need an icon though so I will release a build tonight with scotty chime icon and when new icon is made available I will upgrade to TREO ALERT with no numbers.
The build will be complete

INSTALL DIRECTIONS,
1)Drop cab file in My Documents folder and give it a screen tap.
2)After it installs give it a min then do a softreset.
3)After reset complets watch you carrier Plugin.It will take a few
seconds and you will see the first pic below.
4)go to program menu and give the Treo Alerts icon a screen tap.
5)Return back to today screen and your carrie plugin will look like 2 pic below.
Your Treo Alert is now Active.
When you dont want alerts on give icon a screen tap and you will have pic 3 view.

Trouble shoot if needed,
After you install cab.If you get a pop up message go to the TREO ALERT
folder located in program files.Open TREO ALERT folder and give screen
tap to Mortscript.exe file
Give it a min then do Softreset.
Your good to go.

BUILT FOR TREO 700 WX/W
no need for mortscript pre installed

Enjoy
Phil C

SCREEN PICS AND CAB FILE DOWNLOAD CAN BE FOUND AT

http://discussion.treocentral.com/showpost.php?p=1225361&postcount=57

moisha
26th March 2007, 06:51 PM
@Mort

Hallo,

Thanks for the excellent tool. It makes my HTC complete now.

I noticed that the size of the latest beta you posted this morning is twice the size of the official 4.0 - Is that a debug version or is it the result of the evolution :-)

Regards

dragonedge
26th March 2007, 09:00 PM
I want to see if its possilbe to have the Camera LED flash when receiving a phone call but i cannot find any type of executable, setting, anything except through camera.exe if it can be turned on there must be something.

Any ideas?

moisha
26th March 2007, 09:34 PM
I want to see if its possilbe to have the Camera LED flash when receiving a phone call but i cannot find any type of executable, setting, anything except through camera.exe if it can be turned on there must be something.

Any ideas?


Yup. Take a look at vijay's VJCandelaLite.

Rabia
29th March 2007, 11:04 AM
Based on mix and mansh between the prevoise posts i came up with this tool for people with Dual Sim Card adapter

# This tool is put on the start up folder of windows, if you always prefere to # have an operator to be your default this will do it.
# In my case Du should always be secondary, so if you turn your device on
# it will check what operator is on, if it Du then it switches it to the Primary # operator
# Check Which Operator?

Sleep 20000
# Sleep is a bit long (20000) just to allow the device to boot everything &
# find the network
RegReadString HKLM, System\State\Phone, Current Operator Name, Operator
# Du is the Name of operator
If Equals %Operator%, "Du"
Run \Program Files\MortScript\VJV.exe, -radiooff
Sleep 500
Run \Program Files\MortScript\VJV.exe, -radioon
Sleep 500
# The below part is to set that operator with its Specific GPRS settings
# enabled
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\du Internet, Enabled,0
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\Etisalat, Enabled,1

##################END#########################

This tool is a sim card switcher with the ability to select the specific Gprs connection of either operator

# The smart thing about this program is that once clicked it will check which
# operator is now active, then switches the settings, then switch the card
# to the other operator, i tried witching cards first then connecting settings
# but it doesn't work coz sometimes you be be switching cards in a lift so the
# sleep finishs & network is not detected so it fucks up the settings.

# Check Which Operator?

RegReadString HKLM, System\State\Phone, Current Operator Name, Operator
###### i need help here, sometimes when it switches it give me "UMTS Du"
###### so my script won't be able to read it, how can i put a conditional
###### command, something like if equals %operator%, "Du" OR "UMTS Du"
###### does that make sense?
If Equals %Operator%, "Du"

RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\du Internet, Enabled,0
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\Etisalat, Enabled,1
else
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\du Internet, Enabled,1
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\Etisalat, Enabled,0
EndIf
Run \Program Files\MortScript\VJV.exe, -radiooff
Sleep 500
Run \Program Files\MortScript\VJV.exe, -radioon
Sleep 500

Treo_newb
30th March 2007, 05:09 AM
NEW VERSION
TREO ALERT 4.2 SPRINT SCRIPT VIEW


################################################## ##
#ALERT CONTROL.mscr-Sends Hit to Remind mscr and Ledup.

# initialize variables
Notify = FALSE
ChimeIsOn = FALSE

# start notification check loop
While ( 1 )

# check the registry for any notifications
Notify = RegValueExists( "HKLM", "System\State\Shell\Notifications\Active", "CLSID" )

#check the ALERT
ONOFF = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF" )

# turn on Chime if any notifications are pending whenever Ringer on.
If ( Notify && NOT ChimeIsOn && ONOFF )
RunWait( "\Windows\LEDUp.exe", "0 1" )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle", 1 )
CallScript( "\Program Files\TREO ALERT\REMIND.mscr" )
ChimeIsOn = TRUE
EndIf

# turn off the Chime if no notifications are pending
If ( ChimeIsOn && NOT Notify )
RemoveNotifications( "\Program Files\TREO ALERT\REMIND.mscr" )
RunWait( "\Windows\LEDUp.exe", "0 0" )
ChimeIsOn = FALSE
EndIf
# wait 1 seconds
Sleep( 2000 )

EndWhile
################################################## #
#Treo Alert.mscr -Turn on/off Treo Alert

A = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF" )

If ( A = 0 )
Call ALERTON
Else
Call ALERTOFF
EndIf

Sleep 500
ToggleDisplay(on)

Sub ALERTON
PlaySound "Program Files\TREO ALERT\ON.wav"
Sleep 500
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF", 1 )
RegWriteString "HKLM","System\State\Phone","Current Operator Name", TREO ALERT- ACTIVE
NOTIFY = RegValueExists( "HKLM", "System\State\Shell\Notifications\Active", "CLSID" )
If ( NOTIFY )
Run ( "\Program Files\TREO ALERT\RESTART.mscr" )
EndIf

EndSub

Sub ALERTOFF
PlaySound "Program Files\TREO ALERT\OFF.wav"
Sleep 500
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF", 0 )
RegWriteString "HKLM","System\State\Phone","Current Operator Name", TREO ALERT- OFF
Run ( "\Windows\LEDUp.exe", "0 0" )
RemoveNotifications( "\Program Files\TREO ALERT\REMIND.mscr" )

EndSub
################################################## ##
#
# REMIND.mscr - Controls Reminder repeat
#
ErrorLevel ("syntax")

Run("\Program Files\TREO ALERT\WAV.mscr" )

Run("\Program Files\TREO ALERT\VIB.mscr" )

Sleep 800
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle", 0 )

#Set when the script should run again, 2 minutes from the current time
Rerun = Timestamp()+120
RunAt( Rerun, "\Program Files\TREO ALERT\REMIND.mscr" )
################################################## ##
Restart.mscr-Restarts Reminder after turned off

Run ( "\Program Files\TREO ALERT\REMIND.mscr" )
Run ( "\Windows\LEDUp.exe", "0 1" )
################################################## ##
WAV.mscr-Sends

W = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle" )
If ( W = 0 )
PlaySound "Program Files\TREO ALERT\Reminder.wav"
################################################## #
#VIB.mscr -Sound and vib
B = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle" )
If ( B = 0 )
V = RegRead( "HKLM", "System\State\Hardware\", "Ringer" )
If ( V = 0 )
Run ( "\Windows\LEDUp.exe", "1 1" )
Sleep 1400
Run ( "\Windows\LEDUp.exe", "1 0" )
EndIf
################################################## #
#Start.mscr

Sleep 5000
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle", 1 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF", 0 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ALERT", 0 )
Sleep 10000
RemoveNotifications( "\Program Files\TREO ALERT\REMIND.mscr" )
RegWriteString "HKLM","System\State\Phone","Current Operator Name", TREO ALERT 4.2 HELLO
################################################## ##

TREO ALERT 4.2 SPRINT WX
TREO ALERT 4.2 VERIZON WX/W
NEW AND IMPROVED
Features,

1)Reminder Alert after 2 min and every 2 min till pendings are cleared.
2)VIB Alert when Ringer mute after 2 min and every 2 min till pendings are cleared.
3)Increased Vib Reminder length
4)louder Alert Reminder.
5)led blink-green if pending are present.
6)If you have pending messages and turn off
using icon alert will stop.If messages are pending
and you turn on treo alert the reminder will start
Till cleared

Install,

1)Drop TREO ALERT 4.2 in Your My Documents folder.
2)Give cab file a screen tap
3)After cab installs give Your Treo a Softreset.
4)Watch You Carrier plugin.You will see TREO ALERT-HELLO
5)Go to your programs menu and tap Treo Alert Icon
6) you will hear-treo alert active.
7)Go back to your today screen and you will notice
Carrie plugin you will see TREO ALERT- ACTIVE
Mortscript.exe file in cab
No mort seperate install :)


CAB file located in zips
Enjoy

Phil C

dragonedge
30th March 2007, 10:46 PM
Yup. Take a look at vijay's VJCandelaLite.

Doesn't work with wizard :(

codyppc
31st March 2007, 05:20 AM
NEW VERSION
TREO ALERT 4.2 SPRINT SCRIPT VIEW


################################################## ##
#ALERT CONTROL.mscr-Sends Hit to Remind mscr and Ledup.

# initialize variables
Notify = FALSE
ChimeIsOn = FALSE

# start notification check loop
While ( 1 )

# check the registry for any notifications
Notify = RegValueExists( "HKLM", "System\State\Shell\Notifications\Active", "CLSID" )

#check the ALERT
ONOFF = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF" )

# turn on Chime if any notifications are pending whenever Ringer on.
If ( Notify && NOT ChimeIsOn && ONOFF )
RunWait( "\Windows\LEDUp.exe", "0 1" )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle", 1 )
CallScript( "\Program Files\TREO ALERT\REMIND.mscr" )
ChimeIsOn = TRUE
EndIf

# turn off the Chime if no notifications are pending
If ( ChimeIsOn && NOT Notify )
RemoveNotifications( "\Program Files\TREO ALERT\REMIND.mscr" )
RunWait( "\Windows\LEDUp.exe", "0 0" )
ChimeIsOn = FALSE
EndIf
# wait 1 seconds
Sleep( 2000 )

EndWhile
################################################## #
#Treo Alert.mscr -Turn on/off Treo Alert

A = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF" )

If ( A = 0 )
Call ALERTON
Else
Call ALERTOFF
EndIf

Sleep 500
ToggleDisplay(on)

Sub ALERTON
PlaySound "Program Files\TREO ALERT\ON.wav"
Sleep 500
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF", 1 )
RegWriteString "HKLM","System\State\Phone","Current Operator Name", TREO ALERT- ACTIVE
NOTIFY = RegValueExists( "HKLM", "System\State\Shell\Notifications\Active", "CLSID" )
If ( NOTIFY )
Run ( "\Program Files\TREO ALERT\RESTART.mscr" )
EndIf

EndSub

Sub ALERTOFF
PlaySound "Program Files\TREO ALERT\OFF.wav"
Sleep 500
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF", 0 )
RegWriteString "HKLM","System\State\Phone","Current Operator Name", TREO ALERT- OFF
Run ( "\Windows\LEDUp.exe", "0 0" )
RemoveNotifications( "\Program Files\TREO ALERT\REMIND.mscr" )

EndSub
################################################## ##
#
# REMIND.mscr - Controls Reminder repeat
#
ErrorLevel ("syntax")

Run("\Program Files\TREO ALERT\WAV.mscr" )

Run("\Program Files\TREO ALERT\VIB.mscr" )

Sleep 800
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle", 0 )

#Set when the script should run again, 2 minutes from the current time
Rerun = Timestamp()+120
RunAt( Rerun, "\Program Files\TREO ALERT\REMIND.mscr" )
################################################## ##
Restart.mscr-Restarts Reminder after turned off

Run ( "\Program Files\TREO ALERT\REMIND.mscr" )
Run ( "\Windows\LEDUp.exe", "0 1" )
################################################## ##
WAV.mscr-Sends

W = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle" )
If ( W = 0 )
PlaySound "Program Files\TREO ALERT\Reminder.wav"
################################################## #
#VIB.mscr -Sound and vib
B = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle" )
If ( B = 0 )
V = RegRead( "HKLM", "System\State\Hardware\", "Ringer" )
If ( V = 0 )
Run ( "\Windows\LEDUp.exe", "1 1" )
Sleep 1400
Run ( "\Windows\LEDUp.exe", "1 0" )
EndIf
################################################## #
#Start.mscr

Sleep 5000
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle", 1 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF", 0 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ALERT", 0 )
Sleep 10000
RemoveNotifications( "\Program Files\TREO ALERT\REMIND.mscr" )
RegWriteString "HKLM","System\State\Phone","Current Operator Name", TREO ALERT 4.2 HELLO
################################################## ##

TREO ALERT 4.2 SPRINT WX
TREO ALERT 4.2 VERIZON WX/W
NEW AND IMPROVED
Features,

1)Reminder Alert after 2 min and every 2 min till pendings are cleared.
2)VIB Alert when Ringer mute after 2 min and every 2 min till pendings are cleared.
3)Increased Vib Reminder length
4)louder Alert Reminder.
5)led blink-green if pending are present.
6)If you have pending messages and turn off
using icon alert will stop.If messages are pending
and you turn on treo alert the reminder will start
Till cleared

Install,

1)Drop TREO ALERT 4.2 in Your My Documents folder.
2)Give cab file a screen tap
3)After cab installs give Your Treo a Softreset.
4)Watch You Carrier plugin.You will see TREO ALERT-HELLO
5)Go to your programs menu and tap Treo Alert Icon
6) you will hear-treo alert active.
7)Go back to your today screen and you will notice
Carrie plugin you will see TREO ALERT- ACTIVE
Mortscript.exe file in cab
No mort seperate install :)


CAB file located in zips
Enjoy

Phil C

nice job treo newb.

where is your treo alert timer script?

Treo_newb
3rd April 2007, 07:05 AM
I just got done Building the 4.8 Pro version of TREO ALERTS :)
I have about 20 PM,s in my box with hungry 750 owners wanting this app.I will make them happy first then The timer script will be yours :)

Rabia
3rd April 2007, 09:21 AM
Just a quick question, what is the best possible example if i want to run X.exe for a defined duration then run Y.exe after it for another duration

I.E.

Run X.exe for 90 Mins then Run Y.exe for 30 min then back to X.exe for 90 Mins & back to y.exe for 30 Mins & SO ON all day every day

regards

Treo_newb
3rd April 2007, 05:40 PM
Ok guys it's come to this hmmm Pro.It,s a funny word that means alot to most and that why I put the label on this build...
Now what it does for you.It gives you led blink / Reminder alert / Vib alert for missed calls/V-mail/sms text and E-mail.
What makes this build the pro word is Verbal missed call count and Verbal voice mail notification .what I mean Is if you miss call you will hear a chime sound then you will hear..One missed call.It will tell you if you have missed up to five calls .once you exceed 5 missed call,s it will say..Missed calls need attention .If you get voice mail it will say...Voice mail pending then give you call count.
After you dismiss all pending it takes your missed call count to 0
If you get text messages you will only hear the Chime reminder sound.
Vib feature will kick in if you have your ringer switch on mute
How to install,

Drop cab file located in zip into your my documents folder then give it a tap.
Wait for it to install wait a min then softreset.Watch your today screen carrier pluging.It will say..WELCOME TO TREO ALERT.
once you see that go to programs menu and give Treo Alerts icon a screen tap.You will hear.Treo Alert active.Make your test missed call. 2 min after the miss call you will hear chime sound and missed call count.If it says 1,2,3,4,5 or missed call need attention that how many you have missed.Once you dismiss missed call led blink will stop and Treo Alerts will set your missed call count to 0. Dont forget the vib feature It gives you vib alert every 2 min after pending

4.8 build can be found at,

http://discussion.treocentral.com/showthread.php?t=139440&page=17

Treo_newb
4th April 2007, 02:06 AM
TREO ALERTS 4.8 PRO Script View:)

################################################## ##
#ALERT CONTROL.mscr-Sends Hit to Remind mscr and Ledup.
Sleep 5000
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle", 1 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF", 0 )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ALERT", 0 )
Sleep 10000
RemoveNotifications( "\Program Files\TREO ALERT\REMIND.mscr" )
RegWriteString "HKLM","System\State\Phone","Current Operator Name",WELCOME TO TREO ALERTS
RegWriteString "HKLM","Software\Microsoft\Ril","CarrierName",WELCOME TO TREO ALERTS

# initialize variables
Notify = FALSE
ChimeIsOn = FALSE
LedOn = FALSE

# start notification check loop
While ( 1 )

# check the registry for any notifications
Notify = RegValueExists( "HKLM", "System\State\Shell\Notifications\Active", "CLSID" )

#check the ALERT
ONOFF = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF" )

# turn on Chime if any notifications are pending whenever Ringer on.
If ( Notify && NOT ChimeIsOn && ONOFF )
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle", 1 )
CallScript( "\Program Files\TREO ALERT\REMIND.mscr" )
ChimeIsOn = TRUE
EndIf

# turn on the led if any notifications are pending. Keep turning on each iteration since
# the OS turns it off whenever there is a new notification.
If ( Notify && ONOFF )
RunWait( "\Windows\LEDUp.exe", "0 1" )
LedOn = TRUE
EndIf


# turn off the Chime if no notifications are pending
If ( ChimeIsOn && NOT Notify )
RemoveNotifications( "\Program Files\TREO ALERT\REMIND.mscr" )
RegWriteDWord( "HKCU","System\State\Phone", "Missed Call Count", 0 )
ChimeIsOn = FALSE
EndIf

# turn off the led if no notifications are pending
If ( LedOn && NOT Notify )
RunWait( "\Windows\LEDUp.exe", "0 0" )
LedOn = FALSE
EndIf


# wait 1 seconds
Sleep( 2000 )

EndWhile
################################################## ##

#Treo Alert.mscr -Turn on/off Treo Alert

A = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF" )

If ( A = 0 )
Call ALERTON
Else
Call ALERTOFF
EndIf

Sleep 500
ToggleDisplay(on)

Sub ALERTON
PlaySound "Program Files\TREO ALERT\ON.wav"
Sleep 500
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF", 1 )
RegWriteString "HKLM","System\State\Phone","Current Operator Name", TREO ALERTS ((ACTIVE))
RegWriteString "HKLM","Software\Microsoft\Ril","CarrierName", TREO ALERTS ((ACTIVE))
NOTIFY = RegValueExists( "HKLM", "System\State\Shell\Notifications\Active", "CLSID" )
If ( NOTIFY )
Run ( "\Program Files\TREO ALERT\REMIND.mscr" )
Run ( "\Windows\LEDUp.exe", "0 1" )
EndIf

EndSub

Sub ALERTOFF
PlaySound "Program Files\TREO ALERT\OFF.wav"
Sleep 500
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "ONOFF", 0 )
RegWriteString "HKLM","System\State\Phone","Current Operator Name", TREO ALERTS -DISABLED-
RegWriteString "HKLM","Software\Microsoft\Ril","CarrierName", TREO ALERTS -DISABLED-
RemoveNotifications( "\Program Files\TREO ALERT\REMIND.mscr" )
Run ( "\Windows\LEDUp.exe", "0 0" )

EndSub
################################################## ##

#ALERTS.mscr -Sound and vib
N = RegRead( "HKLM", "System\State\Phone", "Palm Active Call Count" )
If ( N = 0 )
B = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle" )
If ( B = 0 )
V = RegRead( "HKLM", "System\State\Hardware\", "Ringer" )
If ( V = 0 )
Run ( "\Windows\LEDUp.exe", "1 1" )
Sleep 1400
Run ( "\Windows\LEDUp.exe", "1 0" )
EndIf

N = RegRead( "HKLM", "System\State\Phone", "Palm Active Call Count" )
If ( N = 0 )
S = RegRead("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle" )
If ( S = 0 )
PlaySound "Program Files\TREO ALERT\Reminder.wav"
CallScript( "\Program Files\TREO ALERT\V-mail.mscr" )
D = RegRead ("HKCU","System\State\Phone", "Missed Call Count" )
If ( D = 1 )
PlaySound "Program Files\TREO ALERT\1.wav"
Else
If ( D = 2 )
PlaySound "Program Files\TREO ALERT\2.wav"
Else
If ( D = 3 )
PlaySound "Program Files\TREO ALERT\3.wav"
Else
If ( D = 4 )
PlaySound "Program Files\TREO ALERT\4.wav"
Else
If ( D = 5 )
PlaySound "Program Files\TREO ALERT\5.wav"
Else
If ( D = 6 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 7 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 8 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 9 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 10 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 11 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 12 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 13 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 14 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 15 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 16 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 17 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 18 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 19 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
Else
If ( D = 20 )
PlaySound "Program Files\TREO ALERT\MCALLNEED.wav"
################################################## ##

#
# REMIND.mscr - Controls Reminder repeat
#
ErrorLevel ("syntax")


Run("\Program Files\TREO ALERT\ALERTS.mscr" )
RunWait( "\Windows\LEDUp.exe", "0 1" )
Sleep 800
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\led", "Toggle", 0 )


#Set when the script should run again, 2 minutes from the current time
Rerun = Timestamp()+120
RunAt( Rerun, "\Program Files\TREO ALERT\REMIND.mscr" )
################################################## ##

#Vmail.mscr-vmail sound

T = RegRead ( "HKCU", "System\State\Messages\vmail\Total\Unread", "Count" )
If ( T= 1 )
PlaySound "Program Files\TREO ALERT\VM.wav

################################################## ##

Rabia
4th April 2007, 04:26 PM
This is another contribution for dual sime card holder

Program one
1- install it in the startup & i will alternate between individual operators at specific duration you fancy
2- it will also select the MMS & GPRS settings of each operator when selected
3- Moreover it will select a specific ringtone with this operator
4- the script may need some house keeping but i ask the professionals to give me some alternative ways if any

#Intall this script in the startup folder of windows
#40 seconds to allow the phone top properly boot & find a signal
SleepMessage 40, Searching For Signal ......
Run \Program Files\MortScript\Auto-Sim-Switcher.mscr

#Install this in the directory of Mortscript
# Check Which Operator?
Repeat 5000
SleepMessage 2, Initializing ...., Auto Switch
RegReadString HKLM, System\State\Phone, Current Operator Name, Operator
If Equals %Operator%, "UMTS Du"
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\du Internet, Enabled, 0
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\Etisalat, Enabled, 1
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\Etisalat MMS, Enabled, 0
RegWriteString HKCU, ControlPanel\Sounds\RingTone0, Sound, \Storage Card\Mobily.MP3
Run \Program Files\MortScript\VJV.exe, -radiooff
Sleep 9000
Run \Program Files\MortScript\VJV.exe, -radioon
SleepMessage 10, Switching to Etisalat <===>, Auto Switch
Sleep 3600000
EndIf

RegReadString HKLM, System\State\Phone, Current Operator Name, Operator
If Equals %Operator%, "Du"
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\du Internet, Enabled, 0
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\Etisalat, Enabled, 1
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\Etisalat MMS, Enabled, 1
RegWriteString HKCU, ControlPanel\Sounds\RingTone0, Sound, \Storage Card\Mobily.MP3
Run \Program Files\MortScript\VJV.exe, -radiooff
Sleep 9000
Run \Program Files\MortScript\VJV.exe, -radioon
SleepMessage 10, Switching to Etisalat <===>, Auto Switch
Sleep 3600000
EndIf

RegReadString HKLM, System\State\Phone, Current Operator Name, Operator
If Equals %Operator%, "UMTS Etisalat"
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\du Internet, Enabled, 1
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\Etisalat, Enabled, 0
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\Etisalat MMS, Enabled, 0
RegWriteString HKCU, ControlPanel\Sounds\RingTone0, Sound, \Storage Card\UaeDu.MP3
Run \Program Files\MortScript\VJV.exe, -radiooff
Sleep 9000
Run \Program Files\MortScript\VJV.exe, -radioon
SleepMessage 10, Switching to Du <===>, Auto Switch
Sleep 1200000
EndIf

RegReadString HKLM, System\State\Phone, Current Operator Name, Operator
If Equals %Operator%, "Etisalat"
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\du Internet, Enabled, 1
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\Etisalat, Enabled, 0
RegWriteDWord HKLM, Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\Etisalat MMS, Enabled, 0
RegWriteString HKCU, ControlPanel\Sounds\RingTone0, Sound, \Storage Card\UaeDu.MP3
Run \Program Files\MortScript\VJV.exe, -radiooff
Sleep 9000
Run \Program Files\MortScript\VJV.exe, -radioon
SleepMessage 10, Switching to Du <===>, Auto Switch
Sleep 1200000
EndIf

EndRepeat

crazie.eddie
5th April 2007, 07:58 AM
Is there anyway to combine values together?

For example, I have:


A="The "
B="end"
C=%A% + %B%



I want the value of C to return "The end", by a zero is returned instead,

EDIT: I figured it out a solution, but doing the following...
%C% = %A% &""& %B%

joeuser
9th April 2007, 03:05 PM
hi scripties.

mortscript has a WinExists. But can it also catch and act on those bubble-like requesters that pop up when a gprs connection is dialed or fails? i want to get rid of them automatically.

joeuser

helipilote
11th April 2007, 11:49 AM
dear

I'm trying to create a script in order to enable btaudio then TOMTOM6 and to close btaudio at the end
but the following script doesn't work
quote
****************
# lancement de bt audio
Run \Program Files\bt audio\BTAudioOn.exe
Sleep 2000

# lancement de tomtom
Run \Program Files\navigator\TomTom navigator.exe
Sleep 1000

#arret de tomtom6 par l'intermédiaire de l'appli tomtom

# arret de bt audio
Run \Program Files\bt audio\BTAudioOff.exe
Sleep 2000

*******************
unquote
could you help me please
for information it's possible to enable btaudio through the explorer or total commander but never thruogh a script like mine.

thanks for your help

a4ace
11th April 2007, 02:31 PM
hi scripties.

mortscript has a WinExists. But can it also catch and act on those bubble-like requesters that pop up when a gprs connection is dialed or fails? i want to get rid of them automatically.

joeuser
you can prevent the connecting bubble through the notification setup but if like me you only want to disable it when running something like tomtom you can check my script. the cannot connect bubble cannot be turned off so i just run a loop while tomtom is running to check if tomtom is active or not and if not, revives it to foreground. sometimes it's instant but sometimes takes several seconds to re activate tomtom. don't know if it will work for you but see.

# ace_ttn_start.mscr
# launch tomtom and keep active, set volume to max

# initialize values
ErrorLevel("syntax")
ttn_exe = "\Program Files\Navigator\TomTom Navigator.exe"
ttn_ttl = "TomTom Navigator"
intrval = 2000

# turn off connection established notification
mem_conn = RegRead("HKCU","ControlPanel\Notifications\{8ddf46e7-56ed-4750-9e58-afc6ce486d03}","options")
RegWriteDWord("HKCU","ControlPanel\Notifications\{8ddf46e7-56ed-4750-9e58-afc6ce486d03}","options",0)

# adjust volume
mem_vol = RegRead("HKCU","ControlPanel\Volume","Volume") * 255 / 4294967295
SetVolume(255)

# launch tomtom
Run(ttn_exe)
WaitFor(ttn_ttl, 30)

# keep tomtom active
While(WndExists(ttn_ttl))
If (NOT WndActive(ttn_ttl))
Show(ttn_ttl)
EndIf
Sleep(intrval)
EndWhile

# replace changed values
RegWriteDWord("HKCU","ControlPanel\Notifications\{8ddf46e7-56ed-4750-9e58-afc6ce486d03}","options",mem_conn)
SetVolume(mem_vol)

a4ace
11th April 2007, 02:41 PM
dear

I'm trying to create a script in order to enable btaudio then TOMTOM6 and to close btaudio at the end
but the following script doesn't work
quote
****************
# lancement de bt audio
Run \Program Files\bt audio\BTAudioOn.exe
Sleep 2000

# lancement de tomtom
Run \Program Files\navigator\TomTom navigator.exe
Sleep 1000

#arret de tomtom6 par l'intermédiaire de l'appli tomtom

# arret de bt audio
Run \Program Files\bt audio\BTAudioOff.exe
Sleep 2000

*******************
unquote
could you help me please
for information it's possible to enable btaudio through the explorer or total commander but never thruogh a script like mine.

thanks for your help

you should wait for tomtom to exit before stopping btaudio. look at my previous post. there's a while loop that checks if tomtom is running.

helipilote
11th April 2007, 03:09 PM
My problem is not to close application but to open btaudio before tomtom and in this case i don't see what could be a good script to activate btaudio before tomtom

the only third line don't run correctly even if they are alone on a script

that's my problem

a4ace
11th April 2007, 03:38 PM
what i think is happening is that after launching tomtom...

Run \Program Files\navigator\TomTom navigator.exe

mortscript resumes and does not wait for tomtom to close. so while tomtom is running, your script also continues on to...

Sleep 1000

#arret de tomtom6 par l'intermédiaire de l'appli tomtom

# arret de bt audio
Run \Program Files\bt audio\BTAudioOff.exe
Sleep 2000

so in effect, you are turning btaudio on, then immediately turning it off.

that's what i think is happening. you can confirm this if you update your code to not turn btaudiooff, just for test so...

# lancement de bt audio
Run \Program Files\bt audio\BTAudioOn.exe
Sleep 2000

# lancement de tomtom
Run \Program Files\navigator\TomTom navigator.exe
Sleep 1000

#arret de tomtom6 par l'intermédiaire de l'appli tomtom

# arret de bt audio
#Run \Program Files\bt audio\BTAudioOff.exe
#Sleep 2000

if this still doesn't work, then sorry, can't help more.

helipilote
11th April 2007, 05:11 PM
finally I success with the following script

# lancement de bt audio
Run \Program Files\bt audio\BTAudioOn.exe
Sleep 2000

# lancement de tomtom
Runwait \Program Files\navigator\TomTom navigator.exe
Sleep 1000

#arret de tomtom6 par l'intermédiaire de l'appli tomtom

# arret de bt audio
Run \Program Files\bt audio\BTAudioOff.exe
Sleep 2000

the solution was to use a runwait for the tomtom application then the script stop till the closure of tomtom

So like this the script is running very well

Hope to help other people

what i think is happening is that after launching tomtom...



mortscript resumes and does not wait for tomtom to close. so while tomtom is running, your script also continues on to...



so in effect, you are turning btaudio on, then immediately turning it off.

that's what i think is happening. you can confirm this if you update your code to not turn btaudiooff, just for test so...



if this still doesn't work, then sorry, can't help more.

Treo_newb
13th April 2007, 07:34 PM
At last 4.9.
control the alerts settings..2 min reminder/Vib alert/led blink
Verbal missed call count and Verbal voice mail notification .what I mean Is if you miss call you will hear a chime sound then you will hear..One missed call.It will tell you if you have missed up to five calls .once you exceed 5 missed call,s it will say..Missed calls need attention .If you get voice mail it will say...Voice mail pending then give you call count.
After you dismiss all pending it takes your missed call count to 0
If you get text messages you will only hear the Chime reminder sound.
Vib feature will kick in if you have your ringer switch on mute.

I have a jpeg below shows all the good stuff
4.9 PRO
Added features
1)control over the alert settings
2)The Voice alerts and alert tone sounds are improved=easy to hear...Thank cody for that.
3)Added longer vib length
4) vib for voice mail.=Two long vib alerts.

Jpeg view for viewing pleasure and link to the goodies


http://discussion.treocentral.com/showpost.php?p=1238349&postcount=447

codyppc
13th April 2007, 08:55 PM
good job treo_newb. works great.

joeuser
16th April 2007, 08:03 AM
did anybody succeed in sending an email via script? preferably directly with something like sendmailppc (does it exist? i utterly fail with google). or maybe with an interface to flexmails outbox?

thanks,
joe.

mistrix
17th April 2007, 05:43 PM
did anybody succeed in sending an email via script? preferably directly with something like sendmailppc (does it exist? i utterly fail with google). or maybe with an interface to flexmails outbox?

thanks,
joe.

Try to run something like
tmail.exe -Service "MailAccount_as_in_account_list" -to "name" -cc "nextname" -bcc "othername" -subject "yy" -body "your message here"
tmail.exe -Sync
with run () or runwait () for IMAP or POP accounts.

run ("\windows\repllog.exe", "/remote /all /h /p:all")

for an exchange sync.

joeuser
17th April 2007, 07:49 PM
tmail.exe does not work with flexmail :(

entariows
23rd April 2007, 05:01 AM
Hi Geniuses all around the world!!!

I have discovered Moscript a few days ago and have since used it to launch a few applications all together with it. It is a simple programming so I don't see the need to share it here!!! But I am stuck on how to do these jobs below, can anyone please show me how(if it is possible or not) with Moscript?:confused:

1. Dial automatically a long distance number with a calling card
2. Automatically switch to folder POP3 and synconize emails at the same time...
3. Syncronize my rss feeds using PocketRSS
4. More to come...:rolleyes:

Curious D
26th April 2007, 07:59 PM
In similar line to the request above, I was wondering how to construct a script that would enable a program which requires manual updates to become automatic updates once the Active Sync cable is plugged in. Specifically, I'm looking to automatically update weather data on all my locations for a nifty weather program called Weather Watcher Mobile. If there was a cookie cutter method of pasting the names of the programs, I'm guessing a script could be developed to automatically update any program that requires manual update. Thanks for the help.

garydempsy
7th May 2007, 11:08 PM
Here is a mortscript I wrote to help automate cab installs after a rom update.
http://forum.xda-developers.com/showthread.php?t=305962

kismat1970
9th May 2007, 05:19 PM
Is MortScript able to run an application after a set number of idle minutes (i.e. a screensaver or lock application to run after 5 minutes idle usage) ?

Treo_newb
11th May 2007, 12:53 AM
I TREID TO POST SCRIP BUT IT IS VERY LONG...
A LITTLE OF WHAT IT NOW DOES,

1)led alerts
2)two min reminder alerts
3) voice alerts for all your pendings
4)12 different display views keeping you informed of alert status..Battery/Signal/Memory/today's date and on and on
5)voice missed call count in reminder
6)voice text message reminders
Hehe all of the reminders are voice alerts but there is a pretty chime also
7)The new voice call ID reminder that tells you the last missed callers phone number every 2 min till you dismiss the pending.

ALERT SETTING CHOICES

=DISPLAY SETTING CHOICE MENU= <----12 different today screen layout for the plugin
[4]=ALL REMINDER & VIBE & LED <--Reminder with vibe and led
[3]=REMINDER & VIBE & LED <---You must have your ringer on mute to get vibe feature.
[2]=REMINDER & VIBE <-----Same as above with no led alert
[1]=LED ALERT <-----Led alert only
DISABLE <---turns off all alerts.
*CALLER ID REMINDER <---This is a reminder setting that will say the last incoming callers phone number when missed every 2 min until you dismiss the pending.This setting works on [4] , [3] and [2].When you have the feature active you will see
* located next to status symbol...example [3]* when it is turned off..example [3]:


WERE YOU CAN FIND IT,

http://discussion.treocentral.com/showpost.php?p=1253570&postcount=770

helmsley76
26th May 2007, 05:13 AM
hi, can i request somebody to write a script that enable my treo 750v to flash the led green light whenever there is reception? i know my default the led is off. thanks

timekeeper
26th May 2007, 05:19 AM
Wow, I had no idea you could do so much with it. Is there a script that turns on Wi Fi, without going through Connection Manager?

Treo_newb
28th May 2007, 10:01 AM
The first App that makes different led alert colors a reality for the wm treo.The TA Have taken scripts to the next level.

http://discussion.treocentral.com/showpost.php?p=1266493&postcount=930

_TB_TB_
29th May 2007, 12:33 AM
#########################################
# Simple notification - based hour chime
# ver. 1.2
# 07.10.2008
# Optimized for battery saving - next
# notification added for specfic hour,
# with regard to mute time
# Created by TB
#########################################

########## Configuration:
# "soundfile" defines the WAV to be played during full hour
# "mute[]" defines hour range, during which the chime will
# be mute
# "vibe" defines wether use also vibe engine to notify full hour
soundfile = "\bip.wav"
mute[0] = 23
mute[1] = 6
vibe = 1
########## End of configuration

exepath = SystemPath("ScriptExe") & "\MortScript.exe"
scriptpath = SystemPath("ScriptPath") & "\" & SystemPath("ScriptName") & SystemPath("ScriptExt")

RemoveNotifications(exepath, scriptpath)

x = Timestamp()
GetTime(hour, minute, seconds)
offset = minute * 60 + seconds

if((hour > mute[1]) && (hour < mute[0]))
PlaySound(soundfile)

if(vibe = 1)
Vibrate(100)
sleep(250)
Vibrate(100)
endif
newhour = 1
else
newhour = mute[1] - hour + 1
if(newhour < 1)
newhour = newhour + 24
endif
endif

RunAt(x + (3600 * newhour) - offset, exepath, scriptpath)


Just run the script once (remember to specify an existing WAV file in the first line!)

neomagik
1st June 2007, 02:26 PM
Is there a fuction to pass dialogue messages to a desktop computer from the phone whilst connected via the usb cable?

dolkin
19th June 2007, 11:09 AM
Is it possible to check if a Wifi connection is active.

I want to make a script to use activesync via Wifi but only if my phone is connected to my HomeWifi or JobWifi.

i've tryed this but dont work :
sleep 100000 <-- to wait wifi connexion
if (connected() = "HomeWifi")
run \windows\async.asy
WaitForActive "ActiveSync", 5
MouseClick "ActiveSync",60,318
sleep 120000 <-- to wait sync
Close ("Activesync")
sleep 60000
endif
poweroff

Can you help me to debug my script ?

markvan
20th June 2007, 12:55 AM
I use:
if(RegRead("HKLM", "System\State\Hardware", "Wifi") = 0)
0 means off
1 means on

mistrix
20th June 2007, 09:17 AM
Is it possible to check if a Wifi connection is active.

I want to make a script to use activesync via Wifi but only if my phone is connected to my HomeWifi or JobWifi.

You may want to check the value of HKLM\System\State\Connections\Network\Descriptions versus the SSIDs of your accepted WiFis.

If Wifi is connected the value contains the SSID of the connected network.

Something like


if (RegRead("HKLM", "System\State\Connections\Network", "Descriptions") \
eq "HomeWifiSSID_here" \
or \
RegRead("HKLM", "System\State\Connections\Network", "Descriptions") \
eq "WorkWifiSSID_here")
# your activesync code here
#...
endif


should do the trick, at least for WM5 / WM6 ;-)

dolkin
20th June 2007, 10:16 AM
thank's for this....

my first test at my job work perfectly.....

dancer_69
21st June 2007, 12:05 AM
I try to use this kind of script In a Wisbar Advance Desktop theme, so to be able to show a dock when I push a button and hide some others. This commands worked ok in another theme with the mortscript 3x version. Now I use the new version, and I know that the run commands work ok(I test them) and something goes wrong with the registry or switch commands(maybe the syntax is wrong). I don't know mutch of how to use mortscript, I read the manual but I cannot understand a lot(my english are not very good).
Can any one that knows more to help me on this, and correct the syntax if is wrong somewhere?

code:
================================================== ====
RUN \Program Files\Lakeridge\WisBar Advance Desktop\DesktopApp.exe, --show-dock=clock_info

RegReadDWord HKCU,Software,CurrentDock,prevdock

Switch %prevdock%
Case 2
Run \Program Files\Lakeridge\WisBar Advance Desktop\DesktopApp.exe, --hide-dock=office
Case 3
Run \Program Files\Lakeridge\WisBar Advance Desktop\DesktopApp.exe, --hide-dock=media
EndSwitch

RegWriteDWord HKCU,Software,CurrentDock,1
================================================== ======

thanks in advance!

SeanFromSoCal
22nd June 2007, 04:34 AM
Just wondering about MortScripts capabilities. Is it possible for you to change WA skin, WAD skin, background theme, and WeatherPanel template? That would be awesome so when I switch from one skin suite to another everything is changed properly. Is this possible with MortScipt?

freeyayo50
22nd June 2007, 05:24 PM
Just wondering about MortScripts capabilities. Is it possible for you to change WA skin, WAD skin, background theme, and WeatherPanel template? That would be awesome so when I switch from one skin suite to another everything is changed properly. Is this possible with MortScipt?

Yes, it is possible to do all that with Mortscript. You can change some reg entries and have them all change.

hasanemara
23rd June 2007, 04:57 AM
soundfile = "\ding.wav"
mute[0] = 23
mute[1] = 6
vibe = 1

// -------------------------------------------
// -------------------------------------------
exepath = SystemPath("ScriptExe") & "\MortScript.exe"
scriptpath = SystemPath("ScriptPath") & "\" & SystemPath("ScriptName") & SystemPath("ScriptExt")
x = Timestamp()
GetTime(hour, minute, seconds)
hour = hour + 1
hour = hour - 1
offset = 0
if((seconds > 0) || (minute > 0))
offset = minute * 60 + seconds
endif

if((hour > mute[1]) && (hour < mute[0]))
PlaySound(soundfile)
if(vibe = "1")
Vibrate(100)
sleep(250)
Vibrate(100)
endif
endif

RemoveNotifications(exepath, scriptpath)
RunAt(x + 3600 - offset, exepath, scriptpath)


sorry for my no-experience
How can I apply this script in the device?

_TB_TB_
23rd June 2007, 02:09 PM
hasanemara, just copy the script onto your PDA, change the soundfile = "\ding.wav" line to point to an existing WAV file and run the script once.
The lines:
RemoveNotifications(exepath, scriptpath)
RunAt(x + 3600 - offset, exepath, scriptpath)
do the rest.

gguyaz
26th June 2007, 04:25 PM
Nice application! Could it be possible to execute sound with wifi. I mean bip are quicker near a wifi source and slower if we go away this wifi source.

neonstorm
11th July 2007, 03:22 AM
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.


#Basic script to set no timeouts and full brightness while using Destinator
#Read registry settings
...




Senergy, this is pretty cool and sounds awfully close to something I need to do. I'm using Slide2Unlock (http://forum.xda-developers.com/showthread.php?t=304826&highlight=mortscript) and to fix a problem I'm having (http://forum.xda-developers.com/showthread.php?p=1359491#post1359491) I need a way to keep my device from going into standby while the phone is active, i.e. I'm making a call. After I hang up, I would like the power setting to return to normal.

Your script sounds pretty close, except I need a way to tell if the phone is active instead of a certain app being open...

Anyone have any pointers? I'm just starting to fiddle around with this program, and I'm already pretty impressed...

Thanks!!

Ryan


***EDIT*** I guess to clarify, I should ask if there is any way for MortScript to determine whether the phone line is open or not? If I can do that, then I'll be able to devise some other way to keep the device alive pretty easily...

Thanks!!

neonstorm
11th July 2007, 10:01 PM
I think I may have it. After skimming through the registry, I found the key that reports the phone's status! It's very basic, so please tell me if you guys have a better idea of keeping the phone alive:

#read the reg key that indicates phone status
PhoneActive = RegRead ("HKLM", "system\state\phone\","status")
#determine if phone line is active
if equals %phoneactive%, 546308256
#reset idle timer to avoid auto power off
idletimerreset
EndIf
sleep 20000
#start over
run \my documents\phone.mscr

It seems to work really well. I'm testing it a little more thoroughly now... The 'status' value may or may not be the same for different devices, but that's it for a TMO Wing w/WM6. I just wish there was a way to do this with the backlight timer too...

Sadly, the system uses another timer for turning off the background light, which can't be queried or
modified (at least there's no documentation about it). So there's no way to avoid that.

Mortscript rocks!

Ryan

TauTau
13th July 2007, 03:45 PM
my volume slider on the Wizard works on the device volume when used, not on the ringer. So I'm thinking about having buttons in claunch to set the volume to some specific value (i.e. 20%, 40%). I have found a registry key under HKCU/ControlPanel/Volume/Ringer, but there are quite obscure numbers. Any rule how to handle this?

cra3y
23rd July 2007, 01:07 AM
also i'm looking for backlight timer (in registry, counting down) or registry value that will show, if backlight/screen is on or off, but still no results :-(

craigiecraigie4
23rd July 2007, 12:34 PM
Hi folks, can someone pleae tell me if there's a way to monitor the notifications queue for new additions, and then alert me as to what's been added? Specificlly I want to debug NQ issues (scarybear software has not worked from WM5 onwards), and even iterate thro the NQ and kill rogue issues.

I THINK, that cos the notifications are in a DB, Mortscript cannot access this, and the Active registry key is only for currently active notifications (ie you'd have to watch that key awfully frequently to build a notificaitons log).

__s
26th July 2007, 11:08 AM
how to run script or anything before login, after restart on wm6?

famewolf
26th July 2007, 11:21 AM
Anyone taking requests?

Can mortscript be used to auto email a picture just taken by the camera to a default email address using the outlook account already setup?

neomagik
26th July 2007, 12:00 PM
Generally, if it can be done with the stylus/buttons it can be done with mortscript.

markd89
28th July 2007, 07:50 AM
I'm thinking of how to conserve power on the Mogul...

Would it be possible:

1. have Bluetooth turned off.
2. Upon ring, bluetooth is turned on
3. If the call is not answered bluetooth is turned off
4. If the call is answered, bluetooth is turned off at the end of the call

Mark

codyppc
28th July 2007, 02:50 PM
I'm thinking of how to conserve power on the Mogul...

Would it be possible:

1. have Bluetooth turned off.
2. Upon ring, bluetooth is turned on
3. If the call is not answered bluetooth is turned off
4. If the call is answered, bluetooth is turned off at the end of the call

Mark

awesome. what about repairing issues?

markd89
29th July 2007, 12:07 AM
awesome. what about repairing issues?

I'll show my igorance by saying that I don't know what that is :) I am learning fast though.

I know that with BT on and not used my battery drained like crazy. It seems like there should be a way to only turn it on when needed.

Mark

P.S. Thanks for the Threaded SMS. Now if I could only get Sprint to fix their programming so that my incoming SMSs from other networks come through..

Ixtana_ran
8th August 2007, 01:08 PM
First successful script, hope its useful to someone?

Unzip. Put memRelease in Storage Card\memRelease folder.
Run script.

famewolf
8th August 2007, 05:35 PM
First successful script, hope its useful to someone?

Unzip. Put memRelease in Storage Card\memRelease folder.
Run script.

So if I follow your script you are hitting enter a couple of times after pausing to bypass some screens on running memrelease?

You may want to look at "oxios memory" which has a hibernate (free up memory) and a Close all app for freeing memory...it's free.

Ixtana_ran
8th August 2007, 06:12 PM
So if I follow your script you are hitting enter a couple of times after pausing to bypass some screens on running memrelease?

You may want to look at "oxios memory" which has a hibernate (free up memory) and a Close all app for freeing memory...it's free.

I know it's very simple but we have to start somewhere.
memrelease seems to free up more memory even when all programs stopped? found it on this site last year don't know where it came from.

PianoSam
13th August 2007, 06:15 PM
Hi,
Does anyone know whether it is possible to have a script running that detects when a USB ActiveSync connection is made and turns off the phone. Then when the USB ActiveSync connection is closed turns the phone back on again?

All the best,
Sam.

koxx
17th August 2007, 12:56 PM
Hello,

i'd like to write a script to disconnect from data plan. But i don't know hown to start ...

can anybody help me ?

thanks.

Furbious
17th August 2007, 02:39 PM
Hi,
Does anyone know whether it is possible to have a script running that detects when a USB ActiveSync connection is made and turns off the phone. Then when the USB ActiveSync connection is closed turns the phone back on again?

All the best,
Sam.

Polls every 10 seconds for connection state - note that this has to be an activesync session for it to update the registry. Also, you will have to type in your password if it requires it before turning off the phone (due to it not updating til it has a complete session)

While (1)
connectstr = RegRead("HKLM", "System\State\Connections\Desktop", "Count")
if equals connectstr, 1
PowerOff
endif
if equals connectsrt, 0
PowerOn
endif
Sleep (10000)
endwhile

Furbious
17th August 2007, 02:43 PM
Hello,

i'd like to write a script to disconnect from data plan. But i don't know hown to start ...

can anybody help me ?

thanks.

Checks every minute for an internet connection, if it is, it will disconnect.
Note that the disconnect command will disconnect everything, including activesync



While (1)
connectstr = Internetconnected("www.google.com")
if equals connectstr, 1
disconnect
endif
Sleep (60000)
endwhile

Furbious
17th August 2007, 02:45 PM
how to run script or anything before login, after restart on wm6?

Put it in the \windows\startup folder?

myteematt
17th August 2007, 04:28 PM
I think i have a permanent fix to the bluetooth versus speaker announcements for voice command that some users have but I am not knowledgable enough in Mortscript to write the code for this. I know all that needs to be done is: make a registry change first ( I know what keys they are) or import a regkey, and then run the application IdTransfer which routes all announcements to the bluetooth earpiece. Finally to hide the application or minimize the IdTransfer window out of view. This is the earpiece script that we need. To return to speaker announcements I would just assume doing the exact opposite: return registry to original key, then close IdTransfer. This is the speaker script we need. I hope I explained this properly as my programming logic is terrible, and thats why I ask for help from this talented community :)

PianoSam
17th August 2007, 04:31 PM
Furbios,
Thank you, Thank you, thank you.
Now the really stupid question...hangs head in shame...

How do I get hold of Mortscript?
What do I need to use it on my PDA?
What memory does it take up?

So sorry for being an ass,

Many thanks,
Sam.

famewolf
17th August 2007, 06:52 PM
Hello,

i'd like to write a script to disconnect from data plan. But i don't know hown to start ...

can anybody help me ?

thanks.

There are already programs you can run which keep you disconnected from data plan....just do a search on XDA or the pocketpc freeware sites.or use this...

http://www.modaco.com/FREE-Utility-t246171.html

myteematt
17th August 2007, 07:43 PM
Im already halfway through writing the script to change reg to announce through earpiece within voice command, and then run IdTransfer. I only need to find the minimize window paramater and the first script is done. Mortscript is freeware, so you can google it. Id Transfer is also freeware by an awesome developer named Bad Sector whois quite talented and we coudlnt have done this without his app. Ill post script when im through within the next few hours

Furbious
18th August 2007, 09:20 PM
Furbios,
Thank you, Thank you, thank you.
Now the really stupid question...hangs head in shame...

How do I get hold of Mortscript?
What do I need to use it on my PDA?
What memory does it take up?

So sorry for being an ass,

Many thanks,
Sam.

Just google for mortscript, download and install it
To run the script, you need to create a text file (with a .mortrun extension for example) with the code in it, then just run it - it'll run in the background, and do what you need.

neonstorm
20th August 2007, 11:40 PM
Hey guys, trying to make a (seemingly) very simple script:

I want the device to remain on while it is on AC power, and when AC power is lost I want it to display a countdown (i.e. AC power lost, shutting down...) that will shut the device off unattended, or I can cancel and keep the device on. To help you understand, this is for a PPC-based GPS I have in my car.

Here's what I have, which works except for the cancel part:

while(1)
ac = ExternalPowered()
if ( %ac% = 0 )
sleepmessage( 10, "AC Power Lost. Unit Shutting Down", "AutoPowerOff", 1 )
PowerOff
endif
sleep(10000)
endwhile


Anyone have an idea to help me cancel it somehow? I thought of working a choice in there, but every scenario I think of requires input for the device to start its countdown.

Thanks all!

Ryan

Furbious
21st August 2007, 11:04 AM
Can't see how you'd use sleepmessage - theres no condition checking, so you'd always get the poweroff regardless.
How about using the selection from list (choice)- that has a timeout, you could check to see if the default value is set?

Dishe
21st August 2007, 06:24 PM
So, without using Vijay's software to control wireless settings with the command line, is there any way to turn Bluetooth on using Mortscript?
I saw someone use ToggleBTH.exe, but my WM6 device does not seem to have this. Are there any command line parameters that be used with CommManager.exe to do that kind of stuff? What other options do I have, or do I need to install more stuff to make this work? (I'd rather not because i'm trying to keep my code rather portable)

neonstorm
21st August 2007, 08:17 PM
@Furbious

Thanks for the input! I finished it up with your suggestion and works pretty well. I keep this script running in a loop:

sleepmessage( 2, "Auto Power Off Enabled!")
while( 1 )
ac = ExternalPowered()
if ( %ac% = 0 )
callscript( "\my flash disk\poweroff.mscr" )
endif
sleep(10000)
endwhile

When no AC is present, this script is called:
ChoiceDefault( "AutoPowerOff", "AC Power Lost. Continue Using Mio?", 1, 5, "Standby", "Continue for 10 Minutes", "Continue for 30 Minutes", "Do Not Standby" )
Case( 1 )
PowerOff
Case( 2 )
Sleep( 600000 )
Case( 3 )
Sleep( 1800000 )
Case( 4 )
While( %ac% = 0 )
sleep 1000
ac = ExternalPowered()
endwhile


It works really well, except for some reason my unit doesn't display any buttons. Luckily the countdown takes care of it.

I'm also proud of my (novice) programming skills in the 'Do Not Standby' choice. It bypasses the auto standby until AC is reconnected, at which point the first script starts over again.

Thanks for your input!!!

Ryan

Furbious
22nd August 2007, 12:58 AM
So, without using Vijay's software to control wireless settings with the command line, is there any way to turn Bluetooth on using Mortscript?
I saw someone use ToggleBTH.exe, but my WM6 device does not seem to have this. Are there any command line parameters that be used with CommManager.exe to do that kind of stuff? What other options do I have, or do I need to install more stuff to make this work? (I'd rather not because i'm trying to keep my code rather portable)

Just do a search for togglebth.exe - you cant just alter the state in the registry and get it to work (like backlight, setting wont take effect until you SR, so no point in that)

joyee001
22nd August 2007, 07:11 AM
# this script is a combination of things that i saw in this thread to make it easier to use tomtom.
# this script first checks if your bluetooth was on before using tomtom. Then it asks you if you want to use tomtom in a landscape mode and once you quit tomtom the script will leave bluetooth in the same condition as it was when you first activated it.

#for this script to work you have download the togglebth attached to this post and save it as (Storage Card\Program Files\tomtom\ToggleBTh.exe)


#Script file starts here:


Switch (question ( "Rotate screen before running TomTom?", "TomTom Launcher", "YesNoCancel" ))





case (1)

RegReadDWord HKLM, System\State\Hardware, Bluetooth, Bluetooth

If Expression %Bluetooth% <= 8

Set BluetoothWas, "Off"

Run("Storage Card\Program Files\tomtom\ToggleBTh.exe"

EndIf

Rotate(90)

Runwait( "Program Files\Navigator\Tomtom Navigator.exe" )

Rotate(0)

If equals %BluetoothWas%, "Off"

Run "Storage Card\Program Files\tomtom\ToggleBTh.exe"

EndIf





case (0)

RegReadDWord HKLM, System\State\Hardware, Bluetooth, Bluetooth

If Expression %Bluetooth% <= 8

Set BluetoothWas, "Off"

Run("Storage Card\Program Files\tomtom\ToggleBTh.exe"
EndIf



Runwait( "Program Files\Navigator\Tomtom Navigator.exe" )



If equals %BluetoothWas%, "Off"

Run "Storage Card\Program Files\tomtom\ToggleBTh.exe"
EndIf



case (2)

EndSwitch


#now your bt connection will be the same as before you started the script.

dark_wing
27th August 2007, 10:17 AM
Can someone help me on this script below? I am trying to do a Copy and then Paste using the same button but can't seemed to get it right.


if equal %Y%, 0
SendCtrlKey( "c" )
Y = 1
else
if equal %Y%, 1
SendCtrlKey( "v" )
Y = 0
endif
endif

MaxPax69
27th August 2007, 06:24 PM
Hello everybody,
Attached my script to manage hw buttons.
First of all sorry for my English.

You can copy the files in any PPC folder and run install:
It will create some registry keys, ALL under HKEY_CURRENT_USER\2M2P.
It will create shortcuts in Start\programs\script.
It will create PressButton2 to PressButton5. (pressButton1 is already there)

In the setup you can decide what application the button will run according to the active window. (f.i. when TomTom is active my camera button will run snapPoiplus instead of camera).
In the setup you can decide the "learning mode" of the buttons. Always On or Always OFF, and smart (Intelligente=clever/smart). When smart, it launch the default application on desktop (camera in my case) , the pre-stored application in already known situation (SnapPoiplus when TomTom is the active window) and will run the setup when other windows are active.

I use it my Eten glofiish M700 and it works. I run MortScript-4.01b19.:D

The script messages are in Italian but there is the English translation in the scripts.

For experts: I left an open door for doubleclick but I only tested few solutions with poor results. If you have a solution please post it.


INSTRUCTIONS
1)Copy the files in any PPC folder and run install.mscr:
It will create some registry keys, ALL under HKEY_CURRENT_USER\2M2P.
It will create shortcuts in Start\programs\script.
It will create PressButton2 to PressButton5. (pressButton1 is already there)

2) Set one of the button to point the corresponding MultiButton.
F.i. Button4=MultiButton4: Start\settings\Buttons Select Button4 and change from camera to MultiButton4.

2)Run "MB3Setup" link in startmenu\programs\scripts
Select Button4
Select Learning ON/Off
Select Smart Learning (this is the dafault value)

3) Run an application (F.i. Contacts)
Push the camera button, now it run MultiButton4 which is in [Smart learning] Mode: it runs the setup directly.
Select Applications
Select Contacts
Select Add Link
Wait for the file tool to load
Select a link (Tasks for istance)
Close Contacts

Run Calendar
Push the camera button
Select Applications
Select Contacts
Select Add Link
Wait for the file tool to load
Select a link (f.i. Pocket Word)

Now on when you press button4 when the contacts window is active it will run tasks, when Calendar is active it will run PWord.

If you want to change or remove settings you have to run "MB3Setup" again.

If you need to run install.mscr again I suggest, for safety reasons, to restore the previus settings in Start\settings\Buttons.

juiceppc
31st August 2007, 05:53 AM
I'm thinking of how to conserve power on the Mogul...

Would it be possible:

1. have Bluetooth turned off.
2. Upon ring, bluetooth is turned on
3. If the call is not answered bluetooth is turned off
4. If the call is answered, bluetooth is turned off at the end of the call

Mark


This is a great idea. Especially for the Advantage which has no earpiece. What is the command in mortscript to tell the device to run something when the phone rings and also when the call ends?

Daktaklakpak
3rd September 2007, 09:27 AM
This is a great idea. Especially for the Advantage which has no earpiece. What is the command in mortscript to tell the device to run something when the phone rings and also when the call ends?

I have recently implemented this (detect phone ring and call end) using MortScript v4.0 (release), see attachment here: http://forum.xda-developers.com/showthread.php?t=327081.

Here also is a simplified demonstration that will display a Message when the phone rings, and again when it is 'hung up':

IsPhoneActive = 0
Initialized = 1

While (Initialized = 1)
Sleep (1000)
If (IsPhoneActive = 0)
If (WndActive("Phone"))
Message ("Phone Activated", "Phone Test")
IsPhoneActive = 1
EndIf
Else
If (IsPhoneActive = 1)
If (WndActive("Phone") = 0)
Message ("Phone Deactivated", "Phone Test")
IsPhoneActive = 0
EndIf
EndIf
EndIf
EndWhile

You would insert the code you want to run where my code displays the Message. See the Readme contained in the attachment of the other post for the reason I use WndActive instead of WndExists.

The following script will terminate the above script, since it is an infinite loop (of course, it will only work if the above script is named 'oblyvaeonPhoneTest.mscr', so make the appropriate changes as required):

If (ScriptProcExists("oblyvaeonPhoneTest.mscr"))
KillScript ("oblyvaeonPhoneTest.mscr")
Message ("Phone Test terminated.", "Phone Test")
Else
Message ("Phone Test is not currently active.^NL^^NL^Aborting...", "Phone Test")
EndIf

Daktaklakpak
3rd September 2007, 05:28 PM
I have recently implemented this (detect phone ring and call end) using MortScript v4.0 (release), see attachment here: http://forum.xda-developers.com/showthread.php?t=327081.

There is an updated version (1.1) of the above available that fixes the path error-checking, same link. Sorry to those 15 that already snagged the file in the last few hours... :p

juiceppc
7th September 2007, 06:05 PM
There is an updated version (1.1) of the above available that fixes the path error-checking, same link. Sorry to those 15 that already snagged the file in the last few hours... :p


THANKS!!!!!!!!!

dancer_69
8th September 2007, 01:24 PM
I want to make a script that acts like a counter on my smartphone. Start from 1 every time I push a button to incrase by 1 until to 500 and to have the option to quit by pushing a key. Is it possible with mortscript and how to do it?

Thanks in advance

Cobra2
8th September 2007, 03:01 PM
This script removes the list of recently used programs in the Start Menu.

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

This one is nice since mine recently used program list is at its full, but how to use script ??:o

tytnguy
8th September 2007, 03:30 PM
Hi guys,
Hope I am not posting something off topic, but thought you guys might be interested in.
I have developed an application called rk-Location Switch (http://forum.xda-developers.com/showthread.php?t=328114)which triggers execution of other applications based current phone location on command line. Basically it’s an application trigger. I think this application will trigger MortScripts too. But you need WM5/6 phone addition to use my program. (There is a very small fee :eek: associated with this app though)

Thanks

Daktaklakpak
9th September 2007, 08:48 PM
I want to make a script that acts like a counter on my smartphone. Start from 1 every time I push a button to incrase by 1 until to 500 and to have the option to quit by pushing a key. Is it possible with mortscript and how to do it?

Thanks in advance

You can assign the following counter script (oblyvaeon_HeadCounter.mscr) to one button and the reset script (oblyvaeon_HeadCounterReset.mscr) to another. There is no need to "quit", as you say, since the script just runs, increments the counter, and terminates.

oblyvaeon_HeadCounter.mscr
If (RegKeyExists("HKLM", "Software\oblyvaeon\HeadCounter") = 0)
HeadCount = 0
Else
HeadCount = RegRead("HKLM", "Software\oblyvaeon\HeadCounter", "HeadCount")
EndIf
HeadCount = HeadCount + 1
RegWriteDWord("HKLM", "Software\oblyvaeon\HeadCounter", "HeadCount", HeadCount)

oblyvaeon_HeadCounterReset.mscr
If (RegKeyExists("HKLM", "Software\oblyvaeon\HeadCounter") = 0)
HeadCount = 0
RegWriteDWord("HKLM", "Software\oblyvaeon\HeadCounter", "HeadCount", 0)
Else
HeadCount = RegRead("HKLM", "Software\oblyvaeon\HeadCounter", "HeadCount")
EndIf

If (Question("Current head count is " & HeadCount & ".^NL^^NL^Do you wish to reset the count to 0?", "oblyvaeon Head Counter", "YesNo") = 1)
RegWriteDWord("HKLM", "Software\oblyvaeon\HeadCounter", "HeadCount", 0)
Message("Head count reset to 0.", "oblyvaeon Head Counter")
EndIf

A simple modification to the counter script will impose a limit of 500 on the count and reset to 0. Inserting the following lines after "HeadCount = HeadCount + 1" accomplishes this task:
If HeadCount > 499
Message("Head count has reached 500 and has been reset to 0.", "oblyvaeon Head Counter")
RegWriteDWord("HKLM", "Software\oblyvaeon\HeadCounter", "HeadCount", 0)
Exit
EndIf

dancer_69
9th September 2007, 09:20 PM
Thanks for your help, but I think you didn't understand what I want. Maybe I didn't explain well. I want a no auto counter. I want to counts 1 and pause and wait for push a key to counts 2 , pause wait to push for 3 .......... until 500. I want to stop, display the next number on the screen and then wait to push the key to display the next number.

kunz
9th September 2007, 11:39 PM
Heres a bit of a challenge to show off your mortscript skillz :P

Has anyone created (or is willing to create) a mortscript based puzzle or even a simple mathematical puzzle/challenge?

If so, please do post it! I'd be interested in integrating it with a simple "Am I really Awake" - type of script that plays a couple of sounds, etc and hopefully ends with a math or any other type of small puzzle within mortscript and not an external app.

Thanks!

Daktaklakpak
13th September 2007, 06:20 AM
Thanks for your help, but I think you didn't understand what I want. Maybe I didn't explain well. I want a no auto counter. I want to counts 1 and pause and wait for push a key to counts 2 , pause wait to push for 3 .......... until 500. I want to stop, display the next number on the screen and then wait to push the key to display the next number.

Er... which is precisely what my example does when you assign the script to a hardware button. It won't increment until you push the button to which the script is assigned. As for displaying the current count, you could easily insert a Message after the script increments the number. The reset script, when assigned to another button, will 'stop' the count. I've done the 'hard part' for you, and I think that if you read the Mortscript documentation, it contains everything you need to help you tailor my script to your specific needs. Good luck :)

jiggs
27th September 2007, 03:01 AM
The AutoRun sucks. If your cab requires user input during installation, autorun freezes. You have to edit the config.txt, too, to declare all cabs to be installed.

So, I made this simple script to run after hard reset and execute the XDA Atom SetupWizard, option to activate pbar app, and install all cabs placed in Extended ROM (hidden) and \cabs\ folder on Storage Cards. Plus, the option to install or not to install each cab.

Hope, it's useful to ROM cookers. The AutoInstall.lnk pointing to the script must be precooked to the ROM, as well as, the MortScript files and registry settings.


ErrorLevel off

RunWait("\Windows\SetupWizard.exe")
Delete("\Windows\Startup\AutoInstall.lnk")

If(Question("Activate pBar TaskManager?", "AutoInstall", "YesNo")=Yes)
Copy("\Windows\StartpBar.lnk","\Windows\Startup\StartpBar.lnk")
EndIf

ForEach x in files { "\_QHiddenPartition\*.cab" }
xx = ToLow(Part(x,"\",3))
If(Question("Install:^NL^" & xx & "?", "AutoInstall", "YesNo")=Yes)
Run(x)
EndIf
EndForEach

ForEach x in files { "\Storage Card\Cabs\*.cab" }
xx = ToLow(Part(x,"\",3))
If(Question("Install:^NL^" & xx & "?", "AutoInstall", "YesNo")=Yes)
Run(x)
EndIf
EndForEach

If(Question("(c) MortScript 4.0^NL^^NL^Installation Complete.^NL^Do you want to reset?", "AutoInstall", "YesNo")="No")
Exit
EndIf
Reset

jiggs
27th September 2007, 03:06 AM
Since I have integrated MortScript on my cooked ROM, might as well use it. I know there is a SoftKey Applet out there, but this substitute script is only 3k in size. And it does its job:


x = RegRead("HKCU","Software\Microsoft\Today\Keys\112","")
y = "Current Assignment: " & x & "^NL^Select below or cancel to retain."
Choice("Left SoftKey",y ,"Calendar","Contacts","Messaging","SMS Plus","WirelessManager","Customize")
Case( 1 )
RegWriteString("HKCU","Software\Microsoft\Today\Keys\112","","Calendar")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\112","Open","\Windows\Start Menu\Calendar.lnk")
Case( 2 )
RegWriteString("HKCU","Software\Microsoft\Today\Keys\112","","Contacts")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\112","Open","\Windows\Start Menu\Contacts.lnk")
Case( 3 )
RegWriteString("HKCU","Software\Microsoft\Today\Keys\112","","Messaging")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\112","Open","\Windows\Start Menu\Messaging.lnk")
Case( 4 )
RegWriteString("HKCU","Software\Microsoft\Today\Keys\112","","SMS+")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\112","Open","\Windows\O2 SMS Plus.lnk")
Case( 5 )
RegWriteString("HKCU","Software\Microsoft\Today\Keys\112","","Wireless")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\112","Open","\Windows\WirelessManager.exe")
Case( 6 )
z= Input("Enter Text (max 8 chars):","Custom Left SoftKey")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\112","",z)
z= Input("Application Full Path:","Custom Left SoftKey")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\112","Open",z)
EndChoice

x = RegRead("HKCU","Software\Microsoft\Today\Keys\113","")
y = "Current Assignment: " & x & "^NL^Select below or cancel to retain."
Choice("Right SoftKey",y,"Calendar","Contacts","Messaging","SMS Plus","WirelessManager")
Case( 1 )
RegWriteString("HKCU","Software\Microsoft\Today\Keys\113","","Calendar")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\113","Open","\Windows\Start Menu\Calendar.lnk")
Case( 2 )
RegWriteString("HKCU","Software\Microsoft\Today\Keys\113","","Contacts")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\113","Open","\Windows\Start Menu\Contacts.lnk")
Case( 3 )
RegWriteString("HKCU","Software\Microsoft\Today\Keys\113","","Messaging")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\113","Open","\Windows\Start Menu\Messaging.lnk")
Case( 4 )
RegWriteString("HKCU","Software\Microsoft\Today\Keys\113","","SMS+")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\113","Open","\Windows\O2 SMS Plus.lnk")
Case( 5 )
RegWriteString("HKCU","Software\Microsoft\Today\Keys\113","","Wireless")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\113","Open","\Windows\WirelessManager.exe")
Case( 6 )
z= Input("Enter Text (max 8 chars):","Custom Right SoftKey")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\113","",z)
z= Input("Application Full Path:","Custom Right SoftKey")
RegWriteString("HKCU","Software\Microsoft\Today\Keys\113","Open",z)
EndChoice

If(Question("SoftKeys requires reset.^NL^Do you want to reset now?", "SoftKeys", "YesNo")="No")
Exit
EndIf
Reset


Note: This is just a pattern. You have to change the links to work on your devices. :)

AndrewJC
27th September 2007, 05:03 PM
Hi guys,

To make a long story short, there are some keys on my keypad that aren't working and I can't afford to buy another Q at the moment. One of the keys that isn't working happens to be the Right Softkey, which makes certain tasks VERY difficult, because I can't bring up menus in a lot of programs.

What I want to do is this: Run a mortscript that waits for me to choose a program (preferably from a list created by Choice()) and then do SendRightSoft once that program is selected.

It seems relatively simple, but it's turning out to be more difficult than I originally thought. At first, I simply had a script that said the following:
Sleep(3000)
SendRightSoft
That worked, but it's not extremely easy to know when it's active and/or when the 3 seconds are up. I then tried modifying it so that it would know when the active window had changed to the one that I had selected, something like this:
x = ActiveWindow()
While (wndActive(x))
Sleep(1000)
EndWhile
SendRightSoftBut all that tends to do is leave the script in a loop, running forever, which requires me to kill the script before starting again, but ultimately, it does nothing.

Is there a way to do this? What I'd REALLY like to do is run the script, have it show me a list of active processes and allow me to choose one, then make that the active window and then perform a SendRightSoft after it's switched to the process I choose. If that's not possible, I'd be happy if it simply waited for me to choose the program from my Recent Tasks list and then send the key.

Can it be done?

(You know, I just stumbled upon this thread after doing a search for mortscript... Didn't realize until much later that this is a forum for a specific phone. I'm still wondering if anybody knows how to do what I'm asking, though... Any advice would be most welcome and appreciated.)

saenzjoseph
29th September 2007, 05:46 AM
Here is what I am trying to get the script to do
1. read the 4 registry keys
2. Start a program
3 Write new vales to those 4 keys (after the program starts)
4 when the program exits, write the read value of those 4 keys back

Here is what I have, but do not know the program well enough

Code:

BattSuspendTimeout = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout")
ACSuspendTimeout = RegRead ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout")
BatteryTimeout = RegRead ("HKCU", "ControlPanel\Backlight", "BatteryTimeoutUnchecked")
ACTimeout = RegRead ("HKCU", "ControlPanel\Backlight", "ACTimeoutUnchecked")

RunWait ("\Program Files\Tracky\Tracky.exe")

RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout",0)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout",0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeoutUnchecked", 60)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeoutUnchecked", 60)



RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","BattSuspendTimeout",BattSuspendTimeout)
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts","ACSuspendTimeout",ACSuspendTimeout)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeoutUnchecked", BatteryTimeoutUnchecked)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeoutUnchecked", ACTimeoutUnchecked)




If you can help, it would be greatly appreciated

pi3ch
29th September 2007, 09:44 AM
It was always a challenge for me to have Hijri Shamsi (Jalali) Date on my PPC without installing any Arabic/Farsi softwares. As soon as I found MortScript, I coded a sample Hijri Shamsi (Jalali) date for my self. This script is very handy with 4 usage examples. It generates Hijri Shamsi date by using English characters (Like Linux date!)

Hope you enjoy it. :D

P.S: For whom like to have Hijri Shamsi Date on their Today screen
http://rotlaus-software.de/forum/viewtopic.php?id=1008

Underwaterdub
29th September 2007, 02:50 PM
Is there any possibility to run PocketCM after a soft-reset as hidden or minimized???

bartito
19th October 2007, 01:30 PM
hi,

* it's possible to obtain all the entry names of a registry directory?

* it's possible to play mp3 or wma files using the mortscript software? i have tried the "PlaySound" function, but only plays WAV files

thank's

mikhe69
24th October 2007, 01:29 PM
Sorry for what I about to request. (I didn't read the all thread so I don't know if already asked:( )

Is there a way to make a script so it can turn the phone radio OFF and then ON again in just 1 key press.

I've DualSIM and it will be very usefull to change SIM just by pressing 1 key.

Once again I'm sorry if this question was already made!

mikhe69
24th October 2007, 03:45 PM
Sorry for what I about to request. (I didn't read the all thread so I don't know if already asked:( )

Is there a way to make a script so it can turn the phone radio OFF and then ON again in just 1 key press.

I've DualSIM and it will be very usefull to change SIM just by pressing 1 key.

Once again I'm sorry if this question was already made!

Ok I've managed to find what I've looking for.

Run \Program Files\vijay555\VJVolubilis.exe, -radiooff
Sleep 500
Run \Program Files\vijay555\VJVolubilis.exe, -radioon


I used only two lines of a script and the Vijay app VJVolubilis app from here:
VJVolubilis (http://www.vijay555.com/?Releases:VJVolubilis)

I know it's very very basic:o but for whom, like me,that do not know nothing about programing, it was very hard.
And maybe can be usefull to someone also!!

So I've linked this script to a hardware button, and know it's very easy to switch sim, so I'm very happy :D :D

charleslee
24th October 2007, 08:55 PM
say, any kind souls out there have scripts that do phone profile switching something like phoneAlarm? where we can choose

1. NORMAL = ringer ON, SMS tone ON, reminders ON
2. VIBRATE = ringer, SMS, reminders = Vibrate
3. SLEEP1 = ringer = OFF, SMS = off, reminders = ON (for alarm clocks)
4. SLEEP2 = ringer OFF, SMS ON, reminders ON
etc etc ?

THANKS!

perasite
25th October 2007, 12:16 AM
say, any kind souls out there have scripts that do phone profile switching something like phoneAlarm? where we can choose

1. NORMAL = ringer ON, SMS tone ON, reminders ON
2. VIBRATE = ringer, SMS, reminders = Vibrate
3. SLEEP1 = ringer = OFF, SMS = off, reminders = ON (for alarm clocks)
4. SLEEP2 = ringer OFF, SMS ON, reminders ON
etc etc ?

THANKS!

I wrote PeraProfiler which can be found at http://www.perasite.com. It does some of the stuff you want (I couldn't get it to switch vibrate on/off) but it does allow you to make custom profiles. It's free so it doesn't hurt to check it out.

Artanis
25th October 2007, 05:59 AM
is there a script that would allow a hardware button to end current task so i dont have to use task manager on screen.

yes ok hides it but would like to map button to end it.

is it even possable.

c_shekhar
25th October 2007, 06:31 AM
is there a script that would allow a hardware button to end current task so i dont have to use task manager on screen.

yes ok hides it but would like to map button to end it.

is it even possable.


Use VJOkbutt (http://vijay555.com/?Releases:VJOkButt)
map it any hardware button and enjoy...;)

nikagl
3rd November 2007, 03:55 PM
Does anyone know how to turn hands-free off and on again using mortscript (or any other handy tool - Vijays tools do not have hands-free toggle)?

ranasrule
3rd November 2007, 04:29 PM
does mortscript run on WM6?

andason
3rd November 2007, 07:49 PM
mortscript runs fine on wm6

hawkeyetim
4th November 2007, 12:56 PM
Hi All

I am trying to access my internal gps com port and so far I can activate the gps but the data I get from the port is gibberish.

has anybody been able to successfully access this port and if so how.

below is the section that am having problems with.

Setcominfo( "COM4:" , 6000,9600, "none",8,1,"none" )
d = readfile("COM4:",5500)
Writefile("data.txt", d )

thanks

Hawk Eye

eten x500

nikagl
4th November 2007, 01:01 PM
Did you try 4800 baud?

hawkeyetim
4th November 2007, 01:55 PM
hi nikagl

yep I tried several different setting but still get gibberish .

eg.

ZBţBL&ţ&ţQB3°9üZBšĚźBV…Ű‘™9üҐ3°9˙˙ÚZœžÉB›Ů•Ţ*LĽ˙ ĆŘ™žŮ‰cÎۙ!ćöZ™ůɕ™"bölŰľFˆs””úŘ™žŮcYÎۑM™Z‘ŚIBúZ‘KBÖZ‘ŚË›šBţR ›˜jZ›h[RY™Ů*[›˜‘KBÖZ‘Ś9Bţ‘š”†Z‘ŚË›HšBţ”
´ڐK™ÚB™™ř˛SSZ–řZ‘KBÖ˛_Qܙ˙tͰű

also tried different codepage settings in WriteFile but no joy.

thanks

tomli
6th November 2007, 10:19 AM
Hi,

can I use Mortscript to intercept an incoming SMS, parse it, and when it contains some special keyword, deleting the SMS and doing something? This all should happen before the phone is beeping for the new SMS. All the other SMS's without the special keyword shoud go into the SMS inbox as usual.

Any help is welcome.

dourediff
12th November 2007, 06:19 PM
is it possible to execute "drag and drop" command using mortscript if i have screen coordinates?

any help / headstart is highly appreciated.

thanks

bennyk
20th November 2007, 09:10 AM
Hi

Does anyone have a script example to solve this problem

http://forum.xda-developers.com/showthread.php?t=323758

Thanks

--------------------------------------------------------------------------------

...does anyone know if the Cab files has been ammended yet to deal with the issue of once a DUN call is made...it keeps the connection open until the phone is reset?

In this case, Activesync via GPRS does not work ( get a message about "cannot connect whilst a voice call is in progress) and I;m also worried about the cost of the DUN call charges?

rtonerii
21st November 2007, 10:57 PM
I am trying to create a script that will need to Create a Registry Key. I have found RegDeleteKey but I can not find any command for a Create / Add. Anyone?

Thanks
Rick

saenzjoseph
22nd November 2007, 01:35 AM
I am trying to create a script that will need to Create a Registry Key. I have found RegDeleteKey but I can not find any command for a Create / Add. Anyone?

Thanks
Rick

RegWriteDword

rtonerii
23rd November 2007, 06:41 PM
Will RegWriteDword just create a Key without any values? I am wanting to set the Values on the next lines I use.

Thanks
Rick

Menneisyys
25th November 2007, 01:26 PM
Is there any way of getting and parsing command-line params? for example, when a script is invoked via a MIME / file type association with a parameter like this:

[HKEY_CLASSES_ROOT\http\Shell\Open\Command]
@="myscript %1"

Here, I'd like to have access to the contents of %1 from the script - in this case, the contents of the link.

medkid
26th November 2007, 01:53 PM
how to customize today theme with Mortscript ?
I've htc_default.tsk and I want to enable it after flashing rom, is it possible ?
thanks

AndrewJC
26th November 2007, 09:13 PM
Does anybody know if there's a simple registry change I can do in order to change ring profiles? I'm looking to write a script that runs to determine if my phone is plugged in and if so, to change to a different profile than when I've got it on my hip (I use it in Vibrate mode constantly, unless it's charging at night, in which case I have it set to a special "Nighttime" profile that rings the phone but leaves SMS and Email notifications quiet). When I unplug the phone again, I want it to automatically change back to whatever the profile was before I plugged it in. This is probably my biggest complaint about WM5 as opposed to the older phones I used to use: every single one of them knew what profile the phone was set to when it was plugged in as opposed to unplugged and would keep track of them so I didn't have to, whereas WM5 simply uses the same profile all the time.

saenzjoseph
27th November 2007, 01:07 AM
Will RegWriteDword just create a Key without any values? I am wanting to set the Values on the next lines I use.

Thanks
Rick

Values are listed in the same line
see below



Command Root Location Key Value

RegWriteDword ("HKCU", "ControlPanel\Backlight", "BatteryTimeout", 0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeout", 0)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "Brightness", 10)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACBrightness", 10)
RegWriteDword ("HKCU", "ControlPanel\Backlight", "ACTimeoutUnchecked", 60)

boy_in_oz
27th November 2007, 04:49 AM
Does anybody know if there's a simple registry change I can do in order to change ring profiles? I'm looking to write a script that runs to determine if my phone is plugged in and if so, to change to a different profile than when I've got it on my hip (I use it in Vibrate mode constantly, unless it's charging at night, in which case I have it set to a special "Nighttime" profile that rings the phone but leaves SMS and Email notifications quiet). When I unplug the phone again, I want it to automatically change back to whatever the profile was before I plugged it in. This is probably my biggest complaint about WM5 as opposed to the older phones I used to use: every single one of them knew what profile the phone was set to when it was plugged in as opposed to unplugged and would keep track of them so I didn't have to, whereas WM5 simply uses the same profile all the time.
I don't think there's a profiler in-build in WM5. However, there's a bunch of 3rd party applications that let you switch between pre-define profiles. Have a look at the threads http://forum.xda-developers.com/showthread.php?t=342933 and http://forum.xda-developers.com/showthread.php?t=312945.

If you want something much simpler, there's an easy way to check with MortScript if your device is cradled or not: use x = RegRead( "HKLM", "System\State\Hardware", "Cradled" ) to read the state from the registry. If you're connected to ActiveSync, x = 1, otherwise x = 0. Based on the value of x, you can then change the device settings (e.g. system volume, backlight level, ...). Have a look at http://forum.xda-developers.com/showpost.php?p=1140665&postcount=30.

I am currently also working on a MortScript based profiler. The only problem is that I can't figure out how to adjust the ring and in-call volume...

jiggs
27th November 2007, 11:11 AM
how to customize today theme with Mortscript ?
I've htc_default.tsk and I want to enable it after flashing rom, is it possible ?
thanks

Hi, which device is it? If it is for XDA Atom, you just execute RUN(ChangeTodayTheme.exe, "xxx.tsk")

yannyb
28th November 2007, 06:47 PM
A hopefully quick question for you guys that have been creating mortscripts:

Where do you go to find details of the various registry key details, system info to develop your scripts? Are there particular MS developer sites that have this or are you getting there by common sense with a liberal dash of trial and error?

I'm looking to start writing a few scripts but I'm not too sure where to start. e.g. I'd like to write a script that will switch my phone between silent/normal ring settings, just like the vibrate option on comm manager. (This may seem like a daft thing to do but there is a reason behind it :D )

The two ways I can think of doing it are to code a script that basically starts Comm Manager, emulates a press of the appropriate button and then closes Comm Manager or by coding a script that replicates the settings changes in the registry. I suspect that the second method will be a neater solution whilst also helping me learn a bit more about updating registry entries etc.

Anyone able to give me a few pointers?

Cheers

perasite
28th November 2007, 07:30 PM
What I typically do is export my registry, then make the change the I wish to find info on, export another copy of the registry, then do a windiff between the two files.

saenzjoseph
28th November 2007, 08:41 PM
I'd like to write a script that will switch my phone between silent/normal ring settings, just like the vibrate option on comm manager. (This may seem like a daft thing to do but there is a reason behind it :D )



An easier way to do this is to have AEButton plus (http://ae.inc.ru/aebplus.php) do it for you. It has an option for that.
http://i189.photobucket.com/albums/z250/saenzjoseph/Screen023.jpg

yannyb
30th November 2007, 11:18 PM
What I typically do is export my registry, then make the change the I wish to find info on, export another copy of the registry, then do a windiff between the two files.

Thanks for the advice, seems obvious now that you mention it!

I've been giving this a go over the past few nights but can't figure out what I'm missing.

the only differences in the registry I found when switching between ring/vibrate modes are:

RINGER################################

[HKEY_CURRENT_USER\ControlPanel\Volume]
"Screen"=dword:00010000
"Key"=dword:00010000
"Ringer"=dword:FFFFFFFF
"Volume"=dword:FFFFFFFF

[HKEY_CURRENT_USER\ControlPanel\Sounds\RingTone0]
"Sound"="\\Windows\\Ring-Standard .wma"

[HKEY_CURRENT_USER\ControlPanel\SoundCategories\Rin g]
"InitVol"=dword:00000005

[HKEY_CURRENT_USER\ControlPanel\Notifications\Shell Overrides]
"Mode"=dword:00000000

################################################## ####

VIBRATE#######################

[HKEY_CURRENT_USER\ControlPanel\Volume]
"Screen"=dword:00000000
"Key"=dword:00000000
"Ringer"=dword:00000000
"Volume"=dword:00000000

[HKEY_CURRENT_USER\ControlPanel\Sounds\RingTone0]
"Sound"="*vibrate*"


[HKEY_CURRENT_USER\ControlPanel\SoundCategories\Rin g]
"InitVol"=dword:00000000


[HKEY_CURRENT_USER\ControlPanel\Notifications\Shell Overrides]
"Mode"=dword:00000001


Armed with this info, I've written the following script (note all the message commands are to help me debug!)

#First step is to check what the current status is
RingStatus = RegRead("HKCU", "\ControlPanel\Sounds\RingTone0", "Sound")

Message ( RingStatus, "Value of RingStatus")

#Depending on the value of RingStatus set the various registry values as required

If (RingStatus eq "*vibrate*")

#Set the registry values so that the phone is in Ringer Mode
Message ("Phone being set to Ringer Mode", "Action")

RegWriteDWord ( "HKCU", "ControlPanel\Volume", "Screen", 65536)
Message ( RegRead("HKCU", "ControlPanel\Volume" , "Screen") , "Screen Value")
RegWriteDWord ( "HKCU", "ControlPanel\Volume", "Key", 65536)
Message ( RegRead("HKCU", "ControlPanel\Volume" , "Key") , "Key Value")
RegWriteDWord ( "HKCU", "ControlPanel\Volume", "Ringer", FFFFFFFF)
Message ( RegRead("HKCU", "ControlPanel\Volume" , "Ringer") , "Ringer Value")
RegWriteDWord ( "HKCU", "ControlPanel\Volume", "Volume", FFFFFFFF)
Message ( RegRead("HKCU", "ControlPanel\Volume" , "Volume") , "Volume Value")
RegWriteString ( "HKCU", "ControlPanel\Sounds\Ringtone0", "Sound", "\Windows\Ring-Standard .wma" )
Message ( RegRead("HKCU", "ControlPanel\Sounds\Ringtone0" , "Sound") , "Sound Value")
RegWriteDWord ( "HKCU", "ControlPanel\SoundCategories\Ring", "InitVol", 5)
Message ( RegRead("HKCU", "ControlPanel\SoundCategories\Ring" , "InitVol") , "InitVol Value")
RegWriteDWord ( "HKCU", "ControlPanel\Notifications\ShellOverrides", "Mode", 0)
Message ( RegRead("HKCU", "ControlPanel\Notifications\ShellOverrides" , "Mode") , "Mode Value")


Else

#Set the registry values so that the phone is in Vibrate Mode
Message ("Phone being set to Vibrate Mode", "Action")

RegWriteDWord ( "HKCU", "ControlPanel\Volume", "Screen", 0)
Message ( RegRead("HKCU", "ControlPanel\Volume" , "Screen") , "Screen Value")
RegWriteDWord ( "HKCU", "ControlPanel\Volume", "Key", 0)
Message ( RegRead("HKCU", "ControlPanel\Volume" , "Key") , "Key Value")
RegWriteDWord ( "HKCU", "ControlPanel\Volume", "Ringer", 0)
Message ( RegRead("HKCU", "ControlPanel\Volume" , "Ringer") , "Ringer Value")
RegWriteDWord ( "HKCU", "ControlPanel\Volume", "Volume", 0)
Message ( RegRead("HKCU", "ControlPanel\Volume" , "Volume") , "Volume Value")
RegWriteString ( "HKCU", "ControlPanel\Sounds\Ringtone0", "Sound", "*vibrate*" )
Message ( RegRead("HKCU", "ControlPanel\Sounds\Ringtone0" , "Sound") , "Sound Value")
RegWriteDWord ( "HKCU", "ControlPanel\SoundCategories\Ring", "InitVol",0)
Message ( RegRead("HKCU", "ControlPanel\SoundCategories\Ring" , "InitVol") , "InitVol Value")
RegWriteDWord ( "HKCU", "ControlPanel\Notifications\ShellOverrides", "Mode", 1)
Message ( RegRead("HKCU", "ControlPanel\Notifications\ShellOverrides" , "Mode") , "Mode Value")

#Make the phone vibrate to 'confirm' the change
Vibrate (500)


EndIf
#End of Script


However, making these changes isn't putting the phone into/out of vibrate mode. It is a bit odd, for example, the messages confirm that the reg entries have been written correctly when the script runs but when I go and look at the registry manually some appear to be changing back. (fortunately I backed up these altered keys so I can restore them!)

I wonder if I'm either changing the keys in an incorrect order and some process is resetting them or something similar...

Anyone got any suggestions?

PS, Re SEButton, I don't really want to install another program just for this, and I understand it causes problems for S2U2 which I'm not willing to lose!

Cheers

boy_in_oz
1st December 2007, 03:55 AM
However, making these changes isn't putting the phone into/out of vibrate mode. It is a bit odd, for example, the messages confirm that the reg entries have been written correctly when the script runs but when I go and look at the registry manually some appear to be changing back.

Mort was so kind the other day to explain to me that WM doesn't normally read the volume settings (i.e. system, ring, and in-call volume) from the registry. I did some further searching and came across a function AudioUpdateFromRegistry(), which is apparently part of the library coredll.dll but is undocumented. I guess the name suggests that this function performs the required steps.

I don't know terribly much about programming but maybe this function can help to solve your problem. Not sure if there's a way to invoke a DLL funtion from the command line - probably not... So you might have to do some C programming :confused:

ASTMICHA
6th December 2007, 02:02 AM
Ok - newbie to mortscript- just downloaded yesterday - I've searched and searched but no one seems to have addressed this so any help would be much appreciated.

I'm on the verizon network using wm5 w/push email and every few days my evdo connection disconnects and I get prompted to logon to the network multiple times throughout the day until it reconnects and stays connected for another few days. I have gprs set to always on and saved my password in connection settings repeatedly but that doesn't seem to do it.

Does anyone know if there is a registry key that causes this prompt screen to appear? (it seems to happen most whenever I've been in a bad signal area for a few hours and the device can't connect to retrieve my push email.)

Ultimately I need to create a script that automatically fills in the password and emulates a screen tap on the 'ok' box to restart the connection whenever the window prompting me to logon is active.

Thanks in advance for any help.

Francesc9
10th December 2007, 01:00 PM
Hi guys,
I'm a newbie for this program.

My whish is to know if someone can help to program a little routine.

I have a ACER P610 gps with windows CE5, sometimes y have to do a hard reset, deleting all the data stored in the ram. When it appends, I would like run automatically the exe date-time program.

One example idea :
If the year date is = "2006"
then run the exe date-time program

thats all, any simple idea to program it?

Regards

OK found

x=formatTime("Y")
if(x="2006")
run myprogram
Endif

Thanks

pkley
18th December 2007, 07:49 PM
Let me just say I'm THRILLED that BTAudio works natively on my TyTN II, so much better than my Hermes...
However, there are a few things that'd make listening to podcasts MUCH better.
I'd like to:
1. Run BTAudioON when I launch TCPMP
2. Run BTAudioOFF after 2 minutes of TCPMP not sending audio, OR if I put the device to sleep.

I could ask for more, like if MS VC inserts an announcement to my headset or if a call comes in, pause TCPMP and resume after call completes, reenabling BTAudioOn.

The biggest one is turning it off after xx period of inactivity. If I'm not paying attention and pause TCPMP to do something, the device will not go into sleep mode and drain the battery.

blee0125
24th December 2007, 05:23 PM
Just for kicks to see if this works, I am trying to add a script so that "enter serial" pops up after hard reset right after the alignment and clock setting screens but before the autorun customizations to a custom ROM that I've made for the Sprint Touch (CDMA Vogue). Below is the work in progress. Any idea where in the kitchen I would put this? I've tried placing in \OEM\OperatorPkg_PT and edited the config.txt but it crashes when it attempts to run. There is no extrom in the Touch (Vogue). I know it needs to end up ultimately in \Windows\Startup. Also, is there an OEM already made for the latest Morscript 4.1?

serial.mscr

Run("\Windows\show_serial.mscr")
KillScript("startup.mscr")

attempts = 3

while (strSerial <> "123456")
strSerial = Input("Enter your serial: ", "Serial")

if (strSerial <> "123456" and attempts <> 0)
Message("Invalid serial. You have " & attempts & " attempts remaining.", "Serial")
attempts = attempts - 1
elseif (strSerial <> "123456" and attempts = 0)
Message("All attempts have been used. Device will now reset.", "Serial")
Reset
endif
EndWhile

Message("Serial accepted! Welcome.", "Serial")
KillScript("show_serial.mscr")
Delete("\Windows\Startup\startup.mscr")

show_serial.mscr

while(1)
if (WndActive("Serial") = FALSE)
if (WndActive("Desktop") = FALSE)
Close(ActiveWindow())
endif

if (WndExists("Serial"))
Show("Serial")
endif
endif
endwhile

ciccione
24th December 2007, 08:40 PM
How can i join two mortscpit programs?


run \Windows\GpsUtil.exe
run \Storage Card\TomTom Navigator 6\TomTom Navigator.exe
Sleep 300000
Kill GpsUtil.exe

-----------------------------------------------

run \Windows\GpsUtil.exe
run \Storage Card\TomTom Navigator 6\TomTom Navigator.exe
Sleep 300000
Kill GpsUtil.exe

Switch
case (1)
Rotate(270)
Runwait( "Storage Card\TomTom Navigator 6\Tomtom Navigator.exe" )
Rotate(0)
case (0)
Run( "Storage Card\TomTom Navigator 6\Tomtom Navigator.exe" )
case (2)
EndSwitch


First it's for fast GPS fix, second for automatic display rotation.
I would like only one program...
Thank you in advance.

faguoren
7th January 2008, 12:06 PM
Here an alternative of Connect( title, message ) default function in mortscript.

Connect( title, message )
Connects to the Internet.
If a title and message are given as parameters, all available connections are listed (like using Choice), and the chosen one is used.


This script do :

List all availables connections.
Exclude default Windows Mobile connections (Work, The Internet, WAP Network, Secure WAP Network, Null Proxy Connection, My Work Network).
Cancel button not start connection to the first list element
Disable error message if connection failed


This script is also usefull to make connections (not the default connection) quickly without awful browse in WM settings (Start / Settings / Connections /Connections / Advanced / Select Network / ...)


################################################## ##############
# Connection script replace Connect( title, message )
# - List all available connections
# - Exclude default Windows Mobile connections
# - [Cancel] button not start connection to first list element
# - Disable error message if connection failed
#
################################################## ##############
ErrorLevel("off")

#########################
# Exclude list definition
#########################
#Work
array_destID[1] = "{A1182988-0D73-439E-87AD-2A5B369F808B}"
#The Internet
array_destID[2] = "{436EF144-B4FB-4863-A041-8F905A62C572}"
#WAP Network
array_destID[3] = "{7022E968-5A97-4051-BC1C-C578E2FBA5D9}"
#Secure WAP Network
array_destID[4] = "{F28D1F74-72BE-4394-A4A7-4E296219390C}"
#Null Proxy Connection
array_destID[5] = "{ADB0B001-10B5-3F39-27C6-9742E785FCD4}"
#My Work Network
array_destID[6] = "{18AD9FBD-F716-ACB6-FD8A-1965DB95B814}"

##########################################
# Connection list extraction from Registry
##########################################
index_array = 0
ForEach connection_name in regSubkeys ( "HKLM", "Comm\ConnMgr\Destinations" )

is_system_conn = FALSE
ForEach destID in array ( array_destID )
connection_destID = RegRead( "HKLM", "Comm\ConnMgr\Destinations\" & connection_name , "DestId" )
is_system_conn = is_system_conn || (connection_destID eq destID)
EndForEach

If( is_system_conn )
#BreakForEach
Else
index_array = index_array + 1
array_connections[index_array] = connection_name
EndIf
EndForEach

###########
#Connection
###########
choice_index = Choice( "Connections", "Choose your connection : ", 0, 0, array_connections)
If (choice_index <> 0)
#Message( array_connections[choice_index])
Connect( array_connections[choice_index] )
EndIf


64940

naruzopsycho
7th January 2008, 04:29 PM
http://forum.xda-developers.com/showthread.php?t=357264

Makes use of 'references' to form the data structure. Could be improved, but works fine for me :)

cojones
9th January 2008, 05:18 PM
Hi, I am new to Mortscript and am writing a simple script to change the today screen theme and image. I am setting the registry values fine using
RegWriteString but the changes aren't visible. Is there another command I need after setting the registry values to commit or refresh the screen to make the changes visible?

thanks,

c0j0

perasite
9th January 2008, 08:41 PM
RedrawToday

I think that's the command

cojones
10th January 2008, 09:42 AM
RedrawToday

I think that's the command

Yes that is in my script but it just doesn't work. I have read somewhere that some functions don't work on all models, SendBackspace doesn't work on my Touch Dual either.

perasite
10th January 2008, 06:34 PM
Yeah, I had a situation where RedrawToday didn't do what I needed. I ended up using a program called "Refresh Today" and having my script call that program.
http://www.shubaroo.com/index.php?module=refresh_today

cojones
10th January 2008, 07:20 PM
Yeah, I had a situation where RedrawToday didn't do what I needed. I ended up using a program called "Refresh Today" and having my script call that program.
http://www.shubaroo.com/index.php?module=refresh_today

Thanks, I've tried this but still no joy. Maybe there are commands that my Touch Dual simply cannot recognise and use (which is a pain in the ****)!

Ather
10th January 2008, 07:36 PM
hey guyz..i wanted to know if we can right a mortscript witch will dimm the light automatically juust like in Nokia Phones..any help is appreciated

ayder
19th January 2008, 04:05 PM
start>>system>> memory (ctlpnl.exe cplmain.cpl,4)

how can i make it run

dexxa05
19th January 2008, 04:45 PM
Hi all :)

i'm new in mortscript,

I try to write one,

To rotate the screen, launch SMS, when i close the sms windows the screen return to portrait :)

Can anyone help me???

holmanm
19th January 2008, 10:41 PM
Here is my S2U2 weather radar update script. It loads the jpg (or png, gif) into the landscape wallpaper of S2U2.


#radarweather.mscr
# fetch weather Radar from weather.com, Update registry.
# Quietly ignore all errors
ErrorLevel("off")
GetTime(hour,min,sec,day,month,year)
# set up for next notification in 50 Min
set utime,TimeStamp() + 3000
Switch (hour)
Case (7,11,16,21)
RegWriteString("HKCU","\Software\A_C\S2U2\","WallpaperL","\Program Files\S2U2\gfx\WallpaperL.jpg")
Run("\Program Files\S2U2\iLock2.exe","-refresh")
Download ("http://image.weather.com/web/radar/us_cn_9regradar_plus_usen.jpg","\Program (http://image.weather.com/web/radar/us_cn_9regradar_plus_usen.jpg%22,%22/Program) Files\S2U2\gfx\RadarL.jpg")
RegWriteString("HKCU","\Software\A_C\S2U2\","WallpaperL","\Program Files\S2U2\gfx\RadarL.jpg")
Place update time after Date line
if (hour < 13)
HR=hour&"'AM'"
else
RadarHR=hour-12
HR=RadarHR&"'PM'"
endif
df="dddd', 'MMMM d ("&HR&")"
RegWriteString("HKCU","\Software\A_C\S2U2\","DateFormat",df)
Run("\Program Files\S2U2\iLock2.exe","-refresh")
# set up for next notification in 4 hrs
set utime,TimeStamp() + 14000
Case (21)
# set up for next notification in 5 hrs
set utime,TimeStamp() + 18000
EndSwitch
# kill any lingering notification
RemoveNotifications("\Windows\StartUp\radarweather.lnk")
# set notify for myself at next time
RunAt( utime,"\Windows\StartUp\radarweather.lnk")



Stolen;) from notiweather.mscr by user schettj

v3patel
20th January 2008, 03:21 AM
I have wrote small script which is posted in this post

http://forum.xda-developers.com/showthread.php?p=1744019#post1744019

also for long key press for hardware utton
http://forum.xda-developers.com/showthread.php?p=1786414#post1786414

dexxa05
20th January 2008, 11:00 AM
Hi, i have tried this script but they don't rotate (0) the application :(


win = "Text Messages"
interval = 3000

Rotate(90)
Sleep(interval)
Runwait "\Windows\tmail.exe", -service "SMS"

winn = ActiveWindow()

If (winn ne win )
Rotate(0)
EndIf


They run the application, rotate to 90 degre the screen but when i close the application they don't rotate to 0

Can anyone help me?

larsdennert
29th January 2008, 04:48 AM
Anyone happen to know how to write a multi size string entry into the registry? regwritestring doesn't seem to do it.

A multi string like HKLM\Comm\Cellular Line\Parms\TcpIp\DNS
where the entries are on multiple lines?

Mort
29th January 2008, 08:26 AM
They run the application, rotate to 90 degre the screen but when i close the application they don't rotate to 0
Probably RunWait doesn't wait until tmail.exe is finished (which probably never happens) but just activates the running application and leaves.
Try a Sleep (to ensure the app's activated) and While loop until the "Text Message" Window disappears.

Mort
29th January 2008, 08:27 AM
Anyone happen to know how to write a multi size string entry into the registry?
RegWriteMulti (with array as entry parameter)

oman181
29th January 2008, 04:17 PM
Is is possible to write a script to set the backlight on a HTC Touch (elf, P3450) and then have that script assigned to the side button? Would the script need to be launched by a separate appn?

When going outside the screen is hard to see and I am seeking to have the side button work as backlight control.

Thanks for any help

master_of_merol
29th January 2008, 10:57 PM
Hi!

I'm trying to make an script for displaying a customized notification when for new incoming sms/email, but I don't know how to catch this events so I'd be able to set the customized one instead ot the anoying WM6's default. Any hint?

flaviopac
29th January 2008, 11:09 PM
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.
http://www.gldrush98.com/uploads/Tomtom2.mscr

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


How can I set the tomtom's icon to this script?

holmanm
29th January 2008, 11:28 PM
Hi!

I'm trying to make an script for displaying a customized notification when for new incoming sms/email, but I don't know how to catch this events so I'd be able to set the customized one instead ot the anoying WM6's default. Any hint?

Using RegRead on HKCU\System\State\Messages\TotalEmail\Unread\Count should work for email and HKCU\System\State\Messages\sms\Unread\Count for sms. When they are greater than 0.

perasite
30th January 2008, 01:34 AM
I wrote a script that does just that and displays it on a single today screen line with voice mail and missed calls too. You can find it at http://www.perasite.com

KnifeFed
8th February 2008, 01:01 AM
Mortscript is indeed one fine piece if software. I'd like a script that calls my bank and checks my account balance... ie:

call number / phone contact
sleep XXX
enter account number and #
sleep XXX
enter pincode and #
sleep XXX
hang up

How would I go about doing that?


Also, does anyone know how to launch a program at startup AFTER the pincode has been entered successfully?

neomagik
14th February 2008, 02:31 PM
A very simple script that uses the attached Wifi_on.exe and Wifi_off.exe files to toggle Wifi when Internet Explorer is opened and closed.

The Wifi_on ond Wifi_off files work on my Trinity (HTC P3600) but may not work on all devices so suggest just running them manually first.

While (1)

If WndExists "Internet Explorer"
Run "Windows\Wifi_on.exe"
Sleep 2000
If not WndExists "Internet Explorer"
Run "Windows\Wifi_off.exe"
EndIf
EndIf
Sleep 2000
EndWhile

neomagik
14th February 2008, 02:39 PM
I've installed MortScript, and created (using PHM text pad, saved as ANSI) a file containing the following text, and named "test.mscr".

run "/windows/async.lnk"
waitfor ActiveSync,2
sleep 3000
SendKeys "s"

When I click on it, nothing happens - no error, but neither does it
seem to run. Although some time later, I did get a window pop-up that said it couldn't find a window named ActiveSync (so maybe it did run?). Is there a good way to find out what's going on? I'm completely new to MortScript (and PPC programming) but I'd like it to start ActiveSync and initiate the sync on its own. Is there a simple "hello world" script I can try to see if it's really running anything?

Thanks,

Mike

It worked fine on my phone. Are you sure you have mortscript installed properly?

prscott1
14th February 2008, 11:14 PM
I've appreciated learning from the various scripts posted here. Thank you everyone!

I created a "task scheduler" shell script for all to use if you'd like. I have comments in it to help. It is really a very simple script that will run other scripts (or jobs) Monday - Friday 6am - 8pm. Modify as necessary.


Edit2: I'm making the scheduler more modular - here are different pieces.
scheduler.mscr - the main driver. morning_scripts.mscr - calls my morning scripts and submits my check email script. weekend_scripts, weekday_scripts - self described. connect.mscr - just a connection check before running other scripts that need internet on. email.mscr - get email from my two accounts.

I revised the scheduler and it can be found now at:

Scheduler (http://forum.xda-developers.com/showpost.php?p=2026713&postcount=256)

prscott1
14th February 2008, 11:32 PM
I am working on a backlight toggle script SetBacklight() command doesn't work properly on my wing (as warned by Mort). I have it working fine for me now. I use batterystatus xml and have a backlight icon setup so ontap it calls this script and toggles my backlight up one notch and if already at the highest it goes back to the lightest. Note: on my wing, brightness only has 4 settings: 1, 2, 3, 4

My question for the gurus : Is there anyway to change this script so that the backlight window doesn't have to open and close during the toggle. I tried various things with minimize window and background scripting but couldn't get there.

TIA.

mawst95
15th February 2008, 03:43 AM
Noob here, sorry. Searched the thread, couldn't find what I wanted. Is it possible to invoke the keylock in a delayed fashion after the screen goes to sleep/suspend. Like wait 10 seconds after sleep to initiate keylock?

gtxaspec
19th February 2008, 02:22 AM
Hi guys,
Basically I would like to make a script that checks to see if there is an active internet connection, and if so access a specific webpage. What I came up with is:

#ErrorLevel("off")

#If Connected, ping this website.
Connected=InternetConnected("http://blah.com/mogul.html")

#depricated, not used...do not want to connect if not already connected.
#Connect("Sprint")

#if we are online, run this every 10 minutes, if not, go to next statement
If (Connected=0)
Runat(Timestamp()+600,"\Documents and Settings\IP_sendv1.mscr")
else

#not conneted, try again in 10 minutes.
If (Connected=1)
Runat(Timestamp()+600,"\Documents and Settings\IP_sendv1.mscr")
EndIfThe problem with this, is it doesn't run exactly every 10 minutes, sometimes 5, 7 or at 12 minutes, it varies. How do I know? I check the server logs. This problem has been duplicated across several handsets.

Also, another problem I am experiencing is the script running automatically after soft reset, without being called. It's not in Startup, its not in the registry. But i know it runs because i use the task manager in Pocket Controller and MortScript.exe is running, also verified in server logs. Any suggestions?


Thanks

technonaut
19th February 2008, 03:11 AM
I use this one with zaTunnel to fire up an ssh tunnel for me on port 21:

errorlevel( "Warn" )
waitfor( "zaTunnel", 10 )
waitforactive( "zaTunnel", 10 )
message( "Looks like zaTunnel is active", "Good News" )
sendkeys( "zaTunnel", "my.server.net" )
sendtab ( "zaTunnel" )
sendtab ( "zaTunnel" )
sendkeys( "zaTunnel", "username" )
sendtab ( "zaTunnel" )
sendkeys( "zaTunnel", "password" )
sendtab ( "zaTunnel" )
sendtab ( "zaTunnel" )
sendDelete ( "zaTunnel" )
sendDelete ( "zaTunnel" )
sendkeys ( "zaTunnel", "21" )
sendtab ( "zaTunnel" )
sendkeys ( "zaTunnel", "127.0.0.1" )
sendtab ( "zaTunnel" )
sendDelete ( "zaTunnel" )
sendDelete ( "zaTunnel" )
sendkeys ( "zaTunnel", "21" )
sendtab ( "zaTunnel" )
sendspace ( "zaTunnel" )
x = question( "Ready to exit?" )

KnifeFed
19th February 2008, 11:20 AM
I'd like a script that calls my bank and checks my account balance... ie:

call number / phone contact
sleep XXX
enter account number and #
sleep XXX
enter pincode and #
sleep XXX
hang up

How would I go about doing that?

I've tried making a script for this. Here's what I came up with so far:

Run ( "\Windows\cprog.exe", "-url tel: [phone number to bank call-service]" )
Sleep ( 500 )
SendLeftSoft
Sleep ( 7000 )
#choose service
SendKeys ( "1" )
Sleep ( 1000 )
#enter account number and # to confirm
SendKeys ( "474878943123#" )
Sleep ( 1000 )
#enter pin code and # to confirm
SendKeys ( "8903#" )
Exit


The problem I'm having is that the characters in the SendKeys command are enterted twice, i.e it enters "11" instead of "1" at the first SendKeys command. It works correctly in a script launching notepad.exe and entering keys, so it seems to be a problem in the Phone application. Any ideas? Also, does anyone know how to send End-key, i.e making the script hang up?

prscott1
19th February 2008, 07:33 PM
The problem I'm having is that the characters in the SendKeys command are enterted twice, i.e it enters "11" instead of "1" at the first SendKeys command. It works correctly in a script launching notepad.exe and entering keys, so it seems to be a problem in the Phone application. Any ideas? Also, does anyone know how to send End-key, i.e making the script hang up?

I'm having this same problem - but with trying to enter my PIN for voicemail. If anyone has any advice, I'd appreciate it too!

KnifeFed
19th February 2008, 08:52 PM
I'm having this same problem - but with trying to enter my PIN for voicemail. If anyone has any advice, I'd appreciate it too!

My solution was to bring up the keypad and use the MouseClick-command instead. Now my script is fully functioning.

Curious D
20th February 2008, 09:23 AM
Hi. While there are a couple of posts on this thread to switch profiles, I'm looking specifically to switch to Flight Mode late in the evening and resume my previous settings in the morning. I'm looking to shut off my phone and bluetooth at night (to prevent being awakened by a ring or having the lights blinking incessantly through the night) while leaving my phone in standby mode so that MortPlayer can be used as my alarm clock. The problem that I have shutting off my phone and bluetooth is that I sometimes forget to turn the phone and bluetooth on during a busy morning. Any such program or script exist? Thanks.

neomagik
20th February 2008, 02:52 PM
Hi. While there are a couple of posts on this thread to switch profiles, I'm looking specifically to switch to Flight Mode late in the evening and resume my previous settings in the morning. I'm looking to shut off my phone and bluetooth at night (to prevent being awakened by a ring or having the lights blinking incessantly through the night) while leaving my phone in standby mode so that MortPlayer can be used as my alarm clock. The problem that I have shutting off my phone and bluetooth is that I sometimes forget to turn the phone and bluetooth on during a busy morning. Any such program or script exist? Thanks.

I don't know of a program to do this but you could do it with mort script.

I would assign a hardware button (or start menu item) to a script that puts the phone to "sleep" (which effcetively just switches it to silent and turns off LED + BT) at night and then wakes it up say 5 minutes before Mortplayer is due to alarm in the morning.

Curious D
21st February 2008, 09:02 AM
My understanding of MortScript is very limited. I have modified other scripts to link my BT to a speaking clock, my BT to Mortplayer and keeping the backlight on for certain programs, but that's about it. I don't know which registry string to modify, nor do I know how to create a GUI to help me set the time when I want the phone to turn to flight mode and to come out of flight mode. Given some of the scripts that I have seen from oldSAP, I know that it is possible, but I don't know how to do it.

Mort
21st February 2008, 10:50 AM
Finally, my forum supports attachments, so I added a subforum for scripts (http://www.sto-helit.de/forum/viewforum.php?f=18) (along with ones for MortPlayer and MortButtons skins, btw.).

nobo2k
21st February 2008, 12:51 PM
Just a small script, that turns on Wifi, checks after 15seconds if there is a connection, else if it only showas "available" it toggles wifi off, after 1,5 secs back on .. (does this 5 times, then stops) (Had to use this, because sometimes my device will not connect to my accesspoint by itself, just stays in the status "available" )
If there is already a connection to a specified AP it will start my favorite RSS Reader and update the feeds

Maybe its usefull for one.. u can use it for updating news feeds, websites or whatever you need updated in the morning at a specified time. (I will use it with RunEveryDay http://forum.xda-developers.com/showthread.php?t=294575)

ErrorLevel("syntax")
if(RegRead("HKLM", "System\State\Hardware", "Wifi") = 1)
Run "Windows\Wifi_on.exe"
Sleep 15000
endif
For i=1 to 5
if(RegRead("HKLM", "System\State\Hardware", "Wifi") = 7)
Run "Windows\Wifi_off.exe"
Sleep 1500
Run "Windows\Wifi_on.exe"
Sleep 15000
endif
if (RegRead("HKLM", "System\State\Connections\Network", "Descriptions") eq "HomeAp")
Run "Program Files\NewsBreak\NewsBreak.exe"
Sleep 1500
MouseClick(20, 315)
Sleep 500
Exit
EndIf
Next
Exit

prscott1
21st February 2008, 04:42 PM
My solution was to bring up the keypad and use the MouseClick-command instead. Now my script is fully functioning.


NEVER mind: I worked out the coordinates for each number and pound sign. Thanks.

Hi KnifeFed, would you share that portion of your script with me/us?

dancer_69
24th February 2008, 12:16 PM
I want to make a script that every 1 minute checks if the phone is on and play a sound alarm when the phone signal is low. I manage to make work the part that when the signal is low to play the sound but how make it checks every 1 minute, first if the phone is on and then if the signal is low to play the sound?
This is what I have done:

SignalStrength = RegRead("HKLM", "System\State\Phone", "Signal Strength" )
PhoneActive = RegRead("HKLM", "System\State\Phone", "Cellular System Available" )

While(%PhoneActive% = 1 )
if (%SignalStrength% < 40 )
PlaySound("\Storage Card\Program Files\MortScript\Phone_Di-J_Fairba-1727.wav")
endif
Sleep (60000)
endwhile

Axman
24th February 2008, 04:57 PM
Also, another problem I am experiencing is the script running automatically after soft reset, without being called. It's not in Startup, its not in the registry. But i know it runs because i use the task manager in Pocket Controller and MortScript.exe is running, also verified in server logs. Any suggestions?


Thanks

The RunAt command uses the WM Notification queue to schedule execution. Since you are using RunAt to run a script that AGAIN has a RunAt, you are creating a loop. To remove it use the RemoveNotifications command. To see a list of items in the notification queue download ScaryBear software Check Notifications. Google it..

heartpumper77
25th February 2008, 02:52 AM
Hey Fellas,

I am a newbie to Mortscript and need a script to run sms upon startup and auto minimize. I have placed the lnk file into the startup folder so it runs on startup but then I have to manually minimize. I would like a script to start sms then minimize instantly.

Thanks

prscott1
26th February 2008, 11:58 PM
I want to make a script that every 1 minute checks if the phone is on and play a sound alarm when the phone signal is low.

Your while / endwhile looks good but only when your current conditions are met; if those conditions are not met - that is, lots of power left, then your script ends. You should setup a conditional if, elseif, else loop to continue the script running and have it sleep for 60 seconds and then loop back to top if current conditions are not met - OR use RunAt() to submit your script every next minute.

for RunAt to work - you would use GetTime() and setup variables for minute and nextminute. for example:
minute = (FormatTime("i"))
nextminute = minute + 1

then

RunAt( year, month, day, hour, nextminute, "\path\to folder\script.mscr")

If you wanted it to run every five minutes adjust nextminute variable accordingly. You might put this in a conditional statement also so if your condition is met it won't keep submitting. Let me know if you need more information - I'd be happy to try and help.

prscott1
27th February 2008, 12:01 AM
Hey Fellas,

I am a newbie to Mortscript and need a script to run sms upon startup and auto minimize. I have placed the lnk file into the startup folder so it runs on startup but then I have to manually minimize. I would like a script to start sms then minimize instantly.

Thanks

From the mortscript manual:

9.7.3 Minimize/hide a window (Minimize)

Minimize( window title )

Minimizes (or, on Windows Mobil systems, rather hides) the window with the given title.

So, you should put the following at the bottom of your script (this is the name of my sms window - substitute yours if different).

Minimize( "Text/Multimedia" )

Rabia
1st March 2008, 10:22 AM
i've seen examples in this thread that are very usuful but i was wondering i want a very simple command line to say, make an hourly check where every hour my wifi turns on search for my network "homewifi" if its found then it connects to it, if not then wifi will be turned off again

thanks in advance

prscott1
1st March 2008, 08:14 PM
i've seen examples in this thread that are very usuful but i was wondering i want a very simple command line to say, make an hourly check where every hour my wifi turns on search for my network "homewifi" if its found then it connects to it, if not then wifi will be turned off again

thanks in advance

Rabia, you should look at my scheduler.mscr in a previous post above - it has a good example for how to schedule / run a script every hour. You could massage it to fit your needs and with checking for the wifi signal, etc.

hope this helps.

Martinhdk
1st March 2008, 11:03 PM
Has anyone looked at TWEAKSTER for TREO. Seems quite nice but as I dont know anythig about a TREO, maybe someone can tell if it will work directly on our HTC devices or must it be ported in some way?

http://discussion.treocentral.com/showthread.php?t=139811
"MortScript: Tweakster, BETA available

--------------------------------------------------------------------------------

Cool new app available for you Treo power-users!!

Tweakster has three major functions:
1) Scheduling : create profiles & schedule events (33 plugins included)
2) Tweaks : applying tweaks (97 tweaks included)
3) Probes : retrieve system info (44 probes included)

Here are some examples of what you can do...

- Set up profiles for your favorite settings
- Change ringtones at 9:00 Mon-Fri to one set of ringtones, and
evenings and weekends to a different set of ringtones
- Soft Reset at 3:00 AM every day
- Turn Bluetooth & Wifi on at 8:00 AM, Mon - Fri
- Clear you IE cache every night at 2:00 AM
- Turn Brightness up, but keyboard lights off at 7:00 AM
- Check an eBay auction every 15 minutes, display current bid on Today Screen
- Set a storage alert when your builtin flash storage drops below 1MB
- Leave yourself a Voice reminder for lunch at 11:45
- NEW: Use your Treo as a SpyCam, schedule a video recording in "stealth" mode"


EDIT. This is my first attempt with MORT so sry for being stupid. Have just tried it and some works and some dont. I am not clever enough yet to get the plugins to work.. Must dig deeper into this.."The Mort Virgin" (:=

prscott1
3rd March 2008, 05:27 PM
Here is a very simple script that downloads the radar map from the weather channel and then rotates to landscape to display the radar using PIE. when you exit the program it rotates back to portrait.

NOTE: this script pulls the south central US radar map. Please change the URL to pull the map you want.

Radar.mscr:

File = "\Storage Card\Program Files\Mortscript\Files\weather.jpg"
URL = "http://image.weather.com/web/radar/us_sc_regradar_plus_usen.jpg"


Download( URL, File )

Rotate(90)
Runwait( "\windows\iexplore.exe", File)
Rotate(0)
exit

Curious D
11th March 2008, 12:02 AM
I don't know of a program to do this but you could do it with mort script.

I would assign a hardware button (or start menu item) to a script that puts the phone to "sleep" (which effcetively just switches it to silent and turns off LED + BT) at night and then wakes it up say 5 minutes before Mortplayer is due to alarm in the morning.

I'm figuring that I can have the script toggle the system volume and then toggle the phone and bluetooth through the Comm Manager. What I can't figure out is how I can have this script check the time while it is in sleep mode. How do alarm programs work if the phone is in sleep mode? Further, if the script runs while in sleep mode, does it sap battery life running in the background all the time? I was wondering if someone might be able to help me with this attempt? Thanks.

ewingr
11th March 2008, 04:54 AM
I want to have a simple way to change my forwarding. I haven't found an app to do it, so maybe MortScript will .

I've searched (even with Google searches) and don't find anything on this topic.

I launched the app that connects to AT&T and sends the forwarding information, and then I looked at what was running from the memory app, and nothing was listed. So at this point I'm not sure how to launch the app I need to have a script put in a phone number. I want to be able to toggle it between my home, and voicemail.

I was thinking about having the script punch in keystrokes, possibly mouse click, but I need to know what app to open to to that. Not sure if this is feasible. If you have any thoughts on a direction to point me in to focus my thoughts on getting started it is appreciated.

Thanks for any thoughts.

bbobeckyj
11th March 2008, 08:35 AM
I want to have a simple way to change my forwarding. I haven't found an app to do it, so maybe MortScript will .


Thanks for any thoughts.

call forwarding number is an operator setting (it needs to work if your phone is off or out of signal areas) so it is not 'on the phone', but kept by your service operator
"ctlpnl" cplmain.cpl,20,3
is the shortcut for the phone services control panel (i think)

gthing
11th March 2008, 10:24 AM
I had set up a repository for mortscripts here some time ago: http://gthing.net/scripts/

I still see a bit of activity on it and have left it up for quite some time, although despite ranking #1 for "mortscript scripts" on Google and being the only repository I am aware of it could be a bit more popular.

Anyway there is some stuff there if you'd like to use it. The site seems to get a lot more browsers and downloaders than contributors.

PseudoReal
11th March 2008, 11:34 AM
Hi guys,

I dont use push mail nor do I use the check every xx hours from windows to check my mails.
Is it possible to have a button on today screen, which starts a mort script, that checks mails just one time?!

If so, how?

Thanks!

ewingr
11th March 2008, 03:04 PM
call forwarding number is an operator setting (it needs to work if your phone is off or out of signal areas) so it is not 'on the phone', but kept by your service operator
"ctlpnl" cplmain.cpl,20,3
is the shortcut for the phone services control panel (i think)


Thanks! Yeah, I happend to realize that after I posted, and just edited my post. Anyway, that shortcut will be helpful.

My plan first is to look through some scripts to see how they work, and I'll be giving it a try. I suspect I'll need to do some mouse clicks, and keystroke input. Having the shortcut to open the app was my big sticking point.

bbobeckyj
11th March 2008, 08:33 PM
Originally Posted by neomagik
I don't know of a program to do this but you could do it with mort script.

I would assign a hardware button (or start menu item) to a script that puts the phone to "sleep" (which effcetively just switches it to silent and turns off LED + BT) at night and then wakes it up say 5 minutes before Mortplayer is due to alarm in the morning.

I'm figuring that I can have the script toggle the system volume and then toggle the phone and bluetooth through the Comm Manager. What I can't figure out is how I can have this script check the time while it is in sleep mode. How do alarm programs work if the phone is in sleep mode? Further, if the script runs while in sleep mode, does it sap battery life running in the background all the time? I was wondering if someone might be able to help me with this attempt? Thanks.

just write a script to toggle the screen on, turn on radio, set volume and playlist (and one to turn it all off the night before). then use another program to launch at whatever time you want ( is use alarmToday ) someone just wrote a freeware one which i don't remember the name of ( daily/everyday launch or something similar ) available on this site somewhere

ewingr
12th March 2008, 02:07 AM
..."ctlpnl" cplmain.cpl,20,3
is the shortcut for the phone services control panel (i think)

What would be the correct syntax to run this command?

I tried run ("ctlpnl" cplmain.cpl,20,3) and get errors. ANd I've tried ("ctlpnl" , cplmain.cpl,20,3).

Thanks

[edit]
I'm making progress. AFter some searching, I realized that as a link, I needed a file with this in it: 25#ctlpnl.exe cplmain.cpl,20 ... as the link file.
Then I have to figure out syntax to call it. I"m working and testing on that now.

bbobeckyj
12th March 2008, 08:32 AM
What would be the correct syntax to run this command?

I tried run ("ctlpnl" cplmain.cpl,20,3) and get errors. ANd I've tried ("ctlpnl" , cplmain.cpl,20,3).

Thanks

[edit]
I'm making progress. AFter some searching, I realized that as a link, I needed a file with this in it: 25#ctlpnl.exe cplmain.cpl,20 ... as the link file.
Then I have to figure out syntax to call it. I"m working and testing on that now.

rename this file from .cab to .lnk (can't upload 'links')
you will not be able to use the inbuilt file explorer,
have a look at the properties to see how shortcuts are done. there is a list of links thread in this forum you could check out for further info.
B

ewingr
12th March 2008, 08:40 PM
Thanks Bbobeckj

Actually I had figured out the lnk file, and have in fact successfully created the scripts which run. I have put shortcuts to the scripts in the windows\start menu\Programs directory, which run when I click on them.

but when I point a button to those links to run them with my button, I get the error "Error starting \My Documents\ForwardHome.mscr". For the moment, ForwardHome.mscr is the script file. So it seems that when using a button to call the link it fails but when I use file manager and click the link it runs.

Oh, also, the link shows up in my menu of apps in SPB, and it runs when I click on that too.

I'm actually planning on creating specific directories to keep my script stuff in, but want to figure this out first.

Am I going to need to put all this stuff in one directory? Any other thoughts?

bbobeckyj
12th March 2008, 10:14 PM
Thanks Bbobeckj

Actually I had figured out the lnk file, and have in fact successfully created the scripts which run. I have put shortcuts to the scripts in the windows\start menu\Programs directory, which run when I click on them.

but when I point a button to those links to run them with my button, I get the error "Error starting \My Documents\ForwardHome.mscr". For the moment, ForwardHome.mscr is the script file. So it seems that when using a button to call the link it fails but when I use file manager and click the link it runs.

Oh, also, the link shows up in my menu of apps in SPB, and it runs when I click on that too.

I'm actually planning on creating specific directories to keep my script stuff in, but want to figure this out first.

Am I going to need to put all this stuff in one directory? Any other thoughts?

I have all my scripts in 'storage card\scripts' and launch almost all of them using wm5NewMenu. Any that i put into 'window\start menu\programs' i do so as 'links' not as copies of the original file ('mscr's) (it makes third party apps easier to use with them, which is what i'm guessing your problem actually is)

bbobeckyj
12th March 2008, 11:05 PM
So, I posted too many times in this thread without any examples, so here are a few are very simple ones, but which I use everyday...

#create a new blank script with .txt extension in 'storage card\scripts\tests'. you will need a blank 'mscr.txt' file in the address stated for this to work
Copy ("storage card\my documents\mscr.txt", "storage card\scripts\tests\1.mscr.txt")
Mouseclick (120, 310)
#(the mouseclick refreshes the screen if used with gsfinder)


#toggle backlight between max and one-from-minimum (on trinity at least)
CurrentBright = RegRead( "HKCU", "ControlPanel\Backlight", "Brightness" )
If (CurrentBright = 1)
SetBacklight (100, 5)
Else
SetBacklight (1, 1)
EndIf


#update emails, replace 'Yahoo!' with youremail name if required, create a .lnk with properties 'windows\tmail.exe -service "Yahoo!" and place in storage card\prgram files for this to work (or edit as you like)
If Wndexists ("Yahoo!")
sendRightSoft ("Yahoo!")
Sleep (1000)
sendUp
sendCR ("Yahoo!")
else
run "\storage card\program files\Yahoo!.lnk"
WaitFor ("Yahoo!", 9)
sendRightSoft ("Yahoo!")
Sleep (1000)
sendUp ("Yahoo!")
sendCR ("Yahoo!")
endif

#
#specific this one - if you are using gsfinder, and have a script you are editing as the second item below this script (see screen cap) it will delete the .txt and execute
#
senddown
senddown
#clicks 'file' when using gsfinder. start with this line if you want this script to be used with wm5newmenu, or a similar launcher to edit any item already selected
mouseclick (10, 310)
sleep (500)
#selects 'rename' when using gsfinder
senddown
senddown
senddown
senddown
sleep(500)
sendcr
sleep (500)
#deletes '.txt'
sendright
sendbackspace
sendbackspace
sendbackspace
sendbackspace
sendcr
#activates the script (delete this line if you don't want it to be run)
sendcr

#
#writes '.txt' to the item immediately below the script
#
senddown
#clicks 'file' when using gsfinder. start with this line if you want this script to be used with wm5newmenu, or a similar launcher to edit any item already selected
mouseclick (10, 310)
sleep (500)
#selects 'rename' when using gsfinder
senddown
senddown
senddown
senddown
sleep(500)
sendcr
sleep (500)
sendright
sendkeys (".txt")
sendcr
#opens text file
sendcr

prscott1
13th March 2008, 12:11 AM
I have another simple script that downloads my watchlist from myebay and then I parse the top two items from it and shove some info into registry so I can pull it to display on my today screen (BatteryStatus) and also display it in a message window. The key for making this work is to first login to PocketEbay using this URL:
http://wap2.bonfiremedia.com/ebayserver/servlet/Controller?Command=WapMainMenu

follow the links to sign in, then navigate to MyEbay, and then to Watching. Copy and paste THAT URL into this script to replace my URL. Here is the code. I attached a screen print that shows the message and another screen print that shows an item displayed on my today screen.


date1 = FormatTime( "{W} H:i ", TimeStamp())

File = "\Storage Card\Program Files\Mortscript\Files\EbayWatch.htm"
URL = "http://wap2.bonfiremedia.com/ebayserver/servlet/Controller?bmsid=bdfqjphyew&Command=MyeBayWatching&ot=1&u=EBAYUSERNAME&bn=1&bs=5&av=1&cache=1213"
Delete( File )
Sleep( 2000 )
Download( URL, File )

If ( NOT FileExists( File ) )
Message( "Can't retrieve EbayWatch.", "eBayWatch" )
Exit
EndIf

HTML = ReadFile( File )

ForEach Block in split ( HTML, "<br /><br/>", TRUE )

If ( Find( Block, "1 <a href=" ) )
S = Part( Block, "</a>", 1, 0 )
Watch1 = SubStr( S, (Find( S, ">" ) + 1 ), 30 )
T = Part( Block, "</a>", 2, 0 )
Amt1 = SubStr( T, (Find( T, "$$" ) + 1), 6 )
BidTimea = SubStr( T, (Find( T, "<br/>" ) + 5), 10 )
BidTime1 = BidTimea&" Upd: " &date1
EndIf

If ( Find( Block, "2 <a href=" ) )
S = Part( Block, "</a>", 1, 0 )
Watch2 = SubStr( S, (Find( S, ">" ) + 1 ), 30 )
T = Part( Block, "</a>", 2, 0 )
Amt2 = SubStr( T, (Find( T, "$$" ) + 1), 6 )
BidTimeb = SubStr( T, (Find( T, "<br/>" ) + 5), 10 )
Bidtime2 = Bidtimeb&" Upd: " &date1
Else
Watch2 = "No 2nd Watched Item"
Amt2 = "N/A"
BidTime2 = "N/A"
EndIf

EndForEach

# commented out - please uncomment and put elements where you would like them to be
#RegWriteString("HKCU", "\Software\RenaeToday\ebay\", "Watch1", Watch1)
#RegWriteString("HKCU", "\Software\RenaeToday\ebay\", "Time1", BidTime1)
#RegWriteString("HKCU", "\Software\RenaeToday\ebay\", "Amount1", Amt1)
#RegWriteString("HKCU", "\Software\RenaeToday\ebay\", "Watch2", Watch2)
#RegWriteString("HKCU", "\Software\RenaeToday\ebay\", "Time2", BidTime2)
#RegWriteString("HKCU", "\Software\RenaeToday\ebay\", "Amount2", Amt2)



Message( Watch1 & "^CR^" & "" & Amt1 & " " & BidTime1 & "^CR^" & "^CR^" & Watch2 & "^CR^" & "" & Amt2 & " " & BidTime2, "eBayWatch" )

ewingr
13th March 2008, 12:32 AM
..Any that i put into 'window\start menu\programs' i do so as 'links' not as copies of the original file ('mscr's) (it makes third party apps easier to use with them, which is what i'm guessing your problem actually is)


The items in my Window\start menu\programs are in fact links. So, I'm not sure what the problem is with that. But, I may have another problem. I'm going to look at all the files contents again.

I do plan to do exactly what you said: make a scripts directory on my storage card.

RUNAT

Now that I do have the scripts at least working, I'd like to have them run at a certain time. I've read the docs about the RUNAT, and am left with questions. And I haven't found examples yet. HOpefully simple questions:

I'd like to have my forwardtovoicemail script run every weekday morning at a certain time, and the forwardtohome one run evcery evening during the week at a certain time.

The docs say:

RunAT( year, month, day, hour, minute).

Would it work to enter:

RunAT (,,,18,0) to run at 6:00 pm?

Determining the day of week, I presume I would use some variation of the FormatTime command. NOt sure about that either.

Any idea of a place to find a bunch of code samples, without having to read a lot of threads to figure look at them? Can learn so much from code examples.

prscott1
13th March 2008, 03:45 AM
I'd like to have my forwardtovoicemail script run every weekday morning at a certain time, and the forwardtohome one run evcery evening during the week at a certain time.

The docs say:

RunAT( year, month, day, hour, minute).

Would it work to enter:

RunAT (,,,18,0) to run at 6:00 pm?

Determining the day of week, I presume I would use some variation of the FormatTime command. NOt sure about that either.

Any idea of a place to find a bunch of code samples, without having to read a lot of threads to figure look at them? Can learn so much from code examples.

If you look at #206 in this thread, you will find a scheduler.zip download. Download it, look at the scheduler.mscr inside and you should have some answers for time formatting and how to submit using RunAt. HTH.

ewingr
13th March 2008, 04:06 AM
Thanks so much.

Quick OT question: Is there a way to go straight to a post number?

neomagik
13th March 2008, 03:53 PM
This is my script for managing my phone during work time, home, and driving.

It recognises when my handsfree is connected or disconnected, rotates the screen if tomtom is started and on a friday it prompts me to record my mileage and adds it to a text file along with the date.

I have assigned a hardware button to toggle bluetooth on or off and it is this that initiates certain parts of the script.

--------------------------------------------------------------------------------------

VariableValue = 0
While (1)

#Check when Handsfree is connected, turn volume
#up and turn backlight to bright
HandsFreeEnabled = RegRead("HKLM", "System\State\Hardware", "Handsfree")
If (HandsFreeEnabled = 1 && VariableValue = 0)
SetVolume 255
Sleep 2000
PlaySound "\Windows\Infbeg.wav"
SleepMessage(10,"Handsfree Connected","Handsfree",1)
SetBackLight 100, 100
VariableValue = 1
EndIf

#Keep display on while Handsfree is enabled
If (HandsFreeEnabled = 1 && VariableValue = 1)
ToggleDisplay (1)
EndIf

#Rotate screen if TomTom is started
If WndExists "TomTom Navigator"
If (VariableValue = 1)
Rotate (90)
EndIf
EndIf

If Not WndExists "TomTom Navigator"
Rotate (0)
EndIf

#Check if bluetooth is disabled
BTState = RegRead("HKLM", "System\State\Hardware", "Bluetooth")
If (BTState < 10 && VariableValue = 1)

Call Time

#If Friday morning, prompt for mileage

If (Day = 5 && Hour < 16)
PlaySound "\Windows\Infend.wav"
Sleep 1000

#Get the current date
Date = FormatTime ( "d/m/Y" )


Mileage = Input("Enter your current Mileage: ", "Mileage")
Sleep 2000

WriteFile( "\My Documents\Mileage.txt", "^NL^", 1)
WriteFile( "\My Documents\Mileage.txt", Date & " = " & Mileage & " miles", 1)

EndIf

#If day is Monday to Friday and time
#is between 8am and 3pm.
#set volume to silent and turn off display

If (Day > 0 && Day < 6)
If (Hour > 07 && Hour < 16)
ToggleDisplay (0)
SetVolume 0
Sleep 1000
VariableValue = 0

#If critera above not satisfied then set the
#volume to normal and reset

Else
ToggleDisplay (0)
RegWriteDWord ( "HKCU", "ControlPanel\Volume", "Volume",3435973836 )
Sleep 1000
RegWriteDWord ( "HKCU", "ControlPanel\SoundCategories\Ring", "InitVol",00000004 )
Sleep 1000
VariableValue = 0
Sleep 1000
Reset
EndIf
EndIf
EndIf
Sleep 2000

EndWhile

Sub Time
#Get the current day
Day = FormatTime ( "w" )


#Get the current hour
Hour = FormatTime ( "H" )

#Get the current minute
Minute = FormatTime ( "i")

EndSub

PseudoReal
13th March 2008, 06:00 PM
Ok I have been able to Create myself a check mail script - Thanks at bbobeckyj!

But I do have a question. Isnt there a possibility to do checks in the background.
Currently, it simply does everything automated, but you can see the steps on the screen?!

Thanks!

bbobeckyj
13th March 2008, 10:34 PM
Ok I have been able to Create myself a check mail script - Thanks at bbobeckyj!

But I do have a question. Isnt there a possibility to do checks in the background.
Currently, it simply does everything automated, but you can see the steps on the screen?!

Thanks!

I'm not aware of a way to do the update emails in the background (but I 'm not that clever which such things, so it may be possible). The sendkeys will always (I think) activate the program window. Setting the mail window to minimize immediately after the 'send\receive' is 'clicked' is a good work-around, that will only activate the window for 2-3 seconds.
btw (on my ppc) the update emails script caused an error for some reason with the 'sendup ("Yahoo!")' line, it works without the '("Yahoo!")' though

MavisPuford
13th March 2008, 11:36 PM
Hey, I don't know if this has been posted yet(this thread is HUGE lol, and I did a forum search but found nothing), but I found this website on google:
ScriptFort (http://gthing.net/scripts/index.php?option=com_frontpage&Itemid=1)

It looks kinda new, but promising. :)

*Edit* I found it a couple pages back. *DOH* Oh well, I guess it could have used a bump.

ewingr
14th March 2008, 12:42 AM
OK. I have my first project working, I believe. I'm waiting for my 6:00 time to come for the 2nd test/validation :) But I thought I' post what I've got.

Thanks to prscott1! I used your scheduler you pointed me to to automate my scripts.

My original interest in MortScript was to have a way to set my forwarding easily. I like to forwrad the phone to my home when I'm at home, and to voicemail when away. It's interesting how much of a pain it is to forward the Tilt (I presume it's really not 'the Tilt', but WM6 devices in general...maybe depending on the carrier).

Anyway, my thougt was to have a push button for forward home, and another for forward to voice mail.

Then I read that I could schedule, and given that my wife is always frustrated with me because I would go to work and forget to unforward from home, and she couldn't leave me a message on my phone if I didn't answer.

So, I have a script I'll post here that does the forward to home (I won't bother posting the one forwarding to voicemail, it's about the same). Then I'll post the schedule. I modified the script that prscott1 did.

By the way, I could have done some subroutines, to call with varibles, rather than restate some code, but this is my first go at it, so I thougth I'd keep it simple. Also, I left the forwarding scripts separate so that I could run either individually with a button.

This forwards my phone to voice mail at 7:30am during the week, and back to home at 6:00pm during the week, and leaves it at home during weekend.

I think... :D We'll see if it works. So far it worked on the first time slot today.

Forwarding Script
Now this has to call the phone setup program (thanks bbobeckyj for that), and I had to put in pauses to allow it time to communicate with the network. At least I presume I did. Maybe if I put the keys stroksk in w/o the pauses, it would have just done it after the program came up. Maybe I should try that.

Here's the code:
run "\Storage Card\Scripts\PhoneSetup.lnk"
sleep( 4000 )
SendKeys ("C")
SendKeys ("C")
SendSpecial ( "Tab" )
SendSpecial ( "CR" )
sleep( 15000 )
SendSpecial ( "Tab" )
SendSpecial ( "Tab" )
SendSpecial ( "Tab" )
SendKeys ( "555-555-5555" )
SendSpecial ( "RightSoft" )
Sleep ( 15000 )
SendOK
Sleep ( 15000 )
SendOK



Scheduler

# Script to schedule running of the forwarding scripts
# Forward to Home at 6:00pm weekdays
# Forward to Voice Mail at 7:30am weekdays
# script works best when placed in \windows folder (or subfolder)

# some scripts may want display on so set to 1:
ToggleDisplay(1)

# getting time, date, weekday information, and where forwarded to now
GetTime(hour,min,sec,day,month,year)
date = TimeStamp()
year = (FormatTime("Y"))
month = (FormatTime("m"))
day = (FormatTime("d"))
weekday = (FormatTime( "w" ))
tomorrow = (FormatTime( "d" ) + 1)
hour = (FormatTime("H"))
VMStatus = ReadFile ( "\Storage Card\Scripts\VMStatus.txt" )

# Determine if it is a weekday and before 6:00pm, and forwarded home. If so, then forward to VM, otherwise forward to Home
if ((weekday <> 0) and (weekday <> 6))
if (hour < 18 )

# kill old notification(s)

RemoveNotifications("\Program Files\Mortscript\MortScript.exe", "\Windows\FWDscheduler.mscr" )

# set new notify for 6:00pm
RunAt( year, month, day, 18,00, "\Program Files\Mortscript\MortScript.exe", "\Windows\FWDscheduler.mscr")

If (VMStatus EQ "Home")
#Run script to forward to Voicemail
CallScript( "\Storage Card\Scripts\ForwardVoiceMail.mscr" )
WriteFile( "\Storage Card\Scripts\VMStatus.txt", "Voicemail" )
PlaySound ("\My Documents\My Ringtones\Meepmeep.wav")
Message("Your calls are forwarded to Voice Mail", "Forwarding Scheduler" )
Endif

else

#It is after 6pm

# kill old notification(s)
RemoveNotifications("\Program Files\Mortscript\MortScript.exe", "\Windows\FWDscheduler.mscr" )

# set new notify
RunAt( year, month, tomorrow, 07, 30, "\Program Files\Mortscript\MortScript.exe", "\Windows\FWDscheduler.mscr")

#If the status is Voicemail, then need to forward to Home
If (VMStatus EQ "Voicemail")
#Run script to forward to Voicemail
CallScript( "\Storage Card\Scripts\ForwardHome.mscr" )
WriteFile( "\Storage Card\Scripts\VMStatus.txt", "Home" )
Message("Your calls are forwarded to your home", "Forwarding Scheduler" )
PlaySound ("\My Documents\My Ringtones\Meepmeep.wav")
endif

endif
else

# It is Saturday or Sunday, so will run scripts once and then reschedule for next day at 6am

# kill old notification(s)
RemoveNotifications("\Program Files\Mortscript\MortScript.exe", "\Windows\FWDscheduler.mscr" )

# set new notify
RunAt( year, month, tomorrow, 06, 00, "\Program Files\Mortscript\MortScript.exe", "\Windows\FWDscheduler.mscr")

#If the status is Voicemail, then need to forward to Home
If (VMStatus EQ "Voicemail")
#Run script to forward to Voicemail
CallScript( "\Storage Card\Scripts\ForwardHome.mscr" )
WriteFile( "\Storage Card\Scripts\VMStatus.txt", "Home" )
Message("Your calls are forwarded to your home", "Forwarding Scheduler" )
PlaySound ("\My Documents\My Ringtones\Meepmeep.wav")
endif


endif
# Redraw today screen if scripts or apps impact today screen
RedrawToday
exit

LINK

Here's the contents of the Phonesetup.lnk file:
25#ctlpnl.exe cplmain.cpl,20

Here's a post (http://http://msdn2.microsoft.com/en-us/library/ms838639.aspx)about creating those shortcuts.

So, that's it for now. If anyone has any constructive criticism, I'm interested in hearing it.

[EDIT]
I just looked at this after posting, and I saw that the PSP placement in this forum isn't handoing the if/else indenting quite right. At first I thought, "Oh, I hae a problem with my code". But, I think it's OK, and the indention is due to the form software.

ewingr
14th March 2008, 05:46 PM
Well, the scripts above seem to be working...but...

This morning when it ran at 7:30, I was driving in to work, and had decided to have TomTom running, trying it in Landscape mode.

Anyway, Tomtom wants to maintain the window, and what happened was the setup app launched, but then TomTom jumped back up in front of it, and the keystroke commands went to TomTom.

So, I need to study the docs and determine if I need to minimize, or close, TomTom when this runs, or if I can send the commands to the setup window, even if it is not in focus.

I'm not sure that I run any other programs that try to maintain focus, but this is a consideration I have to consider.

c_shekhar
14th March 2008, 06:11 PM
can we write mscr script for switching ON/OFF the flight mode at the scheduled time of all days in a week?