Proximity prompt cooldown - Roblox studio - roblox

How could I add a cooldown to my Proximity Prompt to press it again??
press key,after wait any seconds for press it again
Roblox studio
i don't know how to make this script,i need help

This is just a matter of using the function ProximityPrompt.Triggered and then disabling the prompt for a certain period of time before reenabling it again.
local prompt = script.Parent
prompt.Triggered:Connect(function()
print("triggered") --Action
prompt.Enabled = false
wait(5) --However long you want
prompt.Enabled = true
end)

Related

How can I wait for only one of three events (mouse input, keyboard input, or WinWaitClose) in AutoHotkey?

In my scenario, either a window will close automatically, or the user will provide an input via mouse or keyboard.
If the window closes automatically, I want to open a PDF. This is easy:
WinWaitClose, ahk_id %cmdHwnd%
Run, "C:\Program Files\SumatraPDF\SumatraPDF.exe" "%path%\cv.pdf"
But if the window doesn't close automatically (i.e. the PDF failed to compile), then the user's going to close that window manually, e.g. hit Enter or click the close button. In this case, I do not want the above WinWaitClose to trigger!
So another way of putting my question is, how do I "cancel" a WinWaitClose listener upon mouse or keyboard input?
I suppose you could rely on the Seconds timer in WinWaitClose, and if that fails, you can rely on the ErrorLevel which will be set to 1.
; Set WinWaitTimer to wait 2 seconds before timing out.
WinWaitClose, ahk_id %cmdHwnd%,, 2
if (ErrorLevel) {
; Do something.
}
else
{
Run, "C:\Program Files\SumatraPDF\SumatraPDF.exe" "%path%\cv.pdf"
}

Computer does not stay awake after scheduled task

I have a scheduled task that wakes up the computer to run a batch file. However the computer turns back off after some time. I have my computer set to (never sleep) so after waking up from the task it should stay on.
However after doing some reading I found out this was because the computer did not wake up from user input.
What I am looking for is a simple script (batch or vb file maybe) I can run via task scheduler that will simulate user input. Maybe hitting the space bar once or moving the mouse.
Running windows 8.1
I tried the following .vbs script without success
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.SendKeys("+{F10}")
You can try this application:
http://mousejiggler.codeplex.com/
It'll simulate mouse movement to keep your computer awake.
If you really want a script try this:
https://gallery.technet.microsoft.com/scriptcenter/Keep-Alive-Simulates-a-key-9b05f980
You can simulate the [F5] key to refresh windows every 2 minutes like this :
Option Explicit
Dim Ws
set Ws = createobject("Wscript.Shell")
Do
Ws.Sendkeys "{F5}"
Call Pause(2)'To sleep for 2 minutes
Loop
'***************************************
Sub Pause(min)
Wscript.Sleep(min*1000*60)
End sub
'***************************************

How to use script with laptop lid closed?

So I have a script which works perfectly fine.
Here it is:
#SingleInstance force
#Persistent
settimer, idleCheck, 1000 ; check every second
return
idleCheck:
if WinExist("App Name with or without Spaces") ; if app is running
{
if(A_TimeIdle >= 270000) ; and there was no input in 4.5 min
{
WinActivate ; switch to that app
sendInput z ; and perform an action
}
}
return
But as soon as lid is closed (not in sleep) it doesn't for obvious reasons.
Is there a way to do stuff when it's closed or "trick" OS to think that lid is open when it's closed.
Hope that makes sense.
Solution doesn't have to be in .ahk only. I just need the script to work, with which help doesn't matter.
Thanks in advance.
This is under the assumption that your laptop does go into some kind of 'sleep mode' when the lid is shut.
If thats the case, I don't think you need an AHK script for this.
If you go to the power settings options in your control panel.. Most of the time it looks something like this:
 
You may need to find the advanced power options, sometimes found under power plans...
 
I hope it's fairly self explanatory what you need to do.
Just pick 'do nothing' or similar for the lid close action.
After that everything should continue running as if the lid was open.

Script ends even if there are still more commands after

