View Single Post
  #189 (permalink)  
Old 03-25-2009, 09:32 PM
reigndropz's Avatar
reigndropz
Halfway to VIP Status
Offline
Location: VA
 
Join Date: Feb 2009
Posts: 550
Reputation: 805
reigndropz knows their stuffreigndropz knows their stuffreigndropz knows their stuffreigndropz knows their stuffreigndropz knows their stuffreigndropz knows their stuffreigndropz knows their stuff
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Re: Post Your SDconfig.txt, provisioning.xml, etc. Files Here!

Quote:
Originally Posted by FatFrosty View Post
I think I've done it so I'll go ahead and share. This solution requires Mortscript. It's the most lightweight program I've seen but one of the most powerful.

The problem I've seen others have is that all the shortcuts in the start menu are checked 'System Files'. This script goes through each of the Start Menu folders and removes all file attributes, then deletes it, one by one.

Here's the Mortscript Code:
Code:
# First delete the Start Menu's original contents
SrcDir = "\Storage Card\Cabs\Start Menu"
aDir = "\Windows\Start Menu"

ForEach bDir in directories ( aDir & "\*" )
If ( bdir ne "\Windows\Start Menu\Settings" )
  if ( ElementCount( DirContents( bDir, DC_FILES ) ) > 0 )
    ForEach tbdFile in files ( bDir & "\*" )
      SetFileAttribs( tbdFile , 0 , 0 , 0 )
      delete( tbdFile )
    EndForEach
  endif
  if ( ElementCount( DirContents( bDir, DC_DIRS ) ) > 0 )
    ForEach cDir in directories ( bDir & "\*")
      if ( ElementCount( DirContents( cDir, DC_FILES ) ) > 0 )
        ForEach tbdFile in files ( cDir & "\*" )
          SetFileAttribs( tbdFile , 0 , 0 , 0 )
          delete( tbdFile )
        EndForEach
      Endif
      if (ElementCount( DirContents( cDir, DC_DIRS ) ) > 0 )
        ForEach dDir in directories (cDir & "\*")
          if ( ElementCount( DirContents( dDir, DC_FILES ) ) > 0 )
            ForEach tbdFile in files ( dDir & "\*" )
              SetFileAttribs( tbdFile , 0 , 0 , 0 )
              delete( tbdFile )
            EndForEach
          Endif
          if ( ElementCount( DirContents( dDir, DC_DIRS ) ) > 0 )
            ForEach eDir in directories (dDir & "\*")
              if ( ElementCount( DirContents( eDir, DC_FILES ) ) > 0 )
                ForEach tbdFile in files ( eDir & "\*" )
                  SetFileAttribs( tbdFile , 0 , 0 , 0 )
                  delete( tbdFile )
                EndForEach
              Endif
              if ( ElementCount( DirContents( eDir, DC_DIRS ) ) > 0 )
                message ( "Some folders are too deep. May require manual deletion.", "Error - fDir" )
              Endif
              Deltree ( eDir )
            EndForEach
          Endif
          Deltree ( dDir )
        EndForEach
      EndIf
      DelTree  ( cDir )
    EndForEach
  endif
  Deltree( bDir )
Endif
EndForEach
ForEach tbdFile in files ( aDir & "\*" )
  SetFileAttribs( tbdFile , 0 , 0 , 0 )
  Delete( tbdFile )
EndForEach

# Then Recreate from a premade source

Foreach tbcDir in directories ( SrcDir & "\*" )
  Xcopy( SrcDir & "\*", aDir, 1, 1 )
Endforeach
Foreach tbcFile in files ( SrcDir & "\*" )
  Xcopy( SrcDir & "\*", aDir, 1, 1 )
Endforeach

# Lastly, delete the script copied to the Memory.
Delete ( "\CustomStartMenu.mscr" )
And here's how I implemented it inside SDConfig.txt:
Code:
CAB: \Storage Card\Cabs\MortScript-4.2-PPC.cab
CPY1:\Storage Card\Cabs\CustomStartMenu.txt
CPY2:\CustomStartMenu.mscr
EXEC:\CustomStartMenu.mscr
SET UP: Take note, it's stored as a txt file in my storage card to prevent any misfirings. The only things I believe that need to be changed from device to device is the directory of the cab in SDConfig, and the first variable in the script, 'SrcDir'. I wouldn't really mess with 'aDir', it can potentially be a Mortscript Virus.

My replacement Start Menu was already set up on my SD card. The easiest way I found was to organize the real start menu however I liked it, then just copied all of the contents over to my SD. I copied the Settings folder to my SD card (which is apparently empty) for backup, but the script is supposed to skip over the settings folder when deleting. It's partially because Mortscript doesn't want to automatically copy over the settings folder for some reason. But the reason could easily be poor coding on my part.

Limitations: The deletion portion of this script is limited to about five levels deep into the start menu. So if you originally have this folder -> \Start Menu\Programs\Utilities\Internet\IM\, it'll prolly throw up an error. I've never seen a rom that organized the start menu for you so I think 3 levels is overkill. I haven't seen and don't think there will be any limitation on how deep of folders you can copy.

If there are any problems I'll help as much as I can.
Man this is exactly what I want to do! I want to have my start menu erased and them my new shortcuts put into that start menu folder.....I just wish I could make sense out of what you posted!! I need help lol
Reply With Quote