I would like to know if there is a way to force displaing in Windows 10 & 11 the buttons: 'Update and shut down' (and Update and restart) ?
Thanks in advance.
Cramaboule
Searching on a PC, I found this reg key:
HKLM\SOFTWARE\Microsoft\WindowsUpdate\Orchestrator
ShutdownFlyoutOptions (REG_DWORD)
You can play with different options between 0 to 15
You can as well hide power/retart/... buttons here:
HKLM\SOFTWARE\Microsoft\PolicyManager\default\Start\HideRestart value 0 - 1 (REG_DWORD)
and here:
HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start HideRestart 0 - 1 (REG_DWORD)
and power button on login screen:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System shutdownwithoutlogon 0 - 1 (REG_DWORD)
Cram...
Related
I have a data frame (Dataset_Events) with seven columns, two of them being eventInfo_ea and eventInfo_el. I'd like to remove the cell value of eventInfo_el in rows where eventInfo_ea = 'add to cart'. See the code below.
Remove = function(Dataset_Events, eventInfo_ea, eventInfo_el){
if(Dataset_Events[["eventInfo_ea"]]=="add to cart"){
Dataset_Events[["eventInfo_el"]] <- NULL
}
}
sapply(Dataset_Events, Remove)
Unfortunately R gives me the following error message:
"Error in Dataset_Events[["eventInfo_ea"]] : subscript out of bounds"
Dimension of the dataframe are 713478 x 7.
Can anybody explain why and how to fix it?
If I simply run the if condition itself, I get a proper TRUE/FALSE reply in the same length as the data.frame
Dataset_Events[["eventInfo_ea"]]=="add to cart"
Here a sample dataset of the two relevant columns (both columns have class factor):
eventInfo_ea eventInfo_el
1 click thumbnail
2 click description
3 click hero image
4 click open size dropdown
5 click hero image
6 click hero image
7 click hero image
8 click description
9 click open size dropdown
10 click hero image
11 click hero image
12 click hero image
13 click hero image
14 click description
15 click open reviews
16 click hero image
17 click open reviews
18 click description
19 add to wishlist hero image
20 click hero image
21 click hero image
22 add to cart hero image
Try this:
Remove = function(Dataset_Events){
ind = Dataset_Events[["eventInfo_ea"]] == "add to cart"
Dataset_Events[["eventInfo_el"]][ind] = NA
return (Dataset_Events)
}
Remove(Dataset_Events)
I removed the second and third arguments from your function (you don't seem to be using them?). As you note, Dataset_Events[["eventInfo_ea"]]=="add to cart" gives you a vector of logicals, so this should be used to index the rows you want to set to NA (I changed from NULL since this was giving problems).
I believe the problem is that theDataset_Events[["eventInfo_el"]] returns a factor. In this case is better to use identical.
Remove = function(Dataset_Events, eventInfo_ea, eventInfo_el){
if(identical(as.character(Dataset_Events[["eventInfo_ea"]]),"add to cart")){
Dataset_Events[["eventInfo_el"]] <- NULL
}
}
sapply(Dataset_Events, Remove)
I actually found a solution that works. I skipped the whole part of defining a function and simply used the following code and it worked
Dataset_Events[ Dataset_Events["eventInfo_ea"]=="add to cart", ]["eventInfo_el"] <- NA
Still happy to hear though why the suggestions from all of you didn't seem to modify my dataset at all. Thanks a lot though!!!
I have a script that I'd like to use to automate processes in Audacity. I have it set up so that all the functions I want to do in Audacity are keyboard shortcuts (since I don't think Audacity uses standard window menus like is required for WinMenuSelectItem()) In other words, my whole code consists of multiple instances of the Send() command. The problem is, AutoIT executes the code too fast. I've tried using WinWait(), but the processes take variable amounts of time. I've also tried ShellExecuteWait() and RunWait()Is there a way to get it to wait until the program isn't doing something, and then execute my send commands? Here's some of my code
Run("C:\Program Files (x86)\Audacity\audacity.exe")
; wait until it's active
WinWaitActive("Audacity")
; get the dialogue box to go away
Send("{ENTER}")
RunWait("Audacity")
; open files
Send("^o")
RunWait("Audacity")
; open the certain file & press enter
Send("test.wav")
RunWait("Audacity")
Send("{ENTER}")
RunWait("Audacity")
; select left boundary of silence period
Send("[")
RunWait("Audacity")
Send("000000100{ENTER}")
RunWait("Audacity")
; select right boundary of silence period
Send("]")
RunWait("Audacity")
Send("200000000{ENTER}")
RunWait("Audacity")
; Use for debugging issues. Systray icon show current line.
Opt('TrayIconDebug', 1)
; Delay default: 250s
Opt('WinWaitDelay', 400)
; Delay default: 5s
Opt('SendKeyDelay', 100)
; Path of the wav file.
$sInFile = #WorkingDir & '\test.wav'
; Optional permanent change of splash screen setting.
_SplashScreen(True)
; Run Audacity and argument of the wav file.
$iPid = Run('"C:\Program Files (x86)\Audacity\audacity.exe" "' & $sInFile & '"')
; Check if Run Audacity failed.
If #error Then
MsgBox(0x40030, #ScriptName, 'Failed to run Audacity')
Exit 1
EndIf
; Wait for main window to get handle. Title is the filename with no extension.
$hMainWindow = WinWait('[TITLE:test; CLASS:wxWindowNR]', '', 10)
; Check allowed timeout of window.
If Not $hMainWindow Then
MsgBox(0x40030, #ScriptName, 'Audacity window not detected.')
Exit 1
EndIf
; If splash screen setting not 0 then handle the window.
If _SplashScreen() Then
AdlibRegister('_WelcomeWindow')
WinWait('Welcome to Audacity', '', 3)
AdlibUnRegister('_WelcomeWindow')
EndIf
; Send '[' to main window to trigger Left Boundary window.
ControlSend($hMainWindow, '', '', '[')
; Get handle of Left Boundary window.
$hMsgWindow = WinWait('Set Left Selection Boundary', '', 5)
; Check allowed timeout of window.
If Not $hMsgWindow Then
MsgBox(0x40030, #ScriptName, 'Selection Boundary window not detected.')
Exit 1
EndIf
; Activate window, set time and click OK.
If WinActivate($hMsgWindow) Then
ControlSend($hMsgWindow, '', 'wxWindowNR1', '{LEFT 3}1'); 1000
ControlClick($hMsgWindow, '', 'Button2'); OK
EndIf
; Send ']' to main window to trigger Right Boundary window.
ControlSend($hMainWindow, '', '', ']')
; Get handle of Right Boundary window.
$hMsgWindow = WinWait('Set Right Selection Boundary', '', 5)
; Check allowed timeout of window.
If Not $hMsgWindow Then
MsgBox(0x40030, #ScriptName, 'Selection Boundary window not detected.')
Exit 1
EndIf
; Activate window, set time and click OK.
If WinActivate($hMsgWindow) Then
; Audacity shows 1000 and focus is on the 1st non zero digit which is 1.
ControlSend($hMsgWindow, '', 'wxWindowNR1', '2'); 2000
ControlClick($hMsgWindow, '', 'Button2'); OK
EndIf
; More code to do.
Sleep(1000)
MsgBox(0x40040, #ScriptName, 'End of automation.' & #CRLF & #CRLF & _
'You can close Audacity to finish.')
; Wait for Audacity process to close.
ProcessWaitClose($iPid)
Exit
Func _WelcomeWindow()
; Used by AdlibRegister to handle the Welcome window.
; Welcome window hides if closed so need to check if exist and is visible (2).
If WinExists('Welcome to Audacity') Then
If BitAND(WinGetState('Welcome to Audacity'), 2) Then
WinClose('Welcome to Audacity')
Else
AdlibUnRegister('_WelcomeWindow')
EndIf
EndIf
EndFunc
Func _SplashScreen($bDisable = False)
; Write to audacity.cfg to disable splash screen.
Local $sIniFile = #AppDataDir & '\Audacity\audacity.cfg'
If IniRead($sIniFile, 'GUI', 'ShowSplashScreen', '1') = '1' Then
If $bDisable Then
; Return 1 if ini file change is success.
If IniWrite($sIniFile, 'GUI', 'ShowSplashScreen', '0') Then
Return 1
EndIf
Else
; Return 1 if check for splash screen is enabled.
Return 1
EndIf
EndIf
EndFunc
Opt() is used to slow down the wait of windows and the sends.
Also added Opt('TrayIconDebug', 1) for debugging though if
the script is considered good then you can remove that Opt().
ControlSend() is used instead of Send() as ControlSend()
targets windows and controls based of title, text, etc.
The Opt() delays are not required though was added to
demonstrate the usage, though perhaps Audacity may struggle
to keep with the speed that AutoIt can automate.
If possible, suggest use of Control*() functions for automation.
Storing window handles in a variable can help save retyping titles
in the code. WinWait() returns a window handle which is ideal and
if the timeout parameter is used, then 0 indicates the window not
found so automation can be aborted.
The Classname of the main window is not enough on its own as
Audacity creates many invisible windows with the same Classname.
So, the title may need to be used as well. The title could be
used alone though titled by filename may not be unique at times.
See Window Titles and Text Advanced for usage.
WinActivate() is used on the Boundary windows although it
may not be needed as control*() usually do not need active
windows. Standard Msgboxes in comparison may require to be
active to accept messages sent to them.
ShellExecuteWait() and RunWait() are no good for automation
as they block the script from continuing until the executed
process has finished.
So use ShellExecute() or Run() instead.
The repetitive use of RunWait("Audacity") seems like
desperation to correct the behavior perhaps, though flawed.
Waiting for windows to appear is how to control flow and then
functions such as ControlCommand() can detect state of controls.
ControlClick() is used on the buttons.
CtrlID of Classname Button2 is used though if the script
is always for English users then you can use the text which
would be OK for the OK button.
The ProcessWaitClose($iPid) is optional.
It is sometimes useful to wait for the program
being automated to exit before the script exits.
You comment "get the dialogue box to go away" in you code
after starting Audacity. You can change the setting on the
dialogue box or Preferences -> Interface options. Advice
disabling as it is a future problem to keep handling.
I added some code to disable the setting in the
audacity.cfg file. If not preferred to disable with
_SplashScreen(True) or done manually then
the AdLibRegister('_WelcomeWindow') call will handle
closing the window. Note that the Welcome window does
not close but rather hides.
_SplashScreen(True) changes splash setting to 0 to disable the splash.
_SplashScreen(False) or _SplashScreen() does no change of settings.
The call returns 1 if splash is enabled else 0.
This happens to me frequently, Please give me a solution.
Edit : I have found the fix and answered below.
The Solution is just 3 Steps:
Step 1 : Press Ctrl + Alt + F
Step 2 : Press Left Arrow (To move to the 3 Lines )
Step 3 : Press Enter on Repaint Desktop
You gotcha !
I have two digium cards ,models are TE420 4 port card,TE121 single port card.
After the configuration 4 port card
if i execute "dahdi show status" in asterisk prompt , I got following output
Description Alarms IRQ bpviol CRC4
T4XXP (PCI) Card 0 Span 1 OK 46 0 0
T4XXP (PCI) Card 0 Span 2 OK 46 0 0
T4XXP (PCI) Card 0 Span 3 OK 46 0 0
T4XXP (PCI) Card 0 Span 4 OK 46 0 0
Wildcard TE121 card 0 OK 32457 0 0
Why I am not getting the Span 5 for the single port card.
check by typing pri show spans in asterisk cli
and also in linux shell type dahdi_cfg -vvvv it will output all the channesl configured
The description you see there is the span description filled in by the DAHDI drivers for each span. When they fill in the description they do not yet know what global span number they were assigned. The 1-4 is just showing the spans that are exported by card 0. Since TE121 only export a single span, they only indicate their card number.
If you're using these cards with PRI, I agree that with striker that 'pri show spans' is a more useful command to see the status of the spans.
Running dahdi_maint from the console is also a good way to see the current status of any DAHDI spans you have configured in your system.
For debugging purposes, I usually use something like console.log('line number #').
Not sure if it's the best way to handle it but I think it would be helpful if I can just print out the line number of the line where I'm putting the console.log() dynamically.
Let's say:
1 //do something
2 if(file){
3 console.log('Line 3');
4 $('#uploads').css({ 'height' : 'auto' });
5 } else {
6 console.log(getLineNumber()); //just an example
7 $('#tags').val(temp);
8 }
In the above, if I happen to remove line 1 for instance, line 3 will be technically incorrect as the line number is decremented by 1 but the log will still show 3. But in line 6, suppose getLineNumber() returns the line number, then it will still make sense even after a line above has been removed.
So is there an easy way which acts like getLineNumber()?
You can use onerror event handler for that.
See the last example on this page: http://www.tutorialspoint.com/javascript/javascript_error_handling.htm
Direct link to example: http://www.tutorialspoint.com/cgi-bin/practice.cgi?file=javascript_40