Что нового

Как сделать в опциях параметр для путей к программам

Bayka

Новичок
Сообщения
6
Репутация
0
Код:
#include <GUIConstantsEx.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

Global $INI = @ScriptDir & '\Settings.ini'

If FileExists($INI) Then
    $Iccup = IniRead($INI, 'Option', 'Iccup', '')
    $Garena = IniRead($INI, 'Option', 'Garena', '')
    $PDL = IniRead($INI, 'Option', 'PDL', '')
    $Binds = IniRead($INI, 'Option', 'Бинды', '')
EndIf

GUICreate('Стартёр', 170,170, -1, -1, BitOr($WS_BORDER, $WS_POPUP, $WS_SYSMENU),$WS_EX_CONTROLPARENT)
$Closewindow = GUICtrlCreateButton ("",145,0,20,20)

$tab=GUICtrlCreateTab (-2,0,176,150)
$tab0=GUICtrlCreateTabitem ("Warcraft")
GUICtrlCreateLabel ("- Iccup",60,35,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- Garena",60,65,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- PDL",60,95,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- Бинды",60,125,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("Быстрый запуск",41,153,90,20,-1,$GUI_WS_EX_PARENTDRAG)
$start1 = GUICtrlCreateButton ("Запуск",5,30,50)
$start2 = GUICtrlCreateButton ("Запуск",5,60,50)
$start3 = GUICtrlCreateButton ("Запуск",5,90,50)
$start4 = GUICtrlCreateButton ("Запуск",5,120,50)

$tab1=GUICtrlCreateTabitem ("Медиа")
GUICtrlCreateLabel ("Быстрый запуск",41,153,90,20,-1,$GUI_WS_EX_PARENTDRAG)

$tab2=GUICtrlCreateTabitem ("Опции")
GUICtrlCreateLabel ("- Iccup",60,35,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- Garena",60,65,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- PDL",60,95,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- Бинды",60,125,50,20,-1,$GUI_WS_EX_PARENTDRAG)
$start9 = GUICtrlCreateButton ("Путь",5,30,50)
$start10 = GUICtrlCreateButton ("Путь",5,60,50)
$start11 = GUICtrlCreateButton ("Путь",5,90,50)
$start12 = GUICtrlCreateButton ("Путь",5,120,50)
GUICtrlCreateLabel ("Настройка путей",38,153,90,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateTabitem ("") ; закрываем табы

GUISetState()
While 1
   $msg = GUIGetMsg()
    Switch  $msg
        Case $start1
            Run($Iccup)
        Case $start2
            Run($Garena)
        Case $start3
            Run($PDL)
        Case $start4
            Run($Binds)
        Case $Closewindow
            ExitLoop
        Case $start9
            $File1 = FileOpenDialog('', '', 'All files (*.*)')
            if @error then ContinueLoop
            IniWrite(@ScriptDir & '\Settings.ini', 'Option', 'Iccup', $File1)
        Case $start10
            $File1 = FileOpenDialog('', '', 'All files (*.*)')
            if @error then ContinueLoop
            IniWrite(@ScriptDir & '\Settings.ini', 'Option', 'Garena', $File1)
        Case $start11
            $File1 = FileOpenDialog('', '', 'All files (*.*)')
            if @error then ContinueLoop
            IniWrite(@ScriptDir & '\Settings.ini', 'Option', 'PDL', $File1)
        Case $start12
            $File1 = FileOpenDialog('', '', 'All files (*.*)')
            if @error then ContinueLoop
            IniWrite(@ScriptDir & '\Settings.ini', 'Option', 'Бинды', $File1)
    EndSwitch
Wend


Всем спасибо! Использывал способ из 2 поста!
 

Zaramot

I ♥ AutoIt
Сообщения
1,160
Репутация
660
Можно через INI файл:
Код:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

Global $INI = @ScriptDir & '\Settings.ini'

If FileExists($INI) Then
	$Iccup = IniRead($INI, 'Option', 'Iccup', '')
	$Garena = IniRead($INI, 'Option', 'Garena', '')
	$PDL = IniRead($INI, 'Option', 'PDL', '')
	$Binds = IniRead($INI, 'Option', 'Бинды', '')
EndIf

GUICreate('Стартёр', 170,170, -1, -1, BitOr($WS_BORDER, $WS_POPUP, $WS_SYSMENU),$WS_EX_CONTROLPARENT)
$Closewindow = GUICtrlCreateButton ("",145,0,20,20)

$tab=GUICtrlCreateTab (-2,0,176,150)
$tab0=GUICtrlCreateTabitem ("Warcraft")
GUICtrlCreateLabel ("- Iccup",60,35,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- Garena",60,65,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- PDL",60,95,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- Бинды",60,125,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("Быстрый запуск",41,153,90,20,-1,$GUI_WS_EX_PARENTDRAG)
$start1 = GUICtrlCreateButton ("Запуск",5,30,50)
$start2 = GUICtrlCreateButton ("Запуск",5,60,50)
$start3 = GUICtrlCreateButton ("Запуск",5,90,50)
$start4 = GUICtrlCreateButton ("Запуск",5,120,50)

$tab1=GUICtrlCreateTabitem ("Медиа")
GUICtrlCreateLabel ("Быстрый запуск",41,153,90,20,-1,$GUI_WS_EX_PARENTDRAG)

$tab2=GUICtrlCreateTabitem ("Опции")
GUICtrlCreateLabel ("- Iccup",60,35,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- Garena",60,65,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- PDL",60,95,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- Бинды",60,125,50,20,-1,$GUI_WS_EX_PARENTDRAG)
$start9 = GUICtrlCreateButton ("Путь",5,30,50)
$start10 = GUICtrlCreateButton ("Путь",5,60,50)
$start11 = GUICtrlCreateButton ("Путь",5,90,50)
$start12 = GUICtrlCreateButton ("Путь",5,120,50)
GUICtrlCreateLabel ("Настройка путей",38,153,90,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateTabitem ("") ; закрываем табы

GUISetState()
While 1
   $msg = GUIGetMsg()
    Switch  $msg
        Case $start1
            Run($Iccup)
        Case $start2
            Run($Garena)
        Case $start3
            Run($PDL)
        Case $start4
            Run($Binds)
        Case $Closewindow
            ExitLoop
		Case $start9
			$File1 = FileOpenDialog('', '', 'All files (*.*)')
			if @error then ContinueLoop
			IniWrite(@ScriptDir & '\Settings.ini', 'Option', 'Iccup', $File1)
		Case $start10
			$File1 = FileOpenDialog('', '', 'All files (*.*)')
			if @error then ContinueLoop
			IniWrite(@ScriptDir & '\Settings.ini', 'Option', 'Garena', $File1)
		Case $start11
			$File1 = FileOpenDialog('', '', 'All files (*.*)')
			if @error then ContinueLoop
			IniWrite(@ScriptDir & '\Settings.ini', 'Option', 'PDL', $File1)
		Case $start12
			$File1 = FileOpenDialog('', '', 'All files (*.*)')
			if @error then ContinueLoop
			IniWrite(@ScriptDir & '\Settings.ini', 'Option', 'Бинды', $File1)
    EndSwitch
Wend
 

Zaramot

I ♥ AutoIt
Сообщения
1,160
Репутация
660
Александр,
можно вместо ини файла использовать сам файл программы. пример здесь Re: [Новая функция] Запись в саму себя
Для новичка это сложно...

Bayka,
Можно через реестр сохранять пути:
Код:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

GUICreate('Стартёр', 170,170, -1, -1, BitOr($WS_BORDER, $WS_POPUP, $WS_SYSMENU),$WS_EX_CONTROLPARENT)
$Closewindow = GUICtrlCreateButton ("",145,0,20,20)

$tab=GUICtrlCreateTab (-2,0,176,150)
$tab0=GUICtrlCreateTabitem ("Warcraft")
GUICtrlCreateLabel ("- Iccup",60,35,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- Garena",60,65,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- PDL",60,95,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- Бинды",60,125,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("Быстрый запуск",41,153,90,20,-1,$GUI_WS_EX_PARENTDRAG)
$start1 = GUICtrlCreateButton ("Запуск",5,30,50)
$start2 = GUICtrlCreateButton ("Запуск",5,60,50)
$start3 = GUICtrlCreateButton ("Запуск",5,90,50)
$start4 = GUICtrlCreateButton ("Запуск",5,120,50)

$tab1=GUICtrlCreateTabitem ("Медиа")
GUICtrlCreateLabel ("Быстрый запуск",41,153,90,20,-1,$GUI_WS_EX_PARENTDRAG)

$tab2=GUICtrlCreateTabitem ("Опции")
GUICtrlCreateLabel ("- Iccup",60,35,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- Garena",60,65,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- PDL",60,95,50,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateLabel ("- Бинды",60,125,50,20,-1,$GUI_WS_EX_PARENTDRAG)
$start9 = GUICtrlCreateButton ("Путь",5,30,50)
$start10 = GUICtrlCreateButton ("Путь",5,60,50)
$start11 = GUICtrlCreateButton ("Путь",5,90,50)
$start12 = GUICtrlCreateButton ("Путь",5,120,50)
GUICtrlCreateLabel ("Настройка путей",38,153,90,20,-1,$GUI_WS_EX_PARENTDRAG)
GUICtrlCreateTabitem ("") ; закрываем табы

GUISetState()
While 1
   $msg = GUIGetMsg()
    Switch  $msg
		Case $start1
			$Iccup = RegRead('HKEY_CURRENT_USER\Software\Starter', 'Iccup')
            ShellExecute($Iccup)
        Case $start2
			$Garena = RegRead('HKEY_CURRENT_USER\Software\Starter', 'Garena')
            ShellExecute($Garena)
        Case $start3
			$PDL = RegRead('HKEY_CURRENT_USER\Software\Starter', 'PDL')
            ShellExecute($PDL)
        Case $start4
			$Binds = RegRead('HKEY_CURRENT_USER\Software\Starter', 'Бинды')
            ShellExecute($Binds)
        Case $Closewindow
            ExitLoop
		Case $start9
			$File1 = FileOpenDialog('', '', 'All files (*.*)')
			if @error then ContinueLoop
			RegWrite('HKEY_CURRENT_USER\Software\Starter', 'Iccup', 'REG_SZ', $File1)
		Case $start10
			$File1 = FileOpenDialog('', '', 'All files (*.*)')
			if @error then ContinueLoop
			RegWrite('HKEY_CURRENT_USER\Software\Starter', 'Garena', 'REG_SZ', $File1)
		Case $start11
			$File1 = FileOpenDialog('', '', 'All files (*.*)')
			if @error then ContinueLoop
			RegWrite('HKEY_CURRENT_USER\Software\Starter', 'PDL', 'REG_SZ', $File1)
		Case $start12
			$File1 = FileOpenDialog('', '', 'All files (*.*)')
			if @error then ContinueLoop
			RegWrite('HKEY_CURRENT_USER\Software\Starter', 'Бинды', 'REG_SZ', $File1)
    EndSwitch
Wend
 
Автор
B

Bayka

Новичок
Сообщения
6
Репутация
0
Мне нужен самый работоспособный и действенный вариант, не важно что он сложный, всё ровно учится всему!
 

joiner

Модератор
Локальный модератор
Сообщения
3,556
Репутация
628
Bayka
оба примера работоспособны в одинаковой степени - то есть в наилучшей для понимания и достижения цели. :smile:
 
Верх