Jump to content

Recommended Posts

Posted (edited)

Hello,

I am new to autoit and would like to learn.

I would like to understand why the ClipGet() function is not working in some case.

When i write that code it is functionning (clipboard is captured)

$MyText = ClipGet()
Sleep(1000)
ConsoleWrite($MyText & @CRLF)

But when i use my usual constants before the code it is not working (i do not even have writeconsole result)

Opt('CaretCoordMode', 0) ;1=absolute, 0=relative, 2=client
Opt('MouseCoordMode', 0) ;1=absolute, 0=relative, 2=client
Opt('PixelCoordMode', 0) ;1=absolute, 0=relative, 2=client
Opt('SendKeyDelay', 5) ;5 milliseconds
Opt('SendKeyDownDelay', 1) ;1 millisecond
Opt('WinWaitDelay',250) ;250 millisecond
Opt("WinTitleMatchMode",2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

#Unicode
#NoTrayIcon
#include <AutoItConstants.au3>
#include <Array.au3>
#include <Process.au3>
#include <MsgBoxConstants.au3>
#include <TrayConstants.au3>
#include <GUIConstantsEx.au3>
#include <String.au3>
#RequireAdmin

$MyText = ClipGet()
Sleep(1000)
ConsoleWrite($MyText & @CRLF)

Is there any method to debug step by step or line by line to see where is the problem with autoit?

Thank you in advance for the help

Edit : Sorry for the disturb, i have just noticed that when i remove #RequireAdmin, it is working !!!

Is this behaviour normal?

Thanks again and sorry to waste your time

Edited by HNB2018
Posted

If you use #RequireAdmin in your script, and SciTE wasn't started with the same level of access, i.e. using Run As Administrator, then when you run your script, the #RequireAdmin will be seen and the script will end, and then restart itself with administrator  permissions. This is why you don't see anything in SciTE, start it as an administrator, and then run your script, should work fine.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

@HNB2018 :welcome: to the forum.

@BrewManNH have right about the #RequireAdmin and standard SciTE (Lite).

But you can try to use SciTE4AutoIt3:  https://www.autoitscript.com/site/autoit-script-editor/downloads

which should work fine with ConsoleWrite and #RequireAdmin

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

@Danp2 did you check recent updated HelpFile in latest BETA ? As far as I remember this was discussed and probably already updated in HelpFile.... but I can be wrong.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 7/30/2020 at 8:03 PM, Danp2 said:

Seems like the help file entry for #RequireAdmin is out of date --

Expand  

 

  On 7/30/2020 at 8:23 PM, mLipok said:

did you check recent updated HelpFile in latest BETA ? As far as I remember this was discussed and probably already updated in HelpFile.... but I can be wrong.

Expand  

Just an info: : The help text regarding #RequireAdmin in the 3.3.15.3 beta is identical to the 3.3.14.5

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Posted
  On 7/30/2020 at 9:00 PM, Musashi said:

Just an info: : The help text regarding #RequireAdmin in the 3.3.15.3 beta is identical to the 3.3.14.5

Expand  

Check helpfile for ConsoleWrite 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 7/30/2020 at 9:57 PM, mLipok said:

Check helpfile for ConsoleWrite 

Expand  

Also identical !

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...