Jump to content

Recommended Posts

Posted

I was reading https://www.autoitscript.com/forum/topic/162588-extended-length-support-in-file-functions-beta-for-reference/?do=findComment&comment=1190661 

and decided to search for UNICODE in the help file. reading along I read that the command line is

Aut2exe.exe / In < infile.au3 >[/out < outfile.exe >][/icon < iconfile.ico >][/comp 0 - 4][/nopack][/x64][/bin < binfile.bin >]

and the 

Command Line Notes
Long filenames should be enclosed in double-quotes like "C:\Program Files\Test\test.au3".

With the exception of /in all switches are optional.

By default, the 32-bit compiler produces a 32-bit binary and the 64-bit compiler produces a 64-bit binary. Use the /x86 and /x64 parameters to explicitly specify the output.

The /pass and /nodecompile switches are redundant as of version 3.2.8.1. They will be ignored if used and have been removed from this list.

The /ansi and /unicode switches are redundant as of version 3.3.0.0.

The /bin switch is redundant as of version 3.3.10.0 and has been removed from this list..

so the [/bin < binfile.bin >] should be removed

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)

on _WinAPI_RegNotifyChangeKeyValue the help example should account ( or show ) that x86 != x64 

#include <APIRegConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIError.au3>
#include <WinAPIHObj.au3>
#include <WinAPIProc.au3>
#include <WinAPIReg.au3>

Opt('TrayAutoPause', 0)

Global $iAccess = StringInStr(@OSArch, "64") ? BitOR($KEY_NOTIFY, $KEY_WOW64_64KEY) : $KEY_NOTIFY
If @AutoItX64 Then $iAccess = $KEY_NOTIFY

Local $hKey = _WinAPI_RegOpenKey($HKEY_CURRENT_USER, 'Software\Microsoft\Windows\CurrentVersion\Run', $iAccess)
If @error Then
    MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), @extended, _WinAPI_GetErrorMessage(@extended))
    Exit
EndIf
Local $hEvent = _WinAPI_CreateEvent()
If Not _WinAPI_RegNotifyChangeKeyValue($hKey, $REG_NOTIFY_CHANGE_LAST_SET, 0, 1, $hEvent) Then
    Exit
EndIf

While 1
    If Not _WinAPI_WaitForSingleObject($hEvent, 0) Then
        Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(4096, ''Registry'', ''The registry hive has been modified.'' & @CRLF & @CRLF & ''HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run'', 5)"')
        If Not _WinAPI_RegNotifyChangeKeyValue($hKey, $REG_NOTIFY_CHANGE_LAST_SET, 0, 1, $hEvent) Then
            ExitLoop
        EndIf
    EndIf
    Sleep(100)
WEnd

_WinAPI_CloseHandle($hEvent)
_WinAPI_RegCloseKey($hKey)

 

Edited by argumentum
corrected error

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
On 1/2/2019 at 5:06 PM, argumentum said:

on _WinAPI_RegNotifyChangeKeyValue the help example should account ( or show ) that x86 != x64 

That would apply to every registry function, so why this one specifically?

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!

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
11 minutes ago, BrewManNH said:

why this one specifically?

oh, no clue. This is the first time I became aware of the use of "$KEY_WOW64_64KEY". Haven't seen any examples of it's use and thought that having one example would show why the "$KEY_NOTIFY" not work if the compilation don't match the OS's ( 32 vs 64 ). I didn't do a deep dive into the help file, just that one example.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
10 minutes ago, argumentum said:

Haven't seen any examples of it's use

Then you haven't searched, there are dozens of times that the x86/64 issue has come up, both in registry and file reference functions. It's referenced in the help file under the heading "AutoIt => Using AutoIt => Running under Windows 64-bit Edition"

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!

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
6 minutes ago, BrewManNH said:

Then you haven't searched

Ok, this is not related to "HKCR64 or HKLM64".
In _WinAPI_SfcIsKeyProtected and _WinAPI_RegCreateKey are mentions of $KEY_WOW64_64KEY but no examples.
What I present shows an example. It would not hurt to have at least one example in a help file.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

  • 9 months later...
Posted
On 12/7/2018 at 3:44 AM, mLipok said:

Example for TimerInit

