[General Questions and Answers] Angelusz:
Howdyho!

I'm using a mortscript to "control" an assortment of applications that together form a semi-proper landscape "fix" for the SE X1.

Currently, I'm having not one but two problems with it, of which one is a major one.

Lets start out small;

1) The script sometimes needs to refer to files. Is there any way I can use the %CE% codes to point it in the right direction? I need this to make it localization independent, without having to place it in the windows folder.

2) Measured with SKTools' CPU monitor, it turns out that my script uses ~15 to 20% CPU (From a 528mhz Qualcomm in the X1!!) power!

How the hell can this be? All I do is change some registry values and check for some variables on a 1sec loop.

As I'm very new to mortscript, perhaps someone can help me improve my code?

Thanks in advance!

# Created by Angelusz
# Special thanks to Chalid andKarlsson2k as it's based on their initial code.

# Note: Using this script will disable the hardware camera button.

RegWriteDWord("HKCU","Software\AnX1","IsLandscape",0)
RegWriteDWord("HKCU","Software\AnX1","IsScript",0)
RegWriteDWord("HKCU","Software\ANX1","IsManila",0)
RegWriteDWord("HKCU","Software\ANX1","IsAnX1",0)
RegWriteDWord("HKCU","Software\ANX1","IsCamera",0)
RegWriteDWord("HKCU","Software\ANX1","IsPrevented",0)

If(Screen("landscape"))
RegWriteDWord("HKCU","Software\ANX1","IsLandscape",1)
EndIf

While((ProcExists("manila.exe")=0) AND ((ProcExists("_mpman.exe")=0)))
Sleep(1000)
EndWhile

while((ProcExists("manila.exe")) OR (ProcExists("_mpman.exe")))
Sleep(1000)

If(ProcExists("SecondToday.exe")=0)
Run("Windows\AnX1\TF3DLandscape\Modules\SecondToday\SecondToday.exe")
Sleep(500)
EndIf

RegWriteDWord("HKCU","Software\ANX1","IsAnX1",0)
RegWriteDWord("HKCU","Software\ANX1","IsCamera",0)
RegWriteDWord("HKCU","Software\ANX1","IsManila",0)

If(ActiveWindow() eq "Start")
RegWriteDWord("HKCU","Software\ANX1","IsManila",1)
ElseIf(ActiveWindow() eq "AnX1Landscape")
RegWriteDWord("HKCU","Software\ANX1","IsAnX1",1)
ElseIf(ActiveWindow() eq "Camera")
RegWriteDWord("HKCU","Software\ANX1","IsCamera",1)
EndIf

RegWriteDWord("HKLM","System\GDI\Rotation","CamAppActive",0)
IsRotated=RegRead("HKLM","System\GDI\Rotation","SlideKey")
IsScript=RegRead("HKCU","Software\AnX1","IsScript")
IsLandscape=RegRead("HKCU","Software\AnX1","IsLandscape")
IsManila=RegRead("HKCU","Software\AnX1","IsManila")
IsAnX1=RegRead("HKCU","Software\AnX1","IsAnX1")
IsCamera=RegRead("HKCU","Software\AnX1","IsCamera")
IsPrevented=RegRead("HKCU","Software\AnX1","IsPrevented")

If((IsManila) OR (IsAnX1) OR (IsCamera))
RegWriteDWord("HKLM","System\GDI\Rotation","CamAppActive",1)
EndIf

If(((IsScript) OR (IsRotated)) OR ((IsScript) AND (IsRotated)))
If(IsManila)
If(IsPrevented)
RegWriteDWord("HKLM","System\GDI\Rotation","CamAppActive",1)
Else
If(IsLandscape=0)
RegWriteDWord("HKCU","Software\AnX1","IsLandscape",1)
Show("AnX1Landscape")
If(Screen("portrait")=1)
Rotate(270)
EndIf
Else
If(IsAnX1=0)
Show("AnX1Landscape")
EndIf
If(Screen("portrait")=1)
Rotate(270)
EndIf
EndIf
EndIf
Else
If(IsAnX1=0)
If(IsLandscape=0)
Minimize("AnX1Landscape")
Rotate(270)
RegWriteDWord("HKCU","Software\ANX1","IsLandscape",1)
EndIf
Else
If(Screen("portrait")=1)
Rotate(270)
EndIf
EndIf
EndIf
ElseIf((IsScript=0) AND (IsRotated=0))
If(IsAnX1=0)
Minimize("AnX1Landscape")
EndIf
If((Screen("landscape")=1) AND (IsCamera=0))
Rotate(0)
EndIf
RegWriteDWord("HKCU","Software\ANX1","IsLandscape",0)
EndIf
EndWhile

RegWriteDWord("HKLM","System\GDI\Rotation","CamAppActive",0)

While((ProcExists("manila.exe")=0) AND ((ProcExists("_mpman.exe")=0)))
Sleep(1000)
EndWhile

CallScript("\Windows\AnX1\TF3DLandscape\AnX1LS.mscr")