1

Topic: Question about IF, First time using Litestep

I'm trying to make a custom shell for restricting which programs users have access to.  I've got Litestep working, and I'm working on customizing the Popup menu.  I want to know, with the IF statement, is there a way to have it check if a file exists, so I could give the users the option of opening that program?

Something like:

IF exists C:\windows\notepad.exe
*Popup "NotePad"     "c:\windows\notepad.exe"
EndIf

2

Re: Question about IF, First time using Litestep

Why not just use the users start menu to determine what is installed and they have access to?

3

Re: Question about IF, First time using Litestep

And no...there is no IF EXIST function in LS IF functions.  You might be able to do it with a LUA script, but I don't think you want to.

4

Re: Question about IF, First time using Litestep

Is there a good website that I could look at to learn how to do that?  I've looked at http://lsdocs.shellfront.org, but it seems a little vague.

5

Re: Question about IF, First time using Litestep

You can make use of "fileexists('file')" from xstatsclass in
Conjunction of "!Parseevars" xlabel bang to set some stuff.
Read the docs (xLabel and xStatsClass, and maybe xTextedit).
Learning the basics, i can help you to make it done.

6

Re: Question about IF, First time using Litestep

So something along the lines of:

in personal.rc:

*label NotepadLabel
NotepadLabeltext "[if(fileExists('c:\windows\notepad.exe')]Yes[else]No[endif]


in popup.rc:

!ParseEvars If NotepadLabeltext = "Yes"
*Popup "NotePad"     "c:\windows\notepad.exe"
EndIf

7

Re: Question about IF, First time using Litestep

climbermat wrote:

So something along the lines of:

in personal.rc:

*label NotepadLabel
NotepadLabeltext "[if(fileExists('c:\windows\notepad.exe')]Yes[else]No[endif]


in popup.rc:

!ParseEvars If NotepadLabeltext = "Yes"
*Popup "NotePad"     "c:\windows\notepad.exe"
EndIf

While I think of a more informative response, no.

8 (edited by alur 2012-08-27 14:25:25 pm)

Re: Question about IF, First time using Litestep

So, I think this is an useful feature and decided to implement it in my LiteStep fork over at https://github.com/alur/litestep

using this: http://dl.dropbox.com/u/51925/LiteStep/ … %202012.7z build you can do something along these lines:

If fileExists("C:\\windows\\notepad.exe")
    *Popup "NotePad"     "c:\windows\notepad.exe"
EndIf

Note the double \\ used in the path; they are not necessary if you use a variable. e.g. this will do the exact same thing:

SomeVariable C:\windows\notepad.exe
If fileExists(SomeVariable)
    *Popup "NotePad"     "c:\windows\notepad.exe"
EndIf

VC 2012 runtimes: http://www.microsoft.com/en-us/download … x?id=30679

9

Re: Question about IF, First time using Litestep

alur, its like you forgot to remove visual studio dependences. well, this is my try (more hard), but add this feature on core is better.

requirements:
NetLoadModules-2.5.0
xLabel-4.3
xStatsClass-1.1.5
xTextedit-0.6

add this lines to themevars.rc:

APP01ISHERE "0"

APP01PATH "C:\WINDOWS\SYSTEM32\NOTEPAD.EXE"
APP01NAME "NOTEPAD"

IF APP01ISHERE = "1"
APP01ENTRY '"$APP01NAME$" !EXECUTE ["$APP$01PATH"]'
ELSE
APP01ENTRY '!INFO "APP01NAME"'
ENDIF

add this lines to theme.rc below the module load section:

NetLoadModuleOnLoad    !Parseevars !execute [!SetEvar APP01ISHERE %[ifeval(fileExists('C:\windows\system32\notepad.exe'))]1[else]0[endif]%][!xTextSaveEvar @$ConfigDir$themevars.rc@ @APP01ISHERE@ @%[ifeval(fileExists('C:\windows\system32\notepad.exe'))]1[else]0[endif]%@]

and finally, your popup definition (save it on $ConfigDir$DynamicPopup.rc)

*mypopup !new !Mypopup
 *mypopup .icon=".none" $app01entry$
*mypopup ~new

to load your popup execute:

!execute [!PopupLoadCFG "*Mypopup" "$ConfigDir$DynamicPopup.rc"][!Mypopup]

10 (edited by alur 2012-08-22 10:40:25 am)

Re: Question about IF, First time using Litestep

Actually, all of the 0.25.0 alphas have depended on some version of the visual c++ runtimes, I just happened to compile it with 2012. Unfortunately though, I don't think the 2012 runtime libraries are available yet (aside for some sketchy torrent on tpb) so I'll go ahead and recompile without the library dependency.

Edit: recompiled and updated the link in the post above.

