Форум программистов, компьютерный форум, киберфорум
PowerShell
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 5.00/6: Рейтинг темы: голосов - 6, средняя оценка - 5.00
1 / 1 / 0
Регистрация: 11.02.2019
Сообщений: 136

как переделать эту программу в форму Windows или вставить этот код PowerShell в форму Windows?

26.11.2019, 11:39. Показов 1341. Ответов 17
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Как нам переделать программу, чтобы открыть XML-файл в форме Windows и прочитать значение процента после слова цены в файле MIK_RT.xml и можно было изменить это значение процента из окна в форме Windows и сохранить файл с новым значением, нажав кнопку ОК?

как переделать эту программу в форму Windows или вставить этот код PowerShell в форму Windows? файл необходимо сохранить в кодировке utf8

PowerShell
1
2
3
4
5
6
$outputFile = 'MIK_Neva.xml'
write-output $outputFile
[xml](Get-Content "$outputFile") | ForEach-Object {$_.SelectNodes(' //FieldCostOptions/IncreaseCost') |ForEach-Object {$_.GetAttribute("Percent")}; write-output $node.percent }
$inputpercent = Read-Host -Prompt 'percent'
 
[xml](Get-Content "$outputFile") | ForEach-Object {$_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object {$_.SetAttribute("Percent", $inputpercent)};  $_.Save('Output.xml')}

файл для изменения MIK_Neva.xml

XML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?xml version="1.0" encoding="utf-8"?>
<PriceConfiguration Name="MIK_Neva" Version="1">
  <Description>
  </Description>
  <AuthorID>s0011373519</AuthorID>
  <LastEditedBy>s0011373519</LastEditedBy>
  <LastUpdate>14.11.2019 12:56:45</LastUpdate>
  <File Type="XLS" Engine="0">
    <FilesMask>E:\FTP\PRICE_FORCEAUTO_MIK\NevaAvtocom.xlsx</FilesMask>
    <IncludeFiles>
    </IncludeFiles>
    <ExcludeFiles>
    </ExcludeFiles>
    <Macro OnStart="" />
    <XLSoptions>
      <Password>
      </Password>
      <MergeXLSsheets>1</MergeXLSsheets>
    </XLSoptions>
    <CSVoptions>
      <RowsSeparator>13-10</RowsSeparator>
      <ColumnsSeparator>59</ColumnsSeparator>
      <AddHeaderRow>0</AddHeaderRow>
      <UseBrackets>0</UseBrackets>
      <Encoding>windows-1251</Encoding>
    </CSVoptions>
    <ReplaceTable Name="Price Codes" IsEmpty="False">
      <Replacement Find="{@КодПрайса}" ReplaceWith="" />
      <Replacement Find="{@ИмяФайлаДляПрайса}" ReplaceWith="" />
    </ReplaceTable>
  </File>
  <Sheets>
    <SheetConfiguration index="1">
      <Name>Обработчик листа</Name>
      <Description>
      </Description>
      <SheetSelectMode>1</SheetSelectMode>
      <SheetName>остатки Микадо</SheetName>
      <SheetIndex>1</SheetIndex>
      <ReplaceTable Name="Price Sheet Codes" IsEmpty="False">
        <Replacement Find="{@КодЛиста}" ReplaceWith="" />
        <Replacement Find="{@ИмяФайлаДляЛиста}" ReplaceWith="" />
      </ReplaceTable>
      <PriceFields>
        <Field index="1" Enable="1">
          <Name>Артикул</Name>
          <SheetColumn>1</SheetColumn>
          <UseCellText>1</UseCellText>
          <Required>1</Required>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
          <ReplaceTableName>Артикул (EMEX_Neva)</ReplaceTableName>
        </Field>
        <Field index="2" Enable="1">
          <Name>Наименование</Name>
          <SheetColumn>2</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
          <ReplaceTableName>Наименование (FA)</ReplaceTableName>
        </Field>
        <Field index="3" Enable="1">
          <Name>Производитель</Name>
          <SheetColumn>5</SheetColumn>
          <Required>1</Required>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="4" Enable="1">
          <Name>Наличие</Name>
          <SheetColumn>3</SheetColumn>
          <Required>1</Required>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="5" Enable="1">
          <Name>Цена</Name>
          <SheetColumn>4</SheetColumn>
          <Required>1</Required>
          <ValueMode>0</ValueMode>
          <KeepValue>1</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="1" Version="1">
            <Function CodeName="CompareNumbers" Enabled="1" param1="3000" param2="1000000" />
          </FieldFunctions>
          <FieldConditions Enable="1" Version="1" />
          <FieldCostOptions Enabled="1" Version="1">
            <IncreaseCost Enabled="1" Percent="-5" />
          </FieldCostOptions>
        </Field>
        <Field index="6" Enable="1">
          <Name>ЦенаЗакупа</Name>
          <SheetColumn>4</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="7" Enable="1">
          <Name>ПР</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>1</ValueMode>
          <Formula>NevaAvtocom</Formula>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="8">
          <Name>Срок_ZZAP</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="9">
          <Name>КодСтраны</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="10">
          <Name>Страна</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="11">
          <Name>ГТД</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="12">
          <Name>ИНН_Поставщика</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="13">
          <Name>КПП_Поставщика</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="14">
          <Name>НомерН</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="15">
          <Name>ДатаН</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="16">
          <Name>НомерСчета</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="17">
          <Name>ДатаСчета</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="18">
          <Name>НамерСФ</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
        <Field index="19">
          <Name>ДатаСФ</Name>
          <SheetColumn>1</SheetColumn>
          <ValueMode>0</ValueMode>
          <KeepValue>0</KeepValue>
          <KeepLevel>0</KeepLevel>
          <FieldFunctions Enabled="0" Version="1" />
          <FieldConditions Enable="0" Version="1" />
        </Field>
      </PriceFields>
      <FirstRow>2</FirstRow>
      <LastRowColumn>1</LastRowColumn>
    </SheetConfiguration>
  </Sheets>