I'm not sure what i am doing wrong but after this command finishes, the script ends yet there is still another command to complete, would anyone know what I am doing wrong. Thanks
I enter this in, it runs through
tell application "Finder"
activate
display dialog "Are you sure you want to shut down your computer now?" buttons {"Restart", "Sleep", "Shutdown"} with icon alias ((path to me as text) & "Contents:Resources:power.icns")
if the button returned of the result is "Restart" then
set theSeconds to 10
repeat theSeconds times
display dialog theSeconds buttons {"Stop"} giving up after 1 with title "Restarting..." with icon 0 default button 1
set theSeconds to (theSeconds - 1)
set volume 6
beep 1
end repeat
tell application "Finder"
restart
end tell
else
if the button returned of the result is "Sleep" then
set theSeconds to 10
repeat theSeconds times
display dialog theSeconds buttons {"Stop"} giving up after 1 with title "Sleeping..." with icon 0 default button 1
set theSeconds to (theSeconds - 1)
set volume 6
beep 1
end repeat
tell application "Finder"
sleep
end tell
else
if the button returned of the result is "Shutdown" then
set theSeconds to 10
repeat theSeconds times
display dialog theSeconds buttons {"Stop"} giving up after 1 with title "Shutting Down..." with icon 0 default button 1
set theSeconds to (theSeconds - 1)
set volume 6
beep 1
end repeat
tell application "Finder"
shut down
end tell
and this is the command that comes after, but doesn't run
set appLocation to path to me as string
set theFile to appLocation & "Contents:Resources:iPanic.app"
tell application "Finder" to open file theFile
delay 8
tell application "Terminal"
activate
set currentTab to do script {"defaults write com.apple.LaunchServices LSQuarantine -bool YES"}
delay 1
do script {"Killall Finder"} in currentTab
end tell
The reason the end of your script doesn’t run is that by the time the script gets to that point, your computer has either restarted, is sleeping, or has been shutdown.
The restart, sleep, or shutdown command needs to be the very last command in your script.
You can make the final part of your script into a subroutine, and call that subroutine before the restart, sleep, or shutdown commands.
Wrap the final part of your script like this:
on finalPart()
…
end finalPart
And then you call that subroutine like this:
finalPart() of me
restart
You can name the subroutine something more descriptive to you than “finalPart” of course.
Also, where you are calling the restart, sleep, and shutdown commands, you don’t need the tell block that is around them because you are already talking to Finder at that point. You can remove the line directly above and directly below the restart, sleep, and shutdown commands.
And here:
tell application "Terminal"
activate
set currentTab to do script {"defaults write com.apple.LaunchServices LSQuarantine -bool YES"}
delay 1
do script {"Killall Finder"} in currentTab
end tell
You don’t have to run a shell script with the Terminal app. The “do shell script” command is a Standard Addition that works in every app. And to quit Finder, all you have to do is tell it to quit. So unless you have more going on in your “Killall Finder” script than just quitting the Finder, you can probably write the above like this:
tell application "Finder"
do shell script "defaults write com.apple.LaunchServices LSQuarantine -bool YES"
delay 1
quit
end tell
Of course, if that part of the script is already within a Finder tell block, you can remove the tell command from the above.

Suspend shortcut for Autohotkey

I would like to set the "Scroll Lock key" to be a toggle shortcut to suspend and resume
my Autohotkey script. I mean to get all the lines in a currently running ahk script suspended and resumed by a toggle shortcut.
Is this possible?
Toggle suspend:
f1::suspend
Close the script:
f2::exitapp
Reload the script:
f3::reload
Edit the script:
f4::edit
I find that including this speeds up editing / testing:
back = open the script in notepad
forward = save and exit notepad
refresh = reload
browser_back::edit
browser_forward::
send ^{s}
send !{f4}
return
browser_refresh::reload
add reload at bottom of browser_forward hotkey, i say having it seperate
The short, precise answer is that yes, it's possible.
The long, complicated answer is to add the following line to your script
scrolllock:: Pause