MortScript examples accumulation

Search This thread

germarc

Member
May 8, 2016
15
4
Thanks RoryB

I tested the next script on WindowsPC and WinCE Device Emulator and it's running correctly:

Code:
int=FileModifyTime("\SDMMC\Logfiles\Log.txt")
message (int)

FileModifyTime =FormatTime( "d.m.Y_H.i.s", int +3600)
message (FileModifyTime)

createTime = SystemPath("ScriptPath")\ FileModifyTime&i&".cfg"
sleep (500)

If (FileExists("\SDMMC\Logfiles\Log.txt"))
	Rename ("\SDMMC\Logfiles\Log.txt", createTime, 1)
Endif
sleep (500)

If(NOT DirExists("\SDMMC\Backup"))
	MkDir ("\SDMMC\Backup")
Endif
sleep (500)

If (FileExists("\SDMMC\Logfiles\*.txt"))
	Move ("\SDMMC\Logfiles\*.txt", "\SDMMC\Backup", 1)
EndIf
sleep (500)

Copy( "\SDMMC\Documents\Log.txt", "\SDMMC\Logfiles\Log.txt")
sleep (500)

Exit

But I tested the same script on PNA device with WindowsCE and is not running correctly.

This lines (move all .txt files to backup directory)

Code:
If (FileExists("\SDMMC\Logfiles\*.txt"))
	Move ("\SDMMC\Logfiles\*.txt", "\SDMMC\Backup", 1)
EndIf
sleep (500)

Result: .txt files didn't move to backup directory

It is running only with this lines (move only Log.txt file to backup directory)
Code:
If (FileExists("\SDMMC\Logfiles\Log.txt"))
	Move ("\SDMMC\Logfiles\Log.txt", "\SDMMC\Backup", 1)
EndIf
sleep (500)
 
Last edited:

RoryB

Inactive Recognized Developer
Sep 4, 2008
2,921
766
Lexington
I have done tinkered with PNA devices. Is the CE running on them the same as a PDA? I did a quick search and it seems to say the CE running on a PNA has limited access to CE functions. Maybe it does not allow wildcards as a result of this.
 
  • Like
Reactions: germarc

germarc

Member
May 8, 2016
15
4
Is the CE running on them the same as a PDA?

Likely but not the same. For PNA device is WinCE and for PDA device is Windows Mobile.

I did a quick search and it seems to say the CE running on a PNA has limited access to CE functions. Maybe it does not allow wildcards as a result of this.

Ok thanks, I keep on looking for a solution.

Do you have any idea how to delete files by date or name?

Example:

My folder contains 10 files created on 1,2.....10 may 2016 and I want to delete the 5 first files created on 1....5 may 2016.

OR

My folder contains 10 files named as 01.05.2016.......10.05.2016 may 2016 and I want to delete the 5 first files named as 1.05.2016.....05.05.2016
 
Last edited:

voltagexdt

Member
Mar 23, 2017
5
0
i need help

I have used mortscript in the past but was very long ago.

I'm curious if someone would build a script for me and I will gladly pay for it.

I need a script that will allow me to search for a folder
on several hard drive locations.

if it finds the folder.. shows me where it was found.

this is to be used on a windows 7 PC
 

RoryB

Inactive Recognized Developer
Sep 4, 2008
2,921
766
Lexington
I have used mortscript in the past but was very long ago.

I'm curious if someone would build a script for me and I will gladly pay for it.

I need a script that will allow me to search for a folder
on several hard drive locations.

if it finds the folder.. shows me where it was found.

this is to be used on a windows 7 PC
Maybe just use DOS Batch
http://stackoverflow.com/questions/13876771/find-file-and-return-full-path-using-a-batch-file

MortScript would take too many iterations to go through each subdirectory.
 

voltagexdt

Member
Mar 23, 2017
5
0
Maybe just use DOS Batch


MortScript would take too many iterations to go through each subdirectory.

ok rory.

but looking at that im even more lost.

how would I tell it what to search for.

see what I was hoping for is I would run mort or whatever

a window pops up.
I type in the name of the folder I want it to find.

it does its thing.
and when It finds the folder from the various locations.
it would show me the path.
then say continue Y N

in case I wanted it to look for it on a different location.


basically I update files on 10 hard drives.
so I need to find the outdated file.
search these 10 drives.
delete that file.
and then add the updated version.

its a pain to search each hdd. so I thought hmmm mort.

again willing to pay
 

kazipmon

New member
Jan 18, 2017
1
0
@ voltagexdt

