smartee Posted June 12, 2011 Share Posted June 12, 2011 I'll say it againT'was a pleasure Feel free to post back whenever you run into difficulty Good luck and happy coding -smartee Link to comment Share on other sites More sharing options...
Meerecat Posted June 12, 2011 Author Share Posted June 12, 2011 To my warped sense of logic, the below says If a file is opened using CommandLine parameter then run the _decrypt function but if the file does not have a .crypt extension run the _encrypt function. If $CmdLine[0] > 0 Then _decrypt() If $CmdLine[0] <> '.crypt' Then _encrypt() Needless to say it doesn't work. No matter whether the file has .crypt extension or not it runs the _decrypt function. Lack of planning on your part does not constitute an emergency on my part.-The biggest idiot can ask questions the smartest man cannot answer. Link to comment Share on other sites More sharing options...
Mat Posted June 12, 2011 Share Posted June 12, 2011 To my warped sense of logic, the below says If a file is opened using CommandLine parameter then run the _decrypt function but if the file does not have a .crypt extension run the _encrypt function. If $CmdLine[0] > 0 Then _decrypt() If $CmdLine[0] <> '.crypt' Then _encrypt() Needless to say it doesn't work. No matter whether the file has .crypt extension or not it runs the _decrypt function. If $CmdLine[0] > 0 Then If StringRight($CmdLine[1], 6) <> '.crypt' Then _encrypt() Else _decrypt() EndIf EndIf AutoIt Project Listing Link to comment Share on other sites More sharing options...
Meerecat Posted June 12, 2011 Author Share Posted June 12, 2011 If $CmdLine[0] > 0 Then If StringRight($CmdLine[1], 6) <> '.crypt' Then _encrypt() Else _decrypt() EndIf EndIf Thanks. So is that saying 'Count 6 places to the right of the file name, if these match .crypt then _encrypt else _decrypt'? Lack of planning on your part does not constitute an emergency on my part.-The biggest idiot can ask questions the smartest man cannot answer. Link to comment Share on other sites More sharing options...
Mat Posted June 12, 2011 Share Posted June 12, 2011 Thanks. So is that saying 'Count 6 places to the right of the file name, if these match .crypt then _encrypt else _decrypt'? I'd say it was 'If file name ends with .crypt then encrypt else decrypt'. It's essentially a shortened version of this function I sometimes use: Func StringEndsWith($sString, $sWith) Return StringRight($sString, StringLen($sWith)) = $sWith EndFunc ;==>StringEndsWith In your example, _encrypt will always be run (you are using CmdLine[0]), and _decrypt will be run whenever a command line parameter is given. There would be times when both are run as well AutoIt Project Listing Link to comment Share on other sites More sharing options...
Meerecat Posted June 12, 2011 Author Share Posted June 12, 2011 I'd say it was 'If file name ends with .crypt then encrypt else decrypt'. It's essentially a shortened version of this function I sometimes use: Func StringEndsWith($sString, $sWith) Return StringRight($sString, StringLen($sWith)) = $sWith EndFunc ;==>StringEndsWith In your example, _encrypt will always be run (you are using CmdLine[0]), and _decrypt will be run whenever a command line parameter is given. There would be times when both are run as well That makes sense, thank you Lack of planning on your part does not constitute an emergency on my part.-The biggest idiot can ask questions the smartest man cannot answer. 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