CoolDude69 Posted July 21, 2016 Share Posted July 21, 2016 Hi Guys, I searched everywhere but I did not find what I was looking for. I have a DB with a column that has a condition, I want to be able to use that condition to create a shortcut. This is what I have : ID Name Script 1 IE FileExists('C:\Program Files\Internet Explorer\iexplore.exe') 2 Notes FileExists('C:\Program Files\IBM\Notes\notes.exe') If $rs.Fields.Item("Script").Value Then FileCreateShortcut(........) Else FileDelete("C:\Users\" & @UserName & "\Desktop\" & $ShortCut & ".lnk") EndIf Is this doable or not? From my understanding the If Rule only sees if there is a value in $rs.Fields.Item("Script").Value if yes then it creates the shortcut, I want to use the logic and not if the field is empty or not. Any help will be appreciated. Link to comment Share on other sites More sharing options...
SadBunny Posted July 21, 2016 Share Posted July 21, 2016 Try: If $rs.Fields.Item("Script").Value > "" Then It will compare the value to an empty string, and both <any non-zero number> and <any non-empty string> should compare to the empty string as larger, i.e. the expression X > "" returns True, i.e. (in this case) the shortcut would be created. Not sure if this is what you're looking for. Try it out Good luck. Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
CoolDude69 Posted July 21, 2016 Author Share Posted July 21, 2016 2 minutes ago, SadBunny said: Try: If $rs.Fields.Item("Script").Value > "" Then It will compare the value to an empty string, and both <any non-zero number> and <any non-empty string> should compare to the empty string as larger, i.e. the expression X > "" returns True, i.e. (in this case) the shortcut would be created. Not sure if this is what you're looking for. Try it out Good luck. Thanks for your reply, but it doesn't work as it does not validate if C:\Program Files\Internet Explorer\iexplore.exe exists or not. I would like the script to see if the file exists if it does create a shortcut. Link to comment Share on other sites More sharing options...
SadBunny Posted July 21, 2016 Share Posted July 21, 2016 You can use FileExists to check whether a file exists. By the way, please use code tags to post your code. Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
CoolDude69 Posted July 21, 2016 Author Share Posted July 21, 2016 (edited) But that's the problem, as I have some records that have Not FileExists and some with just FileExists My conditions are stored in DB as it's easier to maintain. The Script column is where the conditions are stored. I want to do it so I don't have to hard code and recompile every time that there is change to be made. This way any admin can add rules/conditions to DB without recompiling. I have 425 conditions/rules that are already in the DB. Edited July 21, 2016 by CoolDude69 Link to comment Share on other sites More sharing options...
SadBunny Posted July 21, 2016 Share Posted July 21, 2016 Oh, wait... Maybe I get it now Something like this perhaps? $x = 'MsgBox(64, "something", "hi there")' Execute($x) $y = 'Not FileExists("c:\windows\notepad.exe")' $result = Execute($y) MsgBox(0, 0, "The result of >> " & $y & " << is: " & $result) Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
CoolDude69 Posted July 21, 2016 Author Share Posted July 21, 2016 yes, that is what I was looking for.... Thank you very much Link to comment Share on other sites More sharing options...
SadBunny Posted July 21, 2016 Share Posted July 21, 2016 Cool, no problem Sorry, it took me a while to understand what your requirement was. Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now