</PriceConfiguration>
0
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
26.11.2019, 11:39
Ответы с готовыми решениями:

Как вставить файл в эту форму?
Привет всем! У меня такая проблема сделал форму для оправки всё работает, но проблема в том что файл не отправляется что делать? Вот...

Как заполнить форму MS Word из WPF или Windows Forms?
как заполнить документ msWord через форму? Документ строится к примеру таким образом: Фамилия (данные из textBox1) Имя (данные из...

Как сделать форму в Excel в которую нужно вывести данные из Sheet-а, а затем пустить эту форму на принтер?
Как сделать форму в Excel в которую нужно вывести данные из Sheet-а, а затем пустить эту форму на принтер. Я новичок в этом деле. Спасибо!

17
 Аватар для alhaos
1929 / 545 / 154
Регистрация: 20.02.2019
Сообщений: 2,663
Записей в блоге: 65
26.11.2019, 14:48
windows forms вещь классная, но на работу с ней мне приходится тратить столько времени... что я предпочитаю обойтись без графического интерфейса.

PowerShell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
param(
    [string]$workPath = "C:\tmp"
)
Get-ChildItem $workPath -Filter "*.xml" -file | ForEach-Object {
    Write-Host "File   : $($_.Name)"
    ([xml](Get-Content $_.FullName)).SelectNodes('//FieldCostOptions/IncreaseCost') | ForEach-Object{
        Write-Host "Persent: $($_.GetAttribute("Percent"))"
        $inputPercent = Read-Host -Prompt 'input persent or type exit to exit'
        if ($inputPercent -eq 'exit') {
            exit 0
        }
        else {
            $_.SetAttribute("Percent", $inputPercent)
        }
    }
    $doc.Save(("$($_.FullName).copy"))
}
0
22 / 18 / 4
Регистрация: 28.07.2015
Сообщений: 167
26.11.2019, 15:04
PowerShell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: 3d1db409-f60c-4656-aabf-bc9339f94951
# Source File: 33333.psf
#------------------------------------------------------------------------
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
2gQAAB+LCAAAAAAABABllMeK42oQRvcGv0MzW8Eo2ErQ06AsWTla0k62fgUrJys8/e3pu7lwv1VR
RRW1OJxPBzy7Nxh3PpmTj+9iKrv2z6/Lb/TX1/n08fFpjmVetkktljUwkgZ8Xf7mdz9ln/D/Zj8b
Yjc2X55/faCHJD8KhWE4k+eYf8MyfHDX0QWrGPtdZ4NJbFRSWlXEMexNYNRCLQJk9UTDROZpwoRF
bKhEQ81OH/rziXiIFiJM7yxiAUYSAkgsExs4V1puqDoYvqtHsA5bxgGBuHLeMt3Oa2HQBNS5ttNu
7CbbuvfEnlB+k84nqH6HEsmO4UHnGWtnHOYF3argLCDIQ5rvtKpRop+3HafliGXngrGXbKpoD7Mj
RoxPYjzLDYAOaNpv51PaJgYYK24L+lTBr6i9OMcspd2m1SsRca/WiIt24XSoHqvba0yu2KqHwtFy
7cJGavzy0+LiQOzthrLI+TQjnP5sDFKJhwbqO8OWplQR1cHrAHFlWg+OGBUPe/FaO14dkeug3UtE
vNXQwThI8YTcrsfGjSW1NlPOp1GXn3hfUQ9sk70NlATwqVna8yUFntt7KwFtGN3KmJmtbpYvcHHA
XEhaDwgbqL52HOQ9UbngNFU+yOfToQmCM3Doix32LiFyoU778amrYqNYw/FWytLug95LppomGLzo
xmhQU8HVi/uzgoW6aQ/tSk+JzBeLcT7pboWx93ZkWe6x0Pj6lxzsmxyUbQO+c/JwIfypNCOjyh6V
gooZUjhjb2u95o6H0tee5Jc1Lyv+qHxfu/hAiGU6clYnRWGzg6rO64lrdjds31/7eSfbSdfHK3hf
aq0LZ2RsqIYkDkIk+/FCBM193Rs+eeD6FTufci/Hmm2/GpwVx/riLskzx3NL4pWYp/QQAGUTff1F
TfndY9PdsdeRLjnLRHNXS4FbgiJ9lvUQk0Pgnk+8J6lNVoJaJ82CQcypwHPB27clrYPj2Am8vA4B
gmBrd3ju0NSOj6qXuDJeamqk0QbR6AUejSdNhK71TW8OAQ9vAdqEgifN6jYClLaoiXMBQ8AyX6G0
B1yrxIWlegitleyBTZuuQzKei13yEDLSIBJMXx+w8XxiIejhzLLicMOtdkFfGyRZiq7avlbXr+q3
j9QovatpSIHrSNVGYkCoyr6b46XryDHLiyAIMXGQlCZ8/4ZvUZlKd2fjPHpfA0kR2Ea4znzMv6om
wokDgzDcgA15CJ3Qgd4zqhqNk01QHtrUcyw1M7g8wXDJctM7n946wf54hPnz5xP+0cuPaJhpAs2j
LsH0AX93PuH/uuzrH2LTY+XaBAAA#>
#endregion
 
<#
    .NOTES
    --------------------------------------------------------------------------------
     Code generated by:  SAPIEN Technologies, Inc., PowerShell Studio 2019 v5.6.159
     Generated on:       26.11.2019 13:55
     Generated by:       
     Organization:       
    --------------------------------------------------------------------------------
    .DESCRIPTION
        GUI script generated by PowerShell Studio 2019
#>
 
 
#----------------------------------------------
#region Application Functions
#----------------------------------------------
 
#endregion Application Functions
 
#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function Show-33333_psf {
 
    #----------------------------------------------
    #region Import the Assemblies
    #----------------------------------------------
    [void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
    [void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
    #endregion Import Assemblies
 
    #----------------------------------------------
    #region Generated Form Objects
    #----------------------------------------------
    [System.Windows.Forms.Application]::EnableVisualStyles()
    $form1 = New-Object 'System.Windows.Forms.Form'
    $labelПутьКФайлу = New-Object 'System.Windows.Forms.Label'
    $buttonBrowse = New-Object 'System.Windows.Forms.Button'
    $textboxFile = New-Object 'System.Windows.Forms.TextBox'
    $labelPercent = New-Object 'System.Windows.Forms.Label'
    $TEXT_PERCENT = New-Object 'System.Windows.Forms.TextBox'
    $Read = New-Object 'System.Windows.Forms.Button'
    $Save = New-Object 'System.Windows.Forms.Button'
    $openfiledialog1 = New-Object 'System.Windows.Forms.OpenFileDialog'
    $InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
    #endregion Generated Form Objects
 
    #----------------------------------------------
    # User Generated Script
    #----------------------------------------------
    
    $form1_Load = {
        #TODO: Initialize Form Controls here
        
    } #end form1_Load
    
    $buttonBrowse_Click = {
        
        IF ($openfiledialog1.ShowDialog() -eq 'OK')
        {
            $textboxFile.Text = $openfiledialog1.FileName
        }
    }
    
    $buttonBrowse_Click2 = {
        
        IF ($openfiledialog1.ShowDialog() -eq 'OK')
        {
            $textboxFile.Text = $openfiledialog1.FileName
        }
    }
    
    $Read_Click = {
        #TODO: Place custom script here
        $TEXT_PERCENT.Text = [xml](Get-Content $textboxFile.Text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
    } #end Read_Click
    
    $Save_Click = {
        #TODO: Place custom script here
         $new_value = $TEXT_PERCENT.Text
        [xml](Get-Content $textboxFile.Text -Encoding UTF8)  | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $new_value) }; $_.Save('D:\Output1.xml') }
    } #end Save_Click
    
    # --End User Generated Script--
    #----------------------------------------------
    #region Generated Events
    #----------------------------------------------
    
    $Form_StateCorrection_Load=
    {
        #Correct the initial state of the form to prevent the .Net maximized form issue
        $form1.WindowState = $InitialFormWindowState
    }
    
    $Form_Cleanup_FormClosed=
    {
        #Remove all event handlers from the controls
        try
        {
            $buttonBrowse.remove_Click($buttonBrowse_Click2)
            $Read.remove_Click($Read_Click)
            $Save.remove_Click($Save_Click)
            $form1.remove_Load($form1_Load)
            $form1.remove_Load($Form_StateCorrection_Load)
            $form1.remove_FormClosed($Form_Cleanup_FormClosed)
        }
        catch { Out-Null <# Prevent PSScriptAnalyzer warning #> }
    }
    #endregion Generated Events
 
    #----------------------------------------------
    #region Generated Form Code
    #----------------------------------------------
    $form1.SuspendLayout()
    #
    # form1
    #
    $form1.Controls.Add($labelПутьКФайлу)
    $form1.Controls.Add($buttonBrowse)
    $form1.Controls.Add($textboxFile)
    $form1.Controls.Add($labelPercent)
    $form1.Controls.Add($TEXT_PERCENT)
    $form1.Controls.Add($Read)
    $form1.Controls.Add($Save)
    $form1.AutoScaleDimensions = '6, 13'
    $form1.AutoScaleMode = 'Font'
    $form1.ClientSize = '394, 137'
    $form1.Name = 'form1'
    $form1.Text = 'Form'
    $form1.add_Load($form1_Load)
    #
    # labelПутьКФайлу
    #
    $labelПутьКФайлу.AutoSize = $True
    $labelПутьКФайлу.Location = '186, 9'
    $labelПутьКФайлу.Name = 'labelПутьКФайлу'
    $labelПутьКФайлу.Size = '75, 17'
    $labelПутьКФайлу.TabIndex = 4
    $labelПутьКФайлу.Text = 'Путь к файлу'
    $labelПутьКФайлу.UseCompatibleTextRendering = $True
    #
    # buttonBrowse
    #
    $buttonBrowse.Location = '343, 26'
    $buttonBrowse.Name = 'buttonBrowse'
    $buttonBrowse.Size = '30, 23'
    $buttonBrowse.TabIndex = 1
    $buttonBrowse.Text = '...'
    $buttonBrowse.UseCompatibleTextRendering = $True
    $buttonBrowse.UseVisualStyleBackColor = $True
    $buttonBrowse.add_Click($buttonBrowse_Click2)
    #
    # textboxFile
    #
    $textboxFile.AutoCompleteMode = 'SuggestAppend'
    $textboxFile.AutoCompleteSource = 'FileSystem'
    $textboxFile.Location = '109, 29'
    $textboxFile.Name = 'textboxFile'
    $textboxFile.Size = '228, 20'
    $textboxFile.TabIndex = 0
    #
    # labelPercent
    #
    $labelPercent.AutoSize = $True
    $labelPercent.Location = '19, 9'
    $labelPercent.Name = 'labelPercent'
    $labelPercent.Size = '43, 17'
    $labelPercent.TabIndex = 3
    $labelPercent.Text = 'Percent'
    $labelPercent.UseCompatibleTextRendering = $True
    #
    # TEXT_PERCENT
    #
    $TEXT_PERCENT.Location = '3, 29'
    $TEXT_PERCENT.Name = 'TEXT_PERCENT'
    $TEXT_PERCENT.Size = '75, 20'
    $TEXT_PERCENT.TabIndex = 2
    #
    # Read
    #
    $Read.Location = '3, 87'
    $Read.Name = 'Read'
    $Read.Size = '75, 23'
    $Read.TabIndex = 1
    $Read.Text = 'Read'
    $Read.UseCompatibleTextRendering = $True
    $Read.UseVisualStyleBackColor = $True
    $Read.add_Click($Read_Click)
    #
    # Save
    #
    $Save.Location = '101, 87'
    $Save.Name = 'Save'
    $Save.Size = '75, 23'
    $Save.TabIndex = 0
    $Save.Text = 'Save'
    $Save.UseCompatibleTextRendering = $True
    $Save.UseVisualStyleBackColor = $True
    $Save.add_Click($Save_Click)
    #
    # openfiledialog1
    #
    $openfiledialog1.DefaultExt = 'txt'
    $openfiledialog1.Filter = 'Text File (.txt)|*.txt|All Files|*.*'
    $openfiledialog1.ShowHelp = $True
    $form1.ResumeLayout()
    #endregion Generated Form Code
 
    #----------------------------------------------
 
    #Save the initial state of the form
    $InitialFormWindowState = $form1.WindowState
    #Init the OnLoad event to correct the initial state of the form
    $form1.add_Load($Form_StateCorrection_Load)
    #Clean up the control events
    $form1.add_FormClosed($Form_Cleanup_FormClosed)
    #Show the Form
    return $form1.ShowDialog()
 
} #End Function
 
#Call the form
Show-33333_psf | Out-Null
Это грубая основа. У меня работает, дальше допиливай под себя
0
1 / 1 / 0
Регистрация: 11.02.2019
Сообщений: 136
27.11.2019, 10:22  [ТС]
спасибо MGarry как сделать что-бы файл для загрузки MIK_Neva.xml уже был загружен при запуске программы и как добавить второй прайс MIK_RT.xml вторым полем загружался при загрузки и значение percent обеих файлов можно будет изменять и сохранять при нажатии на одну кнопку сохраниить


MIK_RT.xml прилагаю

<?xml version="1.0" encoding="utf-8"?>
<PriceConfiguration Name="MIK_RT" Version="1"><Description></Description><AuthorID>s0011373519</AuthorID><LastEditedBy>s0011373519</LastEditedBy><LastUpdate>14.11.2019 12:56:27</LastUpdate><File Type="XLS" Engine="0"><FilesMask>E:\FTP\PRICE_FORCE AUTO_MIK\RT.xls</FilesMask><IncludeFiles></IncludeFiles><ExcludeFiles></ExcludeFiles><Macro OnStart=""/><XLSoptions><Password></Password><MergeXLSsheets>1</MergeXLSsheets></XLSoptions><CSVoptions><RowsSeparator>13-10</RowsSeparator><ColumnsSeparator>59</ColumnsSeparator><AddHeaderRow>0</AddHeaderRow><UseBrackets>0</UseBrackets><Encoding>windows-1251</Encoding></CSVoptions><ReplaceTable Name="Price Codes" IsEmpty="False"><Replacement Find="{@КодПрайса}" ReplaceWith=""/><Replacement Find="{@ИмяФайлаДляПрайса}" ReplaceWith=""/></ReplaceTable></File><Sheets><SheetConfiguration index="1"><Name>Обработчик листа</Name><Description></Description><SheetSelectMode>1</SheetSelectMode><SheetName>Итого_Наценка _Остатков</SheetName><SheetIndex>1</SheetIndex><ReplaceTable Name="Price Sheet Codes" IsEmpty="False"><Replacement Find="{@КодЛиста}" ReplaceWith=""/><Replacement Find="{@ИмяФайлаДляЛиста}" ReplaceWith=""/></ReplaceTable><PriceFields><Field index="1" Enable="1"><Name>Артикул</Name><SheetColumn>2</SheetColumn><UseCellText>1</UseCellText><Required>1</Required><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/><ReplaceTableName>Артикул (EXIST_RT)</ReplaceTableName></Field><Field index="2" Enable="1"><Name>Наименование</Name><SheetColumn>3</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/><ReplaceTableName>Наименование (FA)</ReplaceTableName></Field><Field index="3" Enable="1"><Name>Производитель</Name><SheetColumn>1</SheetColumn><Required>1</Required><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/><ReplaceTableName>Производитель (FA_RT)</ReplaceTableName></Field><Field index="4" Enable="1"><Name>Наличие</Name><SheetColumn>4</SheetColumn><Required>1</Required><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="1" Version="1"><Function CodeName="Replace" Enabled="1" param1="&gt;" param2=""/></FieldFunctions><FieldConditions Enable="0" Version="1"/></Field><Field index="5" Enable="1"><Name>Цена</Name><SheetColumn>5</SheetColumn><Required>1</Required><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="1" Version="1"><Function CodeName="CompareNumbers" Enabled="1" param1="2499" param2="1000000"/></FieldFunctions><FieldConditions Enable="0" Version="1"/><FieldCostOptions Enabled="1" Version="1"><IncreaseCost Enabled="1" Percent="-5"/></FieldCostOptions></Field><Field index="6" Enable="1"><Name>ЦенаЗакупа</Name><SheetColumn>5</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="7" Enable="1"><Name>ПР</Name><SheetColumn>1</SheetColumn><ValueMode>1</ValueMode><Formula>RT</Formula><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="8"><Name>Срок_ZZAP</Name><SheetColumn>1</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="9"><Name>КодСтраны</Name><SheetColumn>1</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="10"><Name>Страна</Name><SheetColumn>1</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="11"><Name>ГТД</Name><SheetColumn>1</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="12"><Name>ИНН_Поставщика</Name><SheetColumn>1</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="13"><Name>КПП_Поставщика</Name><SheetColumn>1</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="14"><Name>НомерН</Name><SheetColumn>1</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="15"><Name>ДатаН</Name><SheetColumn>1</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="16"><Name>НомерСчета</Name><SheetColumn>1</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="17"><Name>ДатаСчета</Name><SheetColumn>1</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="18"><Name>НамерСФ</Name><SheetColumn>1</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field><Field index="19"><Name>ДатаСФ</Name><SheetColumn>1</SheetColumn><ValueMode>0</ValueMode><KeepValue>0</KeepValue><KeepLevel>0</KeepLevel><FieldFunctions Enabled="0" Version="1"/><FieldConditions Enable="0" Version="1"/></Field></PriceFields><FirstRow>4</FirstRow><LastRowColumn>1</LastRowColumn></SheetConfiguration></Sheets></PriceConfiguration>
0
22 / 18 / 4
Регистрация: 28.07.2015
Сообщений: 167
27.11.2019, 13:58
$form1_Load = {
#TODO: Initialize Form Controls here

} #end form1_Load

Вот тут выполняются действия при запуске программы.
Остальные вопросы непонятны. Напишите по пунктам.
0
1 / 1 / 0
Регистрация: 11.02.2019
Сообщений: 136
28.11.2019, 10:29  [ТС]
где почитать как работает remove_Click(
и где найти как этот код работает с разборов примеров
0
505 / 158 / 49
Регистрация: 27.02.2016
Сообщений: 820
29.11.2019, 06:16
сергей124244, http://www.codeproject.com/Art... -Windows-F
0
1 / 1 / 0
Регистрация: 11.02.2019
Сообщений: 136
29.11.2019, 13:04  [ТС]
как переделать этот код что-бы этот код работал из любой папки [xml](Get-Content $textboxFile.Text -Encoding UTF8) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $new_value) }; $_.Save('D:\Output1.xml') }


