Из _//lexi.ucoz.ru/index/0-5_
На AutoIt
Code:
$StartDir = @ScriptDir
If Not FileExists($StartDir & "\opera.exe") Then
$StartDirArr = StringSplit(StringLower(RegRead("HKEY_CURRENT_USER\Software\Opera Software", "Last CommandLine v2")), "\opera.exe ", 1)
If IsArray($StartDirArr) Then $StartDir = $StartDirArr[1]
EndIf
If Not FileExists($StartDir & "\opera.exe") Then $StartDir = RegRead("HKEY_CURRENT_USER\Software\Opera Software", "Last Directory3")
If Not FileExists($StartDir & "\opera.exe") Then $StartDir = ""
$OperaDir = FileSelectFolder($MP, "", 0, $StartDir)
If @error Then Exit
Select
Case IniRead($OperaDir & "\OperaDef6.ini", "System", "Multi User", "-1") = 1
$VarOpDir = StringSplit($OperaDir, "\")
$NameDir = $VarOpDir[UBound($VarOpDir) - 1]
$VarMenu = @AppDataDir & "\opera\" & $NameDir & "\profile\menu\"
$VarOpera6 = @AppDataDir & "\opera\" & $NameDir & "\profile\opera6.ini"
Case IniRead($OperaDir & "\OperaDef6.ini", "System", "Multi User", "-1") = 0
$VarMenu = $OperaDir & "\profile\menu\"
$VarOpera6 = $OperaDir & "\profile\opera6.ini"
Case IniRead($OperaDir & "\OperaDef6.ini", "System", "Multi User", "-1") = -1
MsgBox(48, "Error", $Merror)
Exit
EndSelect
На Delphi
Code:
ODefIni := OpenIniFile(NameDir + '\operadef6.ini');
ODefIni.Mode := ifmRead;
ODefIni.Section := 'System';
MultiUser := ODefIni.ValueInteger('Multi User', 0);
ODefIni.Free;
if MultiUser = 0 then
begin
PathO6 := NameDir + '\profile\opera6.ini';
end
else
begin
K := RegKeyOpenRead(HKEY_CURRENT_USER, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders');
VarAppData := RegKeyGetStr(K, 'AppData');
RegKeyClose( K );
NameDir := CopyEnd(NameDir, DelimiterLast(NameDir, '\')+1);
PathO6 := VarAppData + '\opera\' + NameDir + '\profile\opera6.ini';
end;
if not FileExists(PathO6) then
begin
RunOpera := 1;
Exit;
end;
O6Ini := OpenIniFile(PathO6);
O6Ini.Mode := ifmRead;
O6Ini.Section := 'State';
RunOpera := O6Ini.ValueInteger('Run', 0);
O6Ini.Free;
if RunOpera = 0 then