I'm trying to write a simple script to put in the startup folder to ask if I would like to launch the Dell GPS program... so, anyone? What am I doing wrong? I know it's gotta be something simple...
Code:
RunOnPowerOn Choice( Question( "Would you like to start the Dell GPS?", "Click OK to Continue", "OKCancel" ) )
Case (1)
Run( "\SD Card\Program Files\Dell\GPS Navigation System\DellNav.exe" )
Case (2)
Exit
EndChoice
How about this?
I have a separate script to runonpoweron in the startup...
Why wouldn't this work?
Code:
x = WndExists( "Dell Navigation" )
if x = 0
Choice( "Do you want to start up the Dell GPS?", "Click OK to Continue", "OKCancel" )
Case (1)
Run( "\SD Card\Program Files\Dell\GPS Navigation System\DellNav.exe" )
Case (2)
EndChoice
Exit
Else
Exit
EndIf
It gives me the error
"Invalid Condition
Line:
If x = 0"
xd1936 said:
How about this?
I have a separate script to runonpoweron in the startup...
Why wouldn't this work?
Code:
x = WndExists( "Dell Navigation" )
if x = 0
Choice( "Do you want to start up the Dell GPS?", "Click OK to Continue", "OKCancel" )
Case (1)
Run( "\SD Card\Program Files\Dell\GPS Navigation System\DellNav.exe" )
Case (2)
EndChoice
Exit
Else
Exit
EndIf
It gives me the error
"Invalid Condition
Line:
If x = 0"
Click to expand...
Click to collapse
I've never done any mortscripting in my life, but, not sure of the syntax, but shouldn't it be:
if x == 0
instead of
if x = 0
Dunno, I know VB doesn't use the double equal signs, but since the error was complaining about that exact line, it'd just be my guess.
Thanks for the reply, but I get the same error...
Anyone else? I'm sure it's something simple
Never Mind
Got it to work with this:
Code:
x = WndExists( "Dell Navigation" )
if( x = 0 )
Switch( Question( "Do you want to start up the Dell GPS?", "Click OK to Continue", "OKCancel" ) )
Case (1)
Run( "\SD Card\Program Files\Dell\GPS Navigation System\DellNav.exe" )
Case (2)
Exit
EndSwitch
Else
Exit
EndIf
so what was the problem...
Two things
"if( x = 0 )"
-Gotta have parentheses, apparently
"Switch( Question( "Do you want to start up the Dell GPS?", "Click OK to Continue", "OKCancel" ) )"
-If I don't have the "Question" parameter, then it gives me a list with a choice. and the words "OKCancel" was the only choice...
I'm still a scripting n00b
Related
Hi,
am trying to use Mortscript to automate some key presses on my E650. The script is below.
It gets so far to opening settings.exe and then nothing happens.
What am I doing wrong?
RunCheck = 0
While (1)
HandsFreeState = RegRead("HKLM", "System\State\Hardware", "Handsfree")
If (HandsFreeState = 1 && RunCheck = 0)
Run "\Windows\Settings.exe"
Sleep 2000
SendKeys("6")
Sleep 2000
SendKeys("3")
Sleep 2000
SendKeys("1")
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
I've ran into this before.
you might try sending a mouse click to the field that you want the numbers inputed to. (this insures that the field has focus)
Annoyed by the fact that Search Companion doesn't return the text string you specified even though you indicated All Files & Folders?
This handy script allows you to extend the PersistenHandlers to include other extension. In my case, I added: provxml and rgu. Copy and paste the following code into notepad and save as a .VB script (ex: xp_persisthandler.vbs). Execute the script and specifiy the file extension you wish to include in Search Companion.
Code:
'Add files to Search for files containing text
'© Doug Knox - 11/04/2001
'This code may be freely distributed/modified
Option Explicit
On Error Resume Next
Dim WshShell, N, P, P1, P2, ItemType, MyBox, FileType, Title, Prompt, RegKey, X
Set WSHShell = WScript.CreateObject("WScript.Shell")
P = "HKEY_CLASSES_ROOT\."
P1 = "\PersistentHandler\"
N = "{5e941d80-bf96-11cd-b579-08002b30bfeb}"
Prompt = "Enter the file extension for the file you wish to add." & vbCR
Prompt = Prompt & "Examples: txt, adm, inf"
Title = "Enter File Type"
FileType = InputBox(Prompt, Title, "")
If FileType = "" Then
MyBox = MsgBox("You left the box blank.",4096,"Error.")
Set WshShell = Nothing
WScript.Quit
Else
'Check to see if there is already a PersistentHandler default value
RegKey = P & FileType & P1
X = WshShell.RegRead(RegKey)
End If
'MyBox = MsgBox("The PersistentHandler value for ." & FileType & " is: " & X,4096,"Results")
'Set WshShell = Nothing
If X = N Then
MyBox = MsgBox("This value already exists, and is correct." & vbCR & "No Changes were made.", 4096, "No Changes")
Set WshShell = Nothing
WScript.Quit
End If
If X <> N AND X <> "" Then
MyBox = MsgBox("The Persistent Handler value already exists and is different." & vbCR & "No changes were made.", 4096, "No Changes")
Set WshShell = Nothing
WScript.Quit
End If
If Err.Number <> 0 Then
WshShell.RegWrite RegKey, N
MyBox = MsgBox("The Registry has been updated." & vbCR & "Restart your computer.", 4096, "Done")
Set WshShell = Nothing
End If
Basically i need a script to unload TF3D, start iGO8 and maybe launching TF3D again when exiting iGO. I want this because iGO needs the RAM wich TF is using.
P.S.: I really tried to create my own script but i got stuck, so it's not like i didn't tried.
Code:
RegWriteDWord( "HKLM", "SOFTWARE\Microsoft\Today\Items\TouchFLO 3D", "Enabled", 0 )
RedrawToday
sleep( 200 )
Runwait( "\Program Files\iGo8\igo8.exe" )
RegWriteDWord( "HKLM", "SOFTWARE\Microsoft\Today\Items\TouchFLO 3D", "Enabled", 1 )
RedrawToday
sleep( 200 )
bbonzz said:
Code:
RegWriteDWord( "HKLM", "SOFTWARE\Microsoft\Today\Items\TouchFLO 3D", "Enabled", 0 )
RedrawToday
sleep( 200 )
Runwait( "\Program Files\iGo8\igo8.exe" )
RegWriteDWord( "HKLM", "SOFTWARE\Microsoft\Today\Items\TouchFLO 3D", "Enabled", 1 )
RedrawToday
sleep( 200 )
Click to expand...
Click to collapse
done this and it shows me:
Invalid parameter count for 'RegWriteDWord'
Line:
RegWriteDWord( "HKLM", "Software\Microsoft\Today\Items\TouchFLO 3D" ,
I've checked and the registry key exists.
moduletz said:
Basically i need a script to unload TF3D, start iGO8 and maybe launching TF3D again when exiting iGO. I want this because iGO needs the RAM wich TF is using.
P.S.: I really tried to create my own script but i got stuck, so it's not like i didn't tried.
Click to expand...
Click to collapse
I've got a Mortscript script on my phone that does this. I borrowed it from somewhere and changed it to launch CamerAware and then iGo8 and then restart TF3D when iGo exits. I'll post it later when I have my phone handy.
moduletz said:
done this and it shows me:
Invalid parameter count for 'RegWriteDWord'
Line:
RegWriteDWord( "HKLM", "Software\Microsoft\Today\Items\TouchFLO 3D" ,
I've checked and the registry key exists.
Click to expand...
Click to collapse
have you the last Mortscript? If not, install it, since the script works on my device
yep. I have the latest mortscript and just to be sure i've tested several versions. Still no solution.
moduletz said:
yep. I have the latest mortscript
Click to expand...
Click to collapse
4.3b11? If so, try this one
Code:
RegWriteExt( "HKLM", "SOFTWARE\Microsoft\Today\Items\TouchFLO 3D", "Enabled", "dword:00000000" )
RedrawToday
sleep( 1000 )
Runwait( "\Program Files\iGo8\igo8.exe" )
RegWriteExt( "HKLM", "SOFTWARE\Microsoft\Today\Items\TouchFLO 3D", "Enabled", "dword:00000001" )
RedrawToday
Great! It works! Thank you, bbonzz.
Hi,
I want to get out via a MortScript-routine the folder name of the internal flashdrive, e.x. \My Flash Drive. I wrote a routine that looks for all installed drives that are FAT/EXFAT formatted, but that down't help:
Code:
#TestDrivesFATFS.mscr
###########################################################################
#Searches all installed FATFS/exFAT drives except the one this script resides,
#because only those drives MioPocket can be installed on
###########################################################################
#
#Each filesystem is described in registry as
# [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\<MyProfileName>]
# "DefaultFileSystem"="<MyFileSystem>"
# "Folder"="<MyFolderName>"
Local()
#Obligatory coding as to be found in some MioPocket's scripts
Drive = "\" & Part(SystemPath("ScriptPath"), "\", 2)
#Test starts here
ExcludeDrive = Substr(Drive, 2)
DrivesFATFS = Array()
RegKey = "System\StorageManager\Profiles"
Idx = 0
#Walk the chain of profiles
ForEach variable In RegSubkeys("HKLM", RegKey)
ForEach value, contents In Regvalues("HKLM", RegKey & "\" & variable)
#Some newer CE devices know of exFAT format
If((value eq "DefaultFileSystem") AND (contents ne "FATFS") AND (contents ne "EXFAT"))
Break
EndIf
If((value eq "Folder") AND (contents ne ExcludeDrive))
Idx += 1
DrivesFATFS[Idx] = "\" & contents
EndIf
EndForEach
EndForEach
If(Debug)
ForEach drv in Array(DrivesFATFS)
Message(drv)
EndForeach
EndIf
Any help appriciated. TIA
It can be found in the Registry (at least in my WinMo 6.1... don't know if it's the same way in CE releases or other brands). Look in "HKLM\System\StorageManager\INAND" (or MMC instead of INAND...). The drive name is the "folder" string value).
Thanks for your reply. What I'm searching for is a hint how I can determine per software (MortScript), already having got ( with a piece of code as postet above ) a list of drive-names, which of those is the Storage Card and which is the Flash Drive, not by default knowing of the drive-names, because those differ from device to device.
Running the code above on my device (Medion PNA with CE 5) returns among others the names \Storage Card and/or \My Flash Disk, but this doesn't really help me a lot.
Thanks to all for your interest.
=> SOLVED IT BY MYSELF!
If you are interested in how I did it, here the code to detect the name of SD(HC), MMC, etc card:
Code:
ErrorLevel("warn")
sd = @FindSDDrives()
ForEach drv in Array(sd)
Message(drv)
EndForEach
Sub FindSDDrives()
Local()
SDProfiles = Array()
SDDrives = Array()
SDDrives2 = Array()
#All CE filesystem profiles related to Storage Cards are listet under
#[HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Class\******]
#E.x. MMC_Class, SDMemory_Class
idx = 0
RegKey = "Drivers\SDCARD\ClientDrivers\Class"
ForEach sdcard In RegSubkeys("HKLM", RegKey)
ForEach value, contents In RegValues("HKLM", RegKey & "\" & sdcard)
If(value eq "Profile")
idx += 1
SDProfiles[idx] = contents
EndIf
EndForEach
EndForEach
#Each CE filesystem is described in registry as
# [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\<MyProfileName>]
# "DefaultFileSystem"="<MyFileSystem>"
# "Folder"="<MyFolderName>"
# "Name"="<MyName>
idx = 0
RegKey = "System\StorageManager\Profiles"
ForEach profile in Array(SDProfiles)
ForEach value, contents In RegValues("HKLM", RegKey & "\" & profile)
If(value eq "Folder")
idx += 1
SDDrives[idx] = "\" & contents
EndIf
EndForeach
EndForEach
Clear(SDProfiles)
#Remove duplicates
idx = 0
idx2 = 0
prevdrv = ""
ForEach drv in Array(SDDrives)
idx += 1
If(SDDrives[idx] ne prevdrv)
idx2 += 1
prevdrv = SDDrives[idx]
SDDrives2[idx2] = prevdrv
EndIf
EndForEach
Clear(SDDrives)
Return(SDDrives2)
EndSub
Thanks
jwoegerbauer said:
Thanks to all for your interest.
=> SOLVED IT BY MYSELF!
If you are interested in how I did it, here the code to detect the name of SD(HC), MMC, etc card:
Click to expand...
Click to collapse
Usefull for XDA_UC build in like EnergyROMs. Don't try the German ROMs because of copying files from "Storage Crad" vs. "Speicherkarte" . Now thats solved.
Thanks.
How can I rename a folder or create a new one, with naming the current date via mortscript?
Try this
Code:
createDir=1 #0 = FALSE, 1 = TRUE
dirRoot="\blahblah"
unixTime=TimeStamp()
readableTime=FormatTime("Y-m-d H:i:s",unixTime)
If(createDir)
#create directory, if not still there
If(NOT DirExists(dirRoot\readableTime))
MkDir(dirRoot\readableTime)
EndIf
Else
#rename directory, if not still done, i.e. move all files to new directory
If(NOT DirExists(dirRoot\readableTime))
MkDir(dirRoot\readableTime)
EndIf
Move(dirRoot\"*.*",dirRoot\readableTime,1,1)
#delete (now emptied) old directory
DelTree(dirRoot)
EndIf