Добавлено через 1 минуту
почему не работает данный код ? необходимо запускать программу из любого места на диске


$file1 = New-Object 'System.Windows.Forms.TextBox'

$file1.text='MIK_RT.xml'

[xml](Get-Content $file1.text ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $new_value1) } $_.Save('$file1.text') }
0
22 / 18 / 4
Регистрация: 28.07.2015
Сообщений: 167
29.11.2019, 14:35
Цитата Сообщение от сергей124244 Посмотреть сообщение
необходимо запускать программу из любого места на диске
Указывайте любой путь и все. Вместо $textboxFile.Text указываете полный путь до нужной папки.
Цитата Сообщение от сергей124244 Посмотреть сообщение
как переделать этот код что-бы этот код работал из любой папки
вот это совсем не понятно
0
1 / 1 / 0
Регистрация: 11.02.2019
Сообщений: 136
29.11.2019, 14:43  [ТС]
этот код работает [xml](Get-Content 'c:\program\MIK_Autokontinent.xml' ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $newpercent1) }; $_.Save('c:\program\MIK_Autokontinent.xm l') }

вот этот код не работает

[xml](Get-Content $file2.text ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $newpercent2) }; $_.Save('$file2.text') }

вопрос как заменить и чем оператор save() который не работает без указания path
0
22 / 18 / 4
Регистрация: 28.07.2015
Сообщений: 167
29.11.2019, 14:46
$A = $file2.text
$_.Save($A)