#include <MsgBoxConstants.au3>

Local $hTimer = TimerInit() ; Begin the timer and store the handle in a variable.
Sleep(3000) ; Sleep for 3 seconds.
Local $fDiff = TimerDiff($hTimer) ; Find the difference in time from the previous call of TimerInit. The variable we stored the TimerInit handlem is passed as the "handle" to TimerDiff.
MsgBox($MB_SYSTEMMODAL, "Time Difference", $fDiff)

 

Fixed it today.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • 2 weeks later...
Posted (edited)

@people who are able to modify the wiki documentation pages :

First of all, I apologize if this post will be very long (my biggest default) but I like to explain in details, with pics etc...
A couple of days ago, I wanted to help Moist in this thread and before I replied to him, I was very happy to read in the help file, topic GUICtrlCreatePic(), the following sentence :

"To set the picture control to the same size as the file content, set width and height to 0"

Terrific feature I thought, but a couple of hours later and after dozen of useless tests, trying any kind of picture size/extension or applying any style / extended style, it didn't work.

Then I thought : "why not trying to copy and paste the whole sentence in Google and see where it goes from here ?"
I knew it would return dozen of links referring to the help file but I was lucky enough to find this link, Ticket #3682 reported by anonymous 11 months ago (ticket still opened waiting for a reply) and here is a resume of what anonymous wrote :

...While in AutoIt 3.3.12.0 this worked nice, in 3.3.14.5 this causes the image to be displayed in a 150x150 square...

After reading that, I downloaded several AutoIt versions (including the 3 Beta's) just to try that specific feature and double check anonymous test, here are the results :

1674866143_163-3in1.jpg.aca2bba67a0de64a363889bc229d6184.jpg

And this is the script used to display the 2 Gui's from the precedent picture, please feel free to try it with any of your pictures :

#include <GuiConstantsEx.au3>

$hGui = GUICreate("163 - AutoIt " & @AutoItVersion, 300, 435)
GUICtrlCreatePic(@ScriptDir & "\163 - Original pic.jpg", 1, 1, 0, 0)
GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete($hGui)

As you can see, the downgrade happened when AutoIt 3.3.14.3 was released, because everything works fine with all precedent versions I tested, last working version is 3.3.14.2
Imho, this downgrade could be related to another ticket #2916 as shown in AutoIt history (though I may be mistaken) :

1777043120_163-AutoIthistory.png.17cc3ee4404feb49d87f32651aaf7e7c.png

So the only thing I'm asking now is : could it be possible to any of you to modify this wiki page and add a note to indicate that this feature is no more available actually, something like this :

To set the picture control to the same size as the file content set width and height to 0.
(this feature is broken since version AutoIt 3.3.14.3, waiting to be fixed)

Of course the local help file AutoIt.chm on our HD won't reflect this modification (until next AutoIt release) but at least, when in doubt concerning any function, we all could rely on Wiki doc to make sure that we are reading the most recent help file fully amended.

Thanks for reading and thumbs up to our devoted wiki contributors :thumbsup:

Edit : in case you wonder why I also downloaded the antique versions autoit-v3.2.10.0 (2007) and autoit-v3.2.12.0 (2008), it's because another important thing changed in AutoIt between these 2 versions (more than 11 years ago) but the actual help file doesn't reflect it and still indicates a wrong sentence. If I got strength enough, I'll prepare another fully detailed post. That magnifier in the avatar is a big help :)

Edited by pixelsearch
Posted

The example for _WinAPI_GetWindowDC (actually it is the _WinAPI_CreatePen example) does not work when run from SciTE. The cross does not get fully drawn and it disapears in a split second. But it should get displayed for 3 seconds.
This only happen when the example is run from SciTE. Why is described here.

To solve the problem I would like to Exit the example script when uncompiled with a MsgBox describing the problem an explaining the solution.

What do you think?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • 2 weeks later...
Posted (edited)

In the _GDIPlus_GraphicsSetTransform example, the DrawInsert function is missing the $fAngle in the documentation... kinda not a problem, but very confusing when trying to use it and your picture suddenly rotates! :D

Edit: More than one of the UDFs uses this function... I can get a list if you need
Edit2: Too tired, it was the same function. Going to bed now

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

  • 2 months later...
  • 2 months later...
Posted

I would suggest mentioning that OnAutoItExitRegister doesn't declare variables that have a default value in the function definition

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

  • 4 months later...
Posted

(Apparently I really like OnAutoItExitRegister) Also undocumented:

  • it accepts a function instead of its name --> OnAutoItExitRegister(Closing)
  • It won't call a function twice even if you register it twice
  • it uses a first-in last-out approach to calling registered functions

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Posted
On 10/18/2019 at 4:40 AM, pixelsearch said:

@people who are able to modify the wiki documentation pages :

First of all, I apologize if this post will be very long (my biggest default) but I like to explain in details, with pics etc...
A couple of days ago, I wanted to help Moist in this thread and before I replied to him, I was very happy to read in the help file, topic GUICtrlCreatePic(), the following sentence :

"To set the picture control to the same size as the file content, set width and height to 0"

Terrific feature I thought, but a couple of hours later and after dozen of useless tests, trying any kind of picture size/extension or applying any style / extended style, it didn't work.

Then I thought : "why not trying to copy and paste the whole sentence in Google and see where it goes from here ?"
I knew it would return dozen of links referring to the help file but I was lucky enough to find this link, Ticket #3682 reported by anonymous 11 months ago (ticket still opened waiting for a reply) and here is a resume of what anonymous wrote :

...While in AutoIt 3.3.12.0 this worked nice, in 3.3.14.5 this causes the image to be displayed in a 150x150 square...

 

I think this was fixed by @jpm

https://www.autoitscript.com/trac/autoit/ticket/3682

We should wait for @Jon approval, and releasing new version .

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

  • 3 months later...
Posted (edited)

You add browser check for IE only

if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) // IE (4+) only

