关于使用VBScript编辑MSI,我有两个问题。
以下代码将使用静态值(C:\ users \ x等)放入MSI“Property”表中。但是,如果我使用预定义变量,那么它会将变量名称作为文本插入到MSI中,而不是将该变量转换为该变量。如何让playbuttontapped
函数接受值的变量?
该变量是从命令行参数创建的。
- (IBAction)buttonTapped:(id)sender {
if (player.playing) {
[player stop];
}
if (!recorder.recording) {
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setActive:YES error:nil];
// Start recording
[recorder record];
[buttonRecord setTitle:@"Pause" forState:UIControlStateNormal];
} else {
// Pause recording
[recorder pause];
[buttonRecord setTitle:@"Record" forState:UIControlStateNormal];
}
//[stopButton setEnabled:YES];
[_playButton setEnabled:NO];
timer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(updateCircularProgressBar)
userInfo:nil
repeats:YES];
NSLog(@"playTapped");
if (!recorder.recording) {
player =[[AVAudioPlayer alloc]initWithContentsOfURL:recorder.url error:nil];
//[player setDelegate:self];
[buttonRecord setEnabled:YES];
[recorder recordForDuration:(NSTimeInterval)10];
[recorder record];
}
}
- (IBAction)playbuttontTapped:(id)sender {
if (!recorder.recording){
player = [[AVAudioPlayer alloc] initWithContentsOfURL:recorder.url error:nil];
[player setDelegate:self];
[player play];
}}
除非MSI中的属性/行为空,否则msi.OpenView
将出错。在提交新的字段之前,我必须取出我在源MSI中更新的所有字段才能运行。是否有一种方法可以使用覆盖命令触发strNewServerName = WScript.Arguments.Item(0)
Set record = msiInstaller.CreateRecord(1)
Set view = msi.OpenView("INSERT INTO `Property` (`Property`, `Value`) VALUES ('SERVERNAME', 'strNewServerName')")
view.Execute record
对于行/表中已有的内容?
答案 0 :(得分:1)
有一些方法可以将变量的内容插入到字符串中:连接和替换。如:
>> v = "content"
>> WScript.Echo "pipapo '" & v & "' popapi"
>> WScript.Echo Replace("pipapo '@' popapi", "@", v)
>>
pipapo 'content' popapi
pipapo 'content' popapi
>>
要更改现有记录,请使用“更新”,如演示here。