Попробуйте вот так
0
1 / 1 / 0
Регистрация: 11.02.2019
Сообщений: 136
29.11.2019, 15:00  [ТС]
не работает
можно ли заменить save() на другой оператор
0
22 / 18 / 4
Регистрация: 28.07.2015
Сообщений: 167
29.11.2019, 15:03
Насколько я знаю нет.

Проверьте что у вас лежит в $file2.text Точно нужный путь и точно это тиа string?
0
1 / 1 / 0
Регистрация: 11.02.2019
Сообщений: 136
29.11.2019, 15:06  [ТС]
$file2 = New-Object 'System.Windows.Forms.TextBox'
$file2.text='MIK_AutoPremium.xml'
0
22 / 18 / 4
Регистрация: 28.07.2015
Сообщений: 167
29.11.2019, 15:08
Цитата Сообщение от сергей124244 Посмотреть сообщение
$file2.text='MIK_AutoPremium.xml'
Это ни разу не путь к папки. Должно быть что то типа "C:\temp\'MIK_AutoPremium.xml'"
0
1 / 1 / 0
Регистрация: 11.02.2019
Сообщений: 136
29.11.2019, 15:34  [ТС]
не явно возможно ли задание пути к файлу?
0
22 / 18 / 4
Регистрация: 28.07.2015
Сообщений: 167
29.11.2019, 15:37
Get-ChildItem <RootDirectory> $file2.text |select -ExpandProperty fullname
0
1 / 1 / 0
Регистрация: 11.02.2019
Сообщений: 136
29.11.2019, 16:08  [ТС]
как это вставить Get-ChildItem <RootDirectory> $file2.text |select -ExpandProperty fullname