You can add for FireFox

function ClipBoard(NumBlok) {
    var input = document.createElement('textarea');
    input.innerHTML = NumBlok.innerText;
    document.body.appendChild(input);
    input.select();
    document.execCommand('copy');
    document.body.removeChild(input);
}

Add to online documentation...

universally:

function ClipBoard(NumBlok) {
    var input = document.createElement('textarea');
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) // IE (4+) only
        input.innerText = NumBlok.innerText;
    else
        input.innerHTML = NumBlok.innerText;
    document.body.appendChild(input);
    input.select();
    document.execCommand('copy');
    document.body.removeChild(input);
}

 

Edited by AZJIO
Posted

_WinAPI_SystemParametersInfo() , 4th parameter $iWinIni , help file :

"...$SPIF_SENDCHANGE - Broadcasts the $WM_SETTINGCHANGE message after updating the user profile."

When you read this, you may think that you can't/shouldn't use $SPIF_SENDCHANGE without updating the user profile first, which is wrong. Because an update to the user profile can sometimes be dangerous, so maybe it would be better to indicate this in the help file :

"...$SPIF_SENDCHANGE - Broadcasts the $WM_SETTINGCHANGE message (no matter you updated the user profile or not)"

From MSDN, this link :

WM_SETTINGCHANGE : A message that is sent to all top-level windows when the SystemParametersInfo function changes a system-wide setting or when policy settings have changed.

Applications should send WM_SETTINGCHANGE to all top-level windows when they make changes to system parameters.

An example from Musashi, using $SPIF_SENDCHANGE (value = 2) , followed by a test done just after by lee321987 in this link, using $SPIF_UPDATEINIFILE (value = 1) to make the update permanent.

All this tends to indicate that you can use $SPIF_SENDCHANGE without any fear, because if you do anything wrong during your experimentations with _WinAPI_SystemParametersInfo(), then everything will go fine after a reboot (as the registry won't have been updated)

Imho, $SPIF_SENDCHANGE isn't a dangerous parameter, while $SPIF_UPDATEINIFILE is (especially if you didn't write somewhere the original value of the parameter you mistakenly modified in the registry)

Posted
On 12/5/2020 at 8:16 PM, JockoDundee said:

I feel rather dumb asking this question, but here goes:

Where is the output from the example programs shown in the help?

 

There isn't output listed anywhere, you have to run the programs :) (I get it though, I looked for it too)

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

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
×
×
  • Create New...