Recommended Posts

this-is-me 4

this-is-me 4

As a long time user of these forums, I have come to notice that many of the questions asked by first-time users are repeat questions that can sometimes be easily answered. Most of these answers are not provided in a reasonable time because a current forum user must search for the answer to the OP's question, thereby shifting the work from the OP to the forum frequenter. In other cases, the reponse is given in disgust or anger because the forum user has seen the question asked many times before. Therefore, I am here posting the answers to many of the newcomer's questions. I will number the questions to provide a simple and quick reference point that any forum user can link to.

Q1. How can I debug my script?

A1. This one has a myriad of answers, but the most effective is to begin by using the SciTE4AutoIt3 Editor to create or edit scripts. This program is useful in debugging for the following reasons:

Syntax highlighting allows for immediate viewing of any mistakes from unended script tags or quotes. This allows the scripter to visibly see the difference between the following incorrect code

Q18. Why isn't my thread getting any replies?

A1.

Did you give a good description of the problem? If your title or explanation of the issue is not descriptive, users are likely to bypass your issue instead of helping. Post titles such as "Help Me", "I Have A Problem", "Question", "Help me fix my code", "This code doesn't work" or similarly worded question titles will not readily draw forum users to your post. Experienced users (which are your best hope of resolving the issue) will often skip your post altogether in cases like this. An example of a post title descriptive enough to attract users to assist you is "Problem with WinWaitClose", or "Loop never ends".

A2.

Did you post example code? If you have not posted an example of the code you are having an issue with, then you will not recieve support. When posting a non-working script, please do so in the smallest amount of stand-alone code possible. If the code you post cannot run by itself on another person's computer, they will not be able to recreate the issue.

A3.

Did you use proper english? Here are guidelines for posting properly in the english language:

Use proper case. THIS IS CONSIDERED YELLING. if you post in ALL UPPERCASE or all lowercase, you look like a doofus when you do.

Use proper punctuation. Complete sentences need only one trailing punctuation mark, not three!!! Writing a sentance without simple punctuation such as commas or other punctuation is considered lazy, which is considered a good judge of the poster's coding style. If you cannot summon the strength to write a sentence with correct punctuation, you will most likely miss simple coding mistakes such as unterminated quotes.

Link to post

Share on other sites

DaveF 0

DaveF 0

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

If you use Send in a script and you have a problem with keys being stuck down then Send is the most likely culprit. A similar problem can occur with BlockInput. The solution is generally quite simple. If there is a key like Shfit or Alt held down at the start of the Send sequence, but that key is released by the time the Send sequence finishes then the key will get 'stuck' down. As an example of a solution, you could replace the Send function in your script with the _SendEx function below.

;Send the string $ss after the Shift Alt and Ctrl keys are released. Optionally give a warning after 1 sec if any of those keys still down.
;Requires misc.au3 to be included in the script for the _IsPressed function.
Func _SendEx($ss,$warn = "")
Local $iT = TimerInit()
While _IsPressed("10") Or _IsPressed("11") Or _IsPressed("12")
if $warn <> "" and TimerDiff($iT) > 1000 Then
MsgBox(262144, "Warning", $warn)
EndIf
sleep(50)
WEnd
Send($ss)
EndFunc;==>_SendEx

EDIT:

shilbiz discovered that the following single line can 'clear' locked down keys

ControlSend("", "", "", "text", 0)

I don't know how he came up with it but it seems to work!

EDIT 2: As explained above, the _SendEx function waits for the Shift, Alt and Ctrl keys to be released or pops up a warning if the $warn parameter is not an empty string. Therefore it is not intended to be used when one of these modifyer keys has been set to be down using any combination of {ALTDOWN}, {SHIFTDOWN} and {ALTDOWN}.

This way you may have your script resistive against another active windows.

and it's possibe to run such script from scheduler on locked Windows station.

Hi, i am having a script which opens a command prompt window and then sends commands to it. I want this script to run even if my workstation is locked. Yous said to use controlsend, however i have read that controlsend should not be used for sending commands to command prompt window. So now what to do...PLease help!!!!!!