в пример ниже


function chpecent {
$form = New-Object 'System.Windows.Forms.Form'
$MaskedTextBox = New-Object System.Windows.Forms.MaskedTextBox
$MaskedTextBox.PasswordChar = '*'
$MaskedTextBox.Top = 200
$MaskedTextBox.Left = 200
$form.Controls.Add($MaskedTextBox)
out
#System.Windows.Forms.MaskedTextBox
$file1 = New-Object 'System.Windows.Forms.TextBox'
$file2 = New-Object 'System.Windows.Forms.TextBox'
$file3 = New-Object 'System.Windows.Forms.TextBox'
$file4 = New-Object 'System.Windows.Forms.TextBox'
$file5 = New-Object 'System.Windows.Forms.TextBox'
$file6 = New-Object 'System.Windows.Forms.TextBox'
$file7 = New-Object 'System.Windows.Forms.TextBox'
$file8 = New-Object 'System.Windows.Forms.TextBox'
$file9 = New-Object 'System.Windows.Forms.TextBox'
$file10 = New-Object 'System.Windows.Forms.TextBox'

$textnamef1 = New-Object 'System.Windows.Forms.Label'
$textnamef2 = New-Object 'System.Windows.Forms.Label'
$textnamef3 = New-Object 'System.Windows.Forms.Label'
$textnamef4 = New-Object 'System.Windows.Forms.Label'
$textnamef5 = New-Object 'System.Windows.Forms.Label'
$textnamef6 = New-Object 'System.Windows.Forms.Label'
$textnamef7 = New-Object 'System.Windows.Forms.Label'
$textnamef8 = New-Object 'System.Windows.Forms.Label'
$textnamef9 = New-Object 'System.Windows.Forms.Label'
$textnamef10 = New-Object 'System.Windows.Forms.Label'
$textPercent = New-Object 'System.Windows.Forms.Label'
$inputpecentw1 = New-Object 'System.Windows.Forms.TextBox'
$inputpecentw2 = New-Object 'System.Windows.Forms.TextBox'
$inputpecentw3 = New-Object 'System.Windows.Forms.TextBox'
$inputpecentw4 = New-Object 'System.Windows.Forms.TextBox'
$inputpecentw5 = New-Object 'System.Windows.Forms.TextBox'
$inputpecentw6 = New-Object 'System.Windows.Forms.TextBox'
$inputpecentw7 = New-Object 'System.Windows.Forms.TextBox'
$inputpecentw8 = New-Object 'System.Windows.Forms.TextBox'
$inputpecentw9 = New-Object 'System.Windows.Forms.TextBox'
$inputpecentw10 = New-Object 'System.Windows.Forms.TextBox'
$Read = New-Object 'System.Windows.Forms.Button'
$Save = New-Object 'System.Windows.Forms.Button'
$form_Load = {
#выполняется при запуске
$file1.text='MIK_Autokontinent.xml'
$file2.text='MIK_AutoPremium.xml'
$file3.text='MIK_AutoProdixSPb.xml'
$file4.text='MIK_Iveco.xml'
$file5.text='MIK_Moto.xml'
$file6.text='MIK_Neva.xml'
$file7.text='MIK_RT.xml'
$file8.text='MIK_SibTrading.xml'
$file9.text='MIK_Storage.xml'
$file10.text='MIK_TecMar.xml'


$inputpecentw1.Text = [xml](Get-Content $file1.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw2.Text = [xml](Get-Content $file2.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw3.Text = [xml](Get-Content $file3.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw4.Text = [xml](Get-Content $file4.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw5.Text = [xml](Get-Content $file5.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw6.Text = [xml](Get-Content $file6.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw7.Text = [xml](Get-Content $file7.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw8.Text = [xml](Get-Content $file8.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw9.Text = [xml](Get-Content $file9.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw10.Text = [xml](Get-Content $file10.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
}
$Read_Click = {
#выполняется при нажатии на кнопку прочитать

$inputpecentw1.Text = [xml](Get-Content $file1.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw2.Text = [xml](Get-Content $file2.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw3.Text = [xml](Get-Content $file3.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw4.Text = [xml](Get-Content $file4.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw5.Text = [xml](Get-Content $file5.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw6.Text = [xml](Get-Content $file6.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw7.Text = [xml](Get-Content $file7.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw8.Text = [xml](Get-Content $file8.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw9.Text = [xml](Get-Content $file9.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
$inputpecentw10.Text = [xml](Get-Content $file10.text) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.GetAttribute("Percent") } } | Out-String
}
$Save_Click = {
#выполняется при нажатии на кнопку сохранить
$newpercent1 = $inputpecentw1.Text
$newpercent2 = $inputpecentw2.Text
$newpercent3 = $inputpecentw3.Text
$newpercent4 = $inputpecentw4.Text
$newpercent5 = $inputpecentw5.Text
$newpercent6 = $inputpecentw6.Text
$newpercent7 = $inputpecentw7.Text
$newpercent8 = $inputpecentw8.Text
$newpercent9 = $inputpecentw9.Text
$newpercent10 = $inputpecentw10.Text
$A = $file2.text

[xml](Get-Content 'c:\program\MIK_Autokontinent.xml' ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $newpercent1) }; $_.Save('c:\program\MIK_Autokontinent.xm l') }
[xml](Get-Content $A ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $newpercent2) }; $_.Save('$A') }
[xml](Get-Content $file3.text ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $newpercent3) }; $_.Save('$file3.text') }
[xml](Get-Content $file4.text ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $newpercent4) }; $_.Save('$file4.text') }
[xml](Get-Content $file5.text ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $newpercent5) }; $_.Save('$file5.text') }
[xml](Get-Content $file6.text ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $newpercent6) }; $_.Save('$file6.text') }
[xml](Get-Content $file7.text ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $newpercent7) }; $_.Save('$file7.text') }
[xml](Get-Content $file8.text ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $newpercent8) }; $_.Save('$file8.text') }
[xml](Get-Content $file9.text ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $newpercent9) }; $_.Save('$file9.text') }
[xml](Get-Content $file10.text ) | ForEach-Object { $_.SelectNodes(' //FieldCostOptions/IncreaseCost') | ForEach-Object { $_.SetAttribute("Percent", $newpercent10) }; $_.Save('$file10.text') }
}
$form.Controls.Add($textnamef1)
$form.Controls.Add($textnamef2)
$form.Controls.Add($textnamef3)
$form.Controls.Add($textnamef4)
$form.Controls.Add($textnamef5)
$form.Controls.Add($textnamef6)
$form.Controls.Add($textnamef7)
$form.Controls.Add($textnamef8)
$form.Controls.Add($textnamef9)
$form.Controls.Add($textnamef10)
$form.Controls.Add($textPercent)