Not speaking English I do not know if I understood your request : o

If you want to do a manual search, you can use this little app =>nirsoft.net/utils/search_my_files."html"
 

RoryB

Inactive Recognized Developer
Sep 4, 2008
2,921
766
Lexington
ok rory.

but looking at that im even more lost.

how would I tell it what to search for.

see what I was hoping for is I would run mort or whatever

a window pops up.
I type in the name of the folder I want it to find.

it does its thing.
and when It finds the folder from the various locations.
it would show me the path.
then say continue Y N

in case I wanted it to look for it on a different location.


basically I update files on 10 hard drives.
so I need to find the outdated file.
search these 10 drives.
delete that file.
and then add the updated version.

its a pain to search each hdd. so I thought hmmm mort.

again willing to pay

If it the same file and path every drive, that might be easy enough. I think it would be a difficult series of arrays if you wanted to search the entire hard drive and all subfolders as though you do not know where it is. MortScript does not parse subfolders on its own that I recall.

You could still do what you describe with DOS Batch. I'm busy at the moment, but will try to pull something together if I get a chance.

Is there only one occurrence of the file in each drive?
 
Last edited:

voltagexdt

Member
Mar 23, 2017
5
0
If it the same file and path every drive, that might be easy enough. I think it would be a difficult series of arrays if you wanted to search the entire hard drive and all subfolders as though you do not know where it is. MortScript does not parse subfolders on its own that I recall.

You could still do what you describe with DOS Batch. I'm busy at the moment, but will try to pull something together if I get a chance.

Is there only one occurrence of the file in each drive?

ok
so basically theres only one occurance period.

so I need to find it from these 10 hard drives and delete it.

basically heres the scoop.

I run a movie server.
I have drive
E:\movies
F:\movies
G:\movies
H:\movies
I:\--MOVIES--
J:\movies
L:\movies
N:\movies

if say the movie aliens is on one of those drives.
but I found a blue ray version of it

I need to search all of those drives looking for Aliens
once located delete it.
so that I can then add Aliens to one of those hard drives.

thus stopping me from having duplicates.
 

RoryB

Inactive Recognized Developer
Sep 4, 2008
2,921
766
Lexington
ok
so basically theres only one occurance period.

so I need to find it from these 10 hard drives and delete it.

basically heres the scoop.

I run a movie server.
I have drive
E:\movies
F:\movies
G:\movies
H:\movies
I:\--MOVIES--
J:\movies
L:\movies
N:\movies

if say the movie aliens is on one of those drives.
but I found a blue ray version of it

I need to search all of those drives looking for Aliens
once located delete it.
so that I can then add Aliens to one of those hard drives.

thus stopping me from having duplicates.
So you are looking in a specific folder for a file. and doing the same for multiple specific folders that happen to be on different drives. That becomes easier for MortScript.
 

RoryB

Inactive Recognized Developer
Sep 4, 2008
2,921
766
Lexington
Try this out for rough draft. I am calling it Movie_Search.mscr

Code:
xPaths=array("E:\movies","F:\movies","G:\movies","H:\movies","I:\--MOVIES--","J:\movies","L:\movies","N:\movies")
xFilename=Input( "Enter movie name:", "File Search" ) & ".*"
# The .* I add to search any file type. 
foreach xPath in array(xPaths)
	foreach xfile in files (xPath & xFilename)
		xList=xList & xfile & " " & formattime("m/d/Y h:i:s a", FileModifyTime(xFile)) & "^NL^"
		# message( "Found " & xfile & " " & formattime("m/d/Y h:i:s a", FileModifyTime(xFile)))
	endforeach
endforeach
if (length(xList) > 0)
	message("Found: " & "^NL^" & xlist)
else
	message(xFilename & " not found")
endif
You can search with wild cards so alien* will result in alien, aliens, alien autopsy, etc. If you only search alien it will only find it.
 
Last edited:

voltagexdt

Member
Mar 23, 2017
5
0
Try this out for rough draft. I am calling it Movie_Search.mscr

Code:
xPaths=array("E:\movies","F:\movies","G:\movies","H:\movies","I:\--MOVIES--","J:\movies","L:\movies","N:\movies")
xFilename=Input( "Enter movie name:", "File Search" ) & ".*"
# The .* I add to search any file type. 
foreach xPath in array(xPaths)
	foreach xfile in files (xPath & xFilename)
		xList=xList & xfile & " " & formattime("m/d/Y h:i:s a", FileModifyTime(xFile)) & "^NL^"
		# message( "Found " & xfile & " " & formattime("m/d/Y h:i:s a", FileModifyTime(xFile)))
	endforeach
