MilesAhead Posted March 11, 2008 Share Posted March 11, 2008 I really like to use the Opera Wand for filling in forms buying stuff online. I was kind of disappointed that after all this time they still leave the [Personal Info] section in opera6.ini (that contains the stuff you typed into Wand) in clear text!! I wasn't able to find any free substitute so I scripted a kludge that at least lets you have your opera6.ini [Personal Info] section encrypted when Opera isn't running. The idea is to fill in the Wand info and close opera so that opera6.ini has the info stored in the clear. Set the variables in EncryptWand and RunOperaWand scripts so that they match. Run EncryptWand to encrypt the .ini file section. Now RunOperaWand can be used whenever you want to launch Opera and use the Wand Form Fill Tool. RunOperaWand reads the encrypted section, decrypts it and writes it back. Then it launches Opera and waits. On Opera close it encrypts the [Personal Info] section again. All done using _StringEncrypt() IniReadSection() and IniWriteSection(). Like I said, a kludge. EncryptWand #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: MilesAhead EncryptWand - Encrypts the [Personal Info] section of opera6.ini 1)Run Opera and fill in the Wand Personal Info then close Opera 2)point the $operaIniFileName variable to point to the opera6.ini with the information you just filled in. Change "PassWord" below to what you want to use as your password. 3)Run the script Now you can use the RunOperaWand.au3 script to run Opera after setting its variables to match those in this script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <File.au3> #include <String.au3> ;set this to point to Opera .ini file $operaIniFileName="C:\Program Files\Opera926\profile\opera6.ini" _Set_Wand_Info(1,$operaIniFileName,"PassWord") Func _Set_Wand_Info($encrypt,$operaIniFile,$passWord) $s="" Dim $sectionInfo = IniReadSection($operaIniFile,"Personal Info") For $i = 1 to $sectionInfo[0][0] $s = _StringEncrypt($encrypt,$sectionInfo[$i][1],$passWord) $sectionInfo[$i][1] = $s Next IniWriteSection($operaIniFileName,"Personal Info",$sectionInfo) EndFunc RunOperaWand expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: MilesAhead RunOperaWand: RunOperaWand reads the opera6.ini file [Personal Info] section that was encrypted with EncryptWand.au3 script. It decrypts it, and writes it back to opera6.ini. It then runs Opera so you can use the Wand Form Fill Tool. Once you exit Opera, it reencrypts the [Personal Info] section so that your Personal Info isn't just sitting on disk in opera6.ini in clear text. 1)Set the variables $operaIniFileName to point to the opera6.ini file Opera is using. 2)Set $operaExeName variable to point to the corresponding opera.exe 3)Set $pw to the password you used in EncryptWand.au3 script. 4)Run this script to execute Opera. Suggestion: Use AutoIt3 "Compile Script" once you have set and tested all your variables to compile this script to an .exe file. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <File.au3> #include <String.au3> $operaIniFileName="C:\Program Files\Opera926\profile\opera6.ini" $operaExeFileName="C:\Program Files\Opera926\opera.exe" $pw="PassWord" If Not _Set_Wand_Info(0,$operaIniFileName,$pw) Then MsgBox(0,"RunOperaWand","Decrypting Opera Ini File Failed") Exit EndIf $val = ShellExecuteWait($operaExeFileName) If Not _Set_Wand_Info(1,$operaIniFileName,$pw) Then MsgBox(0,"RunOperaWand","Encrypting Opera Ini File Failed") EndIf Func _Set_Wand_Info($encrypt,$operaIniFile,$passWord) $s="" Dim $sectionInfo = IniReadSection($operaIniFile,"Personal Info") For $i = 1 to $sectionInfo[0][0] $s = _StringEncrypt($encrypt,$sectionInfo[$i][1],$passWord) $sectionInfo[$i][1] = $s Next return IniWriteSection($operaIniFileName,"Personal Info",$sectionInfo) EndFunc My Freeware Page Link to comment Share on other sites More sharing options...
MilesAhead Posted March 14, 2008 Author Share Posted March 14, 2008 (edited) I broke the .ini file section encryption bit out into something more generally useful: _CryptIniSection() expandcollapse popup#include-once #include <File.au3> #include <String.au3> #cs ---------------------------------------------------------------------------- Function: _CryptIniSection($encrypt,$iniFile,$sectionName,$passWord,$testKey="",$testVal="") Author: MilesAhead Action: Uses _StringEncrypt to encrypt or decrypt a section of an .ini file Params: $encrypt: 0 for decrypt non-zero for encrypt $iniFile: .ini file name $sectionName: name of .ini file Section $passWord: password used with _StringEncrypt $testKey: key to detect if already encrypted : optional $testVal: val to detect if already encrypted : optional Returns: True if Section is already in desired state of encryption False on error otherwise returns the result of IniWriteSection #ce ---------------------------------------------------------------------------- Func _CryptIniSection($encrypt, $iniFile, $sectionName, $passWord, $testKey = "", $testVal = "") Local $s = "" Local $sectionInfo = IniReadSection($iniFile, $sectionName) If @error Then Return False If $testKey <> "" And $testVal <> "" Then Select Case $encrypt = 0 If _IsIniSectionUnencrypted($sectionInfo, $testKey, $testVal) Then Return True EndIf Case Else $encrypt = 1 If Not _IsIniSectionUnencrypted($sectionInfo, $testKey, $testVal) Then Return True EndIf EndSelect EndIf For $i = 1 To $sectionInfo[0][0] $s = _StringEncrypt($encrypt, $sectionInfo[$i][1], $passWord) If @error Then Return False $sectionInfo[$i][1] = $s Next Return IniWriteSection($iniFile, $sectionName, $sectionInfo) EndFunc ;==>_CryptIniSection #cs ---------------------------------------------------------------------------- Function: _IsIniSectionUnencrypted($sectionArray,$key,$val) Author: MilesAhead Action: Scans a two-dimensional array that was filled with IniReadSection for a key matching $key with a value matching $val. The assumption being if "in the clear" key and value match those expected then the .ini file Section is not encrypted Params: $sectionArray: 2 dimensional array filled by IniReadSection $key: the key to search for $val: the value to match Returns: True if a match is found False otherwise #ce ---------------------------------------------------------------------------- Func _IsIniSectionUnencrypted($sectionArray, $key, $val) For $x = 1 To $sectionArray[0][0] If $sectionArray[$x][0] == $key And $sectionArray[$x][1] == $val Then Return True EndIf Next Return False EndFunc ;==>_IsIniSectionUnencrypted Edited March 16, 2008 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
MrCreatoR Posted March 14, 2008 Share Posted March 14, 2008 Hi,Nice idea.For the "files path get" part you can use Opera Library. Like this:#include-once #include <File.au3> #include <String.au3> #include "Opera_Library.au3" .... $Opera6Ini_Path = _OperaGetProfileDir() & "\opera6.ini" $OperaExe_Path = _OperaGetDir() & "\opera.exe" .... Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MilesAhead Posted March 14, 2008 Author Share Posted March 14, 2008 Thanks for the modification. Saves hard-wiring or using param in a shortcut. Very cool. My Freeware Page Link to comment Share on other sites More sharing options...
Mahesh_Shahane Posted December 13, 2016 Share Posted December 13, 2016 On 3/14/2008 at 9:05 PM, MrCreatoR said: Hi, Nice idea. For the "files path get" part you can use Opera Library. Like this: #include-once #include <File.au3> #include <String.au3> #include "Opera_Library.au3" .... $Opera6Ini_Path = _OperaGetProfileDir() & "\opera6.ini" $OperaExe_Path = _OperaGetDir() & "\opera.exe" .... Hi @milesahead can you please share opera_library.au3 . I am automating opera in autoit this will be great help Thanks in Advance 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