$form.Controls.Add($inputpecentw1)
$form.Controls.Add($inputpecentw2)
$form.Controls.Add($inputpecentw3)
$form.Controls.Add($inputpecentw4)
$form.Controls.Add($inputpecentw5)
$form.Controls.Add($inputpecentw6)
$form.Controls.Add($inputpecentw7)
$form.Controls.Add($inputpecentw8)
$form.Controls.Add($inputpecentw9)
$form.Controls.Add($inputpecentw10)

$form.Controls.Add($Read)
$form.Controls.Add($Save)
$form.ClientSize = '800, 800'
$form.Text = 'проценты'
$form.add_Load($form_Load)

$textnamef1.AutoSize = $True
$textnamef1.Location = '80, 40'
$textnamef1.Text = 'MIK_Autokontinent.xml'

$textnamef2.AutoSize = $True
$textnamef2.Location = '80, 80'
$textnamef2.Text = 'MIK_AutoPremium.xml'

$textnamef3.AutoSize = $True
$textnamef3.Location = '80, 120'
$textnamef3.Text = 'MIK_AutoProdixSPb.xml'

$textnamef4.AutoSize = $True
$textnamef4.Location = '80, 160'
$textnamef4.Text = 'MIK_Iveco.xml'

$textnamef5.AutoSize = $True
$textnamef5.Location = '80, 200'
$textnamef5.Text = 'MIK_Moto.xml'