endforeach
if (length(xList) > 0)
	message("Found: " & "^NL^" & xlist)
else
	message(xFilename & " not found")
endif
You can search with wild cards so alien* will result in alien, aliens, alien autopsy, etc. If you only search alien it will only find it.

all results are the same

alien.* not found

and all I did was type in alien

this should be looking for folders. yes?

---------- Post added at 12:10 PM ---------- Previous post was at 12:07 PM ----------

all results are the same

alien.* not found

and all I did was type in alien

this should be looking for folders. yes?

I then removed your wild card and it still doesn't find the folder or file.. even if I type in the exact name
Repo Men (2010).mkv

---------- Post added at 12:21 PM ---------- Previous post was at 12:10 PM ----------

I also wont know the whole name of the folder

example
Fury (2014) is a folder
but I wont remember things like year or what not
so I just need to be able to search Fury.

---------- Post added at 12:26 PM ---------- Previous post was at 12:21 PM ----------

rory I actually found a program that does this thank you very much for your time. but im good to go
 

RoryB

Inactive Recognized Developer
Sep 4, 2008
2,921
766
Lexington
all results are the same

alien.* not found

and all I did was type in alien

this should be looking for folders. yes?

---------- Post added at 12:10 PM ---------- Previous post was at 12:07 PM ----------



I then removed your wild card and it still doesn't find the folder or file.. even if I type in the exact name
Repo Men (2010).mkv

---------- Post added at 12:21 PM ---------- Previous post was at 12:10 PM ----------

I also wont know the whole name of the folder

example
Fury (2014) is a folder
but I wont remember things like year or what not
so I just need to be able to search Fury.

---------- Post added at 12:26 PM ---------- Previous post was at 12:21 PM ----------

rory I actually found a program that does this thank you very much for your time. but im good to go

I'm glad you found something.

BTW you searched alien.* and the script already adds .* to the end of your entry so it searched for alien.*.* and your second try searched alien..*

Lastly I thought all the movies were in the movies folders and not sub-folders under movies. I set up searching for files and it sounds like it should have searched for folders under movies.

Code:
xPaths=array("E:\movies","F:\movies","G:\movies","H:\movies","I:\--MOVIES--","J:\movies","L:\movies","N:\movies")
xFilename="*" & Input( "Enter movie name:", "File Search" ) & "*"
# The * I add before and after to search any folder containing the search string. 
foreach xPath in array(xPaths)
	foreach xfolder in directories(xPath & xFilename)
		xList=xList & xfolder & "^NL^"
                # Cannot get time of folder
		# xList=xList & xfolder & " " & formattime("m/d/Y h:i:s a", FileModifyTime(xfolder )) & "^NL^"
	endforeach
endforeach
if (length(xList) > 0)
	message("Found: " & "^NL^" & xlist)
else
	message(xFilename & " not found")
endif
 

ghosty69

Member
Apr 29, 2008
11
0
i have 1 GPS device wince 6.0 800x480 I'm looking for a Schedule an Application to Run at a Specific Time. you can please help me?Thank you very much
 
Last edited:

reggiexp