11

Re: Question about IF, First time using Litestep

Diamond - I don't think your solution will work because the Popup will always have $app01entry$ defined, even if it is blank. 

I still think a better solution is to create a folder with the LNK files in it that you are interested in having a popup and using that folder to define your popup rather than the Programs menu.

12

Re: Question about IF, First time using Litestep

DiamondXplosion wrote:

and finally, your popup definition (save it on $ConfigDir$DynamicPopup.rc)

*mypopup !new !Mypopup
 *mypopup .icon=".none" $app01entry$
*mypopup ~new

Sorry, my fault. this is the correct code:

*mypopup !new !Mypopup
 *mypopup .icon=".none" "%#app01entry%#"
*mypopup ~new

It will catch onthefly !SetEvar effects and $app01entry$ when !recycle or reboot with !xTextSaveEvar
but, to set it onthefly, need some xLabel with textbox to make it easily and freely to config.

well, climbermat, can you explain with details what you need and why? do you want delete some files for a user and other no? there are some reason for my efforts?

13

Re: Question about IF, First time using Litestep

Sorry it took me a minute to get back to you, I was doing some testing. 

I tried out alur's fork, and it seems to work very well for my purposes.  I've been working on using that today since time is a bit of an issue.

I also want to try out DiamondXplosion's solution once I get a minute, because I like modifying the code myself and learning what works and doesn't work so that I can tweak it myself in the future. 

I really appreciate you all helping me, since I just barely started using Litestep and am still figuring out how it all works, but it seems immensely useful.

14 (edited by DiamondXplosion 2012-08-22 21:02:29 pm)

Re: Question about IF, First time using Litestep

any way, i think your question was answered. Welcome to LiteStep and good luck making you theme.
we'll be here if you have more doubts.

15

Re: Question about IF, First time using Litestep

Alur, using your fork, I'm getting an error "Error: could not load module.  This is likely a case of a missing C Run-Time Library or other dependency."  for the taskbar3-0.306_alpha-3.dll and xlabel-3.4.5.dll.  Is there a certain version of the Visual C++ runtime I need to install?

16

Re: Question about IF, First time using Litestep

i'm getting the same error for all my modules, in other words, i can't use my theme with your fork.

17 (edited by alur 2012-08-24 08:35:29 am)

Re: Question about IF, First time using Litestep

Sorry about that, I'll look into it.

Out of curiosity though, why are you using xLabel 3.4.5? the latest version is 4.3.

Edit: not quite sure what the cause for this is, I'll just compile it with 2010 when I get home on Sunday.

18

Re: Question about IF, First time using Litestep

Where can I go to check for updated modules?  The only website I was able to find was http://shellfront.org, and the xLabel there was only up to 2.2.1

19

Re: Question about IF, First time using Litestep

climbermat wrote:

Where can I go to check for updated modules?  The only website I was able to find was http://shellfront.org, and the xLabel there was only up to 2.2.1

http://www.shellfront.org/modules/

20

Re: Question about IF, First time using Litestep

Scroll down to find xlabel-4.3.0

21

Re: Question about IF, First time using Litestep

I updated to taskbar3-0.306_alpha-4.dll and xlabel-4.3.dll.  When using the normal Litestep.exe and lsapi.dll, the shell boots up fine, but when using alur's version, I still get the message about these two modules, even though I installed the Microsoft Visual C++ 2010 and 2012 runtimes.  The FileExists functionality works great, but now I have no taskbar...

22

Re: Question about IF, First time using Litestep

Here is a version compiled with vs 2010, let me know if it works. Unfortunately I can load xLabel and taskbar3 just fine on my machine, so I'm not sure what's causing the problem (or if this fixes it).

https://dl.dropbox.com/u/51925/LiteStep … %202012.7z

23

Re: Question about IF, First time using Litestep

They still won't load on my computer.  I don't know what I could be missing on here that you might have on yours.

24 (edited by alur 2012-11-14 00:46:54 am)

Re: Question about IF, First time using Litestep

I finally got around to installing visual studio 2008. This build did work for the-golem: http://alurcard2.net/LiteStep-0.25.0-2012-10-02VC8.7z

Sorry about the long delay.


Mirror:
http://dl.dropbox.com/u/51925/LiteStep/ … 0-02VC8.7z

25

Re: Question about IF, First time using Litestep

alur wrote:

I finally got around to installing visual studio 2008. This build did work for the-golem: http://alurcard2.net/LiteStep-0.25.0-2012-10-02VC8.7z

Sorry about the long delay.

Yeah, I was testing out a build of alur's fork (but compiled by someone else) and was having the same issues. Like he said, simply compiling the two DLLs in VC08 fixed the loading problems.

Strange indeed