$textnamef6.AutoSize = $True
$textnamef6.Location = '80, 240'
$textnamef6.Text = 'MIK_Neva.xml'

$textnamef7.AutoSize = $True
$textnamef7.Location = '80, 280'
$textnamef7.Text = 'MIK_RT.xml'

$textnamef8.AutoSize = $True
$textnamef8.Location = '80, 320'
$textnamef8.Text = 'MIK_SibTrading.xml'

$textnamef9.AutoSize = $True
$textnamef9.Location = '80, 360'
$textnamef9.Text = 'MIK_Storage.xml'

$textnamef10.AutoSize = $True
$textnamef10.Location = '80, 400'
$textnamef10.Text = 'MIK_TecMar.xml'

$textPercent.AutoSize = $True
$textPercent.Location = '30, 10'
$textPercent.Text = 'процент'

$inputpecentw1.Location = '60, 40'
$inputpecentw1.Size = '20, 20'

$inputpecentw2.Location = '60, 80'
$inputpecentw2.Size = '20, 20'

$inputpecentw3.Location = '60, 120'
$inputpecentw3.Size = '20, 20'

$inputpecentw4.Location = '60, 160'
$inputpecentw4.Size = '20, 20'

$inputpecentw5.Location = '60, 200'
$inputpecentw5.Size = '20, 20'