Senior Member
so basicly navigation = windows ce? i mean i got a cheap 1 din radio with lcd touchscreen with back up camera wireless signal for 50€ eincar something and it runs 600mhz 265mb ram and windows ce and hasa 8gb sd card for navigation installedn anyway how can i get just windows (its been a long time but i once had a old phone of my parents with 200mhz 128mb with windows phone i had skype on it and a internet brower it was slow but cool :) even had a android mod on it that was EXTREM slow.
but what els can i do with a radio? seems like ceFFM is something that looks what im looking for.
btw hello old thread :)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    MortScripts to toggle settings

    Thread started today for MortScripts that can be used in CHTS. They started as a supplement to CHTS, but they can be used outside it too.

    So far I have radio band changer and sound profile changer scripts.

    MortScripts to toggle settings
    2
    D
    Deleted member 1890170
    fileMask="I*.jpg"
    startDir="\storage card\DCIM\100MEDIA"
    recurse=1

    @RenameFiles(startDir,fileMask,recurse)

    Sub RenameFiles(startDir,fileMask,recurse)
    Local()
    ForEach found In Files(startDir\fileMask)
    time=FormatTime("Ymd",FileModifyTime(found))
    name=FileBase(found)
    newFullFilePathName=FilePath(found)&"\"&SubStr(name,1,1,)&time&FileExt(found)
    Rename(found,newFullFilePathName)
    Sleep(1)
    EndForEach
    If(recurse)
    ForEach startDir2 In Directories(startDir\"*")
    @RenameFiles(startDir2,fileMask,recurse)
    EndForEach
    EndIf
    EndSub
    2
    D
    Deleted member 1890170
    Is anywhere a small graphic menu to get inspiration?
    By-look here: http://xdaforums.com/showthread.php?t=1368340
    1
    Hello, I've a problem.

    I would want to create a script to set the registry of system of mine pna C220.
    In this way to every reset this script runs and in automatic configures the registry for me and launch my software preferred (pollicino).

    This is the script:
    Code:
    Errorlevel ("off")
    
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power", "DisableGwesPowerOff", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\ActivityTimers\UserActivity", "Timeout", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\ActivityTimers\SystemActivity", "Timeout", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\State\UserIdle", "Default", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\State\SystemIdle", "Default", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "BattSystemIdle", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "BattUserIdle", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "ACSystemIdle", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "ACUserIdle", "0")
    #RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "ACSuspend", "0")
    #RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "BattSuspend", "0")
    #RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", "BatteryPoll", "0")
    
    #RegDeleteKey ("HKLM", "System\CurrentControlSet\Control\Power\ActivityTimers", True, True)
    #RegDeleteKey ("HKLM", "System\CurrentControlSet\Control\Power\State\SystemIdle", True, True)
    #RegDeleteKey ("HKLM", "System\CurrentControlSet\Control\Power\State\UserIdle", True, True)
    #RegDeleteKey ("HKLM", "System\CurrentControlSet\Control\Power\Timeouts", True, True)
    
    #SetVolume (255)
    
    Run("\Storage Card\Pollicino\Pollicino.exe")
    #Sleep (15000)
    Waitfor("Pollicino", 1000)
    while (WndActive ("Pollicino"))
    sleep(100)
    endwhile
    Kill("Pollicino.exe")
    
    
    Exit
    
    #*********************************************************************
    Is the script correct?

    Well, I have try to launch it but I have read this errore message:
    ".mscr and .mortrun extension registered.
    Please run any .mscr/.mortrun file ..."

    What's the problem? Is the Wrong script or other?

    I have set a button to launch this script:
    Code:
    ICONXPBUTTON
    X = 36
    Y = 71
    Command = \Storage Card\Pollicino.exe
    SizeNormal = 48
    SizePushed = 48
    Gray = no
    ScaleAlpha = 100
    IconNormal = \my flash disk\C220\skin\icons\Pollicino.ico
    Gray = no
    ScaleAlpha = 100
    IconPushed = \my flash disk\C220\skin\icons\Pollicino.ico

    In Storage Card I have:
    - Pollicino folder (inside Pollicino.exe)
    - Mosrtscript.exe (v.4.2)
    - Pollicino.exe (Mortscript.exe (v.4.2) renamed)
    - Pollicino.mscr
    - setup.dll
    - mortzip.dll

    Please help me

    Well, the script itself looks good, except you've commented out all your registry commands... take out the "#" from each line, if you actually want them to run.

    However, if you want to use an EXE file to launch a MortScript like you are trying to do, you don't rename MortScript.exe to Pollicino.exe, you rename Autorun.exe to Pollicino.exe. Also, you do not need setup.dll or mortzip.dll, those are if you are making a cab file.

    Although looking at it, you have the button launch \Storage Card\Pollicino.exe... is that supposed to be the one that launches the script? If so, the script needs to be in \Storage Card\Pollicino.mscr, and there should be \Storage Card\MortScript.exe there also (if it's not there, it looks for an installed version on your device). Better to have those in a folder, would think, and change the button launching to launch from the folder. I'm assuming that \Storage Card\Pollicino\Pollicino.exe is NOT supposed to be running a script, but some other program?

    Edit:
    It seems to me that this:
    Code:
    Run("\Storage Card\Pollicino\Pollicino.exe")
    #Sleep (15000)
    Waitfor("Pollicino", 1000)
    while (WndActive ("Pollicino"))
    sleep(100)
    endwhile
    Kill("Pollicino.exe")
    could most likely be changed to this:
    Code:
    RunWait("\Storage Card\Pollicino\Pollicino.exe")
    Assuming that the program closes itself, of course... Or do you want to have it killed when the window is no longer active?
    1
    I have done tinkered with PNA devices. Is the CE running on them the same as a PDA? I did a quick search and it seems to say the CE running on a PNA has limited access to CE functions. Maybe it does not allow wildcards as a result of this.