$inputpecentw6.Location = '60, 240'
$inputpecentw6.Size = '20, 20'

$inputpecentw7.Location = '60, 280'
$inputpecentw7.Size = '20, 20'

$inputpecentw8.Location = '60, 320'
$inputpecentw8.Size = '20, 20'

$inputpecentw9.Location = '60, 360'
$inputpecentw9.Size = '20, 20'

$inputpecentw10.Location = '60, 400'
$inputpecentw10.Size = '20, 20'
# показать
$Read.Location = '20,740'
$Read.Size = '100, 40'
$Read.Text = 'Прочитать'
$Read.add_Click($Read_Click)
# сохранить
$Save.Location = '680,740'
$Save.Size = '100, 40'
$Save.Text = 'Сохранить'
$Save.add_Click($Save_Click)
#Show the Form
$form.ShowDialog()
} #End Function

#Call the form
chpecent | Out-Null
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
29.11.2019, 16:08
Помогаю со студенческими работами здесь

Как привязать этот код в форму
//Хеш-функция для алгоритма Рабина-Карпа public static int Hash(string x) { int p = 31; //Простое число ...

Работа с ArcGIS 9.3, куда вставить приложенный код - в форму или модуль
здравствуйте, я работаю в ArcGIS 9.3, пытаюсь увеличить возможности ПО при помощи vb6. нужный мне код есть, только вот не могу понять, куда...

вставить изображение формы в эту же форму
посмотрел что нужно делать через Graphics gr; gr.CopyFromScreen; но как ей пользоваться не понял на java это делается...

Как или куда вставить этот нестандартный CSS код?
button::-moz-focus-inner, input::-moz-focus-inner, input::-moz-focus-inner, input::-moz-focus-inner, input &gt;...

как проверить поля форму занять или нет до отправки форму
как проверить поля форму занять или нет до отправки форму как через ajax проверить например: поля логин занять или нет если...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
18
Ответ Создать тему
Новые блоги и статьи
SDL3 для Web (WebAssembly): Обработчик клика мыши в браузере ПК и касания экрана в браузере на мобильном устройстве
8Observer8 02.02.2026
Содержание блога Для начала пошагово создадим рабочий пример для подготовки к экспериментам в браузере ПК и в браузере мобильного устройства. Потом напишем обработчик клика мыши и обработчик. . .
Философия технологии
iceja 01.02.2026
На мой взгляд у человека в технических проектах остается роль генерального директора. Все остальное нейронки делают уже лучше человека. Они не могут нести предпринимательские риски, не могут. . .
SDL3 для Web (WebAssembly): Вывод текста со шрифтом TTF с помощью SDL3_ttf
8Observer8 01.02.2026
Содержание блога В этой пошаговой инструкции создадим с нуля веб-приложение, которое выводит текст в окне браузера. Запустим на Android на локальном сервере. Загрузим Release на бесплатный. . .
SDL3 для Web (WebAssembly): Сборка C/C++ проекта из консоли
8Observer8 30.01.2026
Содержание блога Если вы откроете примеры для начинающих на официальном репозитории SDL3 в папке: examples, то вы увидите, что все примеры используют следующие четыре обязательные функции, а. . .
SDL3 для Web (WebAssembly): Установка Emscripten SDK (emsdk) и CMake для сборки C и C++ приложений в Wasm
8Observer8 30.01.2026
Содержание блога Для того чтобы скачать Emscripten SDK (emsdk) необходимо сначало скачать и уставить Git: Install for Windows. Следуйте стандартной процедуре установки Git через установщик. . . .
SDL3 для Android: Подключение Box2D v3, физика и отрисовка коллайдеров
8Observer8 29.01.2026
Содержание блога Box2D - это библиотека для 2D физики для анимаций и игр. С её помощью можно определять были ли коллизии между конкретными объектами. Версия v3 была полностью переписана на Си, в. . .
Инструменты COM: Сохранение данный из VARIANT в файл и загрузка из файла в VARIANT
bedvit 28.01.2026
Сохранение базовых типов COM и массивов (одномерных или двухмерных) любой вложенности (деревья) в файл, с возможностью выбора алгоритмов сжатия и шифрования. Часть библиотеки BedvitCOM Использованы. . .
SDL3 для Android: Загрузка PNG с альфа-каналом с помощью SDL_LoadPNG (без SDL3_image)
8Observer8 28.01.2026
Содержание блога SDL3 имеет собственные средства для загрузки и отображения PNG-файлов с альфа-каналом и базовой работы с ними. В этой инструкции используется функция SDL_LoadPNG(), которая. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru