Jump to content

Recommended Posts

Posted
#AutoIt3Wrapper_If_Run
    #AutoIt3Wrapper_Run_Au3Check=Y
    #AutoIt3Wrapper_Run_Tidy=Y
#Autoit3Wrapper_If_Compile
    #AutoIt3Wrapper_Run_Au3Check=N
    #AutoIt3Wrapper_Run_Tidy=N
#AutoIt3Wrapper_EndIf

AutoIt3Wrapper has the above ( when not as GUI )

Can a similar be had for AutoIt ?

#Directive_If_Run
    #RequireAdmin
#Directive_If_Compile
    ; highestAvailable
#Directive_If_Something
    ; maybe if_au3, if_exe, etc. Just an idea
#Directive_EndIf

Because if "#RequireAdmin" is there, it will abide by that instead of:
#pragma compile(ExecLevel, highestavailable)
or
#AutoIt3Wrapper_Res_requestedExecutionLevel=highestAvailable

Let it be known that is not a "OMG!, what am I gonna do" kind of thing since we all live with it since always but, it'd be nice to have.

PS: I know that requests are by trac only. So this is a wish for when time permits it.

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

  • Developers
Posted
5 hours ago, argumentum said:

Can a similar be had for AutoIt ?

Not as-is, as AutoIt3 will simply read all directive lines one by one and ignore any KEYWORDS it doesn't recognise.

So the only way it could be possible is that AutoIt3Wrapper would remove the lines that are in an untrue section of the "#AutoIt3Wrapper_If_Run" statement.

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

I know that @Jos, I know. The implementation in the AutoIt3 product would not be script braking.
I don't know how hard/easy would it be to code it or what are the caveats of having that.
Maybe am thinking that is a great idea but didn't take into consideration ... something, I don't know.

Maybe @Jon or @jpm get to look at the post and like the "proposal". I say proposal in quotes because when someone ask me for something I run it in my head and in an instant and I know if it'd be possible or not, and what would it entail. Maybe looking for those conditionals are very taxing, maybe not. Maybe.., I don't know.

I do know that in AutoIt3Wrapper would be very taxing. So, convenience vs. bloat. Don't know if is worth it.
What is nanoseconds in C is milliseconds in script, that I know but again, ...maybe is a bad idea ?, no clue.

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

  • Developers
Posted
1 hour ago, argumentum said:

I do know that in AutoIt3Wrapper would be very taxing. So, convenience vs. bloat. Don't know if is worth it.
What is nanoseconds in C is milliseconds in script, that I know but again, ...maybe is a bad idea ?, no clue.

My bet is that this will be the only option, as implementing this in AutoIt3 will never happen (my educated guess). 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Opened a proper request in trac. I know that a trac is more visible to developers. We'll see. Maybe #HighestAvailable is added instead, or nothing. Who knows.

I tell the people that I code for, that they need to talk to me because I don't use what I put together for them, and if there is a need, how am I to know. So don't be shy and lets converse.
Trac is a better way to talk to the DEVs and now is an open conversation. We'll see.

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

  • Developers
Posted

Try the current beta v25.205.1420.11 of AutoIt3Wrapper. 
Added logic to strip the lines between #Autoit3Wrapper_If_* ---- #Autoit3Wrapper_(End)If(_*) that are not valid for the run and save the source to a temp file to process.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted

It is always possible, but that is not something I will be looking at, as that makes it way too complex and doesn't weight up to the effort I would have to put in. 
Have a go when you want and when done make a proposal for update of Autoit3Wrapper. 😉 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted

The feature is documented in the Helpfile and the autoit3Wrapper.Ini file contains SVN/GIT/HG examples:

[Versioning]
#~ Versioning=SVN/GIT/HG
Versioning=GIT
DiffPGM=C:\Program Files (x86)\WinMerge\WinMergeU.exe
DiffPGMOptions=/wr
Prompt_Comments=y
debug=1

[SVN]
VersionPGM=C:\Program Files\TortoiseSVN\bin\svn.exe
CommandChkVersioning=info "%sourcedir%"
CommandChkVersioning_ok_txt=Working Copy Root Path:
CommandChkVersioning_ok_rc=
CommandStatusSource=status "%sourcefile%" -u
CommandStatusSource_ADD_txt=\?\s*?%sourcefile%
CommandStatusSource_ok_txt=[MA\?][\s\d-]*?%sourcefile%
CommandLogSource=log "%sourcefile%" -l 5
CommandLogSourceLine=(?m)\v+[^\|]*?\|[^\|]*?\|[^\|]*?\|.*\v+(.*?)$
CommandAddSource=add "%sourcefile%"
CommandAddSource_ok_txt=A.*?%sourcefileonly%
CommandAddSource_ok_rc=
CommandCommitSource=commit "%sourcefile%" --message "%commitcomment%"
CommandCommitSource_ok_txt=
CommandCommitSource_ok_rc=0
CommandCommitSource_new_revision=(?i)(?s)committed revision\s*([0-9]*)
CommandGetLastVersion=cat "%sourcefile%"
CommandGetLastVersion_ok_txt=
CommandGetLastVersion_ok_rc=0

[GIT]
VersionPGM=C:\Program Files\Git\bin\git.exe
CommandChkVersioning=status -u no
CommandChkVersioning_ok_txt=
CommandChkVersioning_ok_rc=0
CommandStatusSource=status --porcelain ".\%sourcefileonly%"
CommandStatusSource_ADD_txt=\?\s*?%sourcefileonly%
CommandStatusSource_ok_txt=[MA\?].*?%sourcefileonly%
CommandLogSource=log -n 5 ".\%sourcefileonly%"
CommandLogSourceLine=(?m)commit.*\vAuthor.*\vDate.*\v.*\v+\s*(.*?)\v.*\v
CommandAddSource=add ".\%sourcefileonly%"
CommandAddSource_ok_txt=A.*?%sourcefileonly%
CommandAddSource_ok_rc=
CommandCommitSource=commit "%sourcefileonly%" --message "%commitcomment%"
CommandCommitSource_ok_txt=
CommandCommitSource_ok_rc=0
CommandCommitSource_new_revision=(?m)(?i)(?s)(\[.*\]).*?\v+\s*.*?file.*?changed
CommandGetLastVersion=cat-file --textconv HEAD:./%sourcefileonly%"
CommandGetLastVersion_ok_txt=
CommandGetLastVersion_ok_rc=0
CommandPullSource=pull
CommandPull_ok_txt=
CommandPullSource_ok_rc=0
CommandPushSource=push
CommandPush_ok_txt=
CommandPushSource_ok_rc=0

[HG]
VersionPGM=C:\Program Files\TortoiseHg\hg.exe
CommandChkVersioning=config
CommandChkVersioning_ok_txt=bundle.mainreporoot=
CommandChkVersioning_ok_rc=
CommandStatusSource=status "%sourcefile%" -u
CommandStatusSource_ADD_txt=\?\s*?%sourcefile%
CommandStatusSource_ok_txt=[MA\?][\s\d-]*?%sourcefile%
CommandLogSource=log "%sourcefile%" -l 5
CommandAddSource=add "%sourcefile%"
CommandAddSource_ok_txt=A.*?%sourcefileonly%
CommandAddSource_ok_rc=
CommandCommitSource=commit "%sourcefile%" --message "%commitcomment%"
CommandCommitSource_ok_txt=
CommandCommitSource_ok_rc=0
CommandCommitSource_new_revision=(?i)(?s)committed revision\s*([0-9]*)
CommandGetLastVersion=cat "%sourcefile%"
CommandGetLastVersion_ok_txt=
CommandGetLastVersion_ok_rc=0

So it should be pretty strait forward to use for either tool. I use it mainly for GIT these days, 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted

There are some more changes required for the Change I made so that Tidy & Au3Check will process the proper SourceFIle....    will provide update when ready.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted

Uploaded a new Beta with the following changes:

  • Tidy is ran on the original sourcecode again
  • au3check is first ran on the original code and then on the tempfile when records were stripped
  • autoit3.exe will run the tempfile to be able to have any line in those blocks

that means that source code like this will trigger an error on the Tempfile on RUN as the "Global $a = 2" line is stripped on RUN;
 

#AutoIt3Wrapper_If_Run
    #AutoIt3Wrapper_Run_Au3Check=Y
    #AutoIt3Wrapper_Run_Tidy=Y
#Autoit3Wrapper_If_Compile
    #AutoIt3Wrapper_Run_Au3Check=N
    #AutoIt3Wrapper_Run_Tidy=N
    #pragma compile(x64, false)
    Global $a = 2
#AutoIt3Wrapper_EndIf

ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $a = ' & $a & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

but this will work fine

Global $a = 0
#AutoIt3Wrapper_If_Run
    #AutoIt3Wrapper_Run_Au3Check=Y
    #AutoIt3Wrapper_Run_Tidy=Y
    $a = 1
#Autoit3Wrapper_If_Compile
    #AutoIt3Wrapper_Run_Au3Check=N
    #AutoIt3Wrapper_Run_Tidy=N
    #pragma compile(x64, false)
    $a = 2
#AutoIt3Wrapper_EndIf

ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $a = ' & $a & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

.. and produce the output: "@@ Debug(10) : $a = 1"

There are probably still some things that I missed and need to be considered, so do some proper testing pls.

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_If_Run
;~  #RequireAdmin
#Autoit3Wrapper_If_Compile
;~  #RequireAdmin
#AutoIt3Wrapper_EndIf

Exit Test()
Func Test()
    Local $sStr = ""
    $sStr &= "IsAdmin: " & (IsAdmin() ? "Yes" : "No") & @LF & @LF
    $sStr &= "@ScriptFullPath >" & @ScriptFullPath & "<"
    MsgBox(262144 + 64, @ScriptName, $sStr, 60)
EndFunc

This is my test code.
My aim was to RunAsAdmin from within the script via a #RequireAdmin but to compile it as highestAvailable. Since I constantly forget to comment out the #RequireAdmin before compile, I was looking at solving that. That did not get solved but is something better implemented ( overlord willing ) in AutoIt3 than the wrapper.

But I believe that am done with that script that needed highestAvailable. It was needed because the program that am interacting with behaves in that way. UAC is off but on a regular user, it would ask for an admin password otherwise, and an admin user would not run sufficiently elevated, hence the use of highestAvailable.

So I think that is better to wait some time to see if the trac gets traction for my wish.

FileCreateShortcut ( "file", "lnk" [, "workdir" [, "args" [, "desc" [, "icon" [, "hotkey" [, icon number [, state]]]]]]] )

is what we have but there are more settings that should be able to set:
image.png.7835131ea39d754814bc0668e4c0953f.png

and that approach would be better than rewriting the script in regards of run as admin or not.
The wrapper could evaluate if can elevate and based on that set the link accordingly.
Finding a way to set the advanced properties in a link is something that I never looked for. I have no idea of how to do that.

Edit: according to stackoverflow the info to manipulate the LNK file is at "[MS-SHLLINK]: Shell Link (.LNK) Binary File Format" but the short answer was:

$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\ColorPix.lnk")
$Shortcut.TargetPath = "C:\Program Files (x86)\ColorPix\ColorPix.exe"
$Shortcut.Save()

$bytes = [System.IO.File]::ReadAllBytes("$Home\Desktop\ColorPix.lnk")
$bytes[0x15] = $bytes[0x15] -bor 0x20 #set byte 21 (0x15) bit 6 (0x20) ON
[System.IO.File]::WriteAllBytes("$Home\Desktop\ColorPix.lnk", $bytes)
...
In short, you need to read the .lnk file in as an array of bytes. Locate byte 21 (0x15) and change bit 6 (0x20) to 1. This is the RunAsAdministrator flag. Then you write you byte array back into the .lnk file.

 

Edit2: PowerShell hack-ish thing:

powershell "$bytes = [System.IO.File]::ReadAllBytes('AutoIt3_x64_RunThis.lnk') ;$bytes[0x15] = $bytes[0x15] -bor 0x20 ;[System.IO.File]::WriteAllBytes('AutoIt3_x64_RunThis.lnk', $bytes)"

a one liner that does it.

Edit3:
So "#AutoIt3Wrapper_Run_HighestAvailable=y" would be a good name for it.
The user would not use #RequireAdmin because the user purposefully added the #AutoIt3Wrapper_Run_HighestAvailable=y, meaning that the user knows what they are doing ( hopefully ).

Edited by argumentum
more

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

  • Developers
Posted
1 hour ago, argumentum said:

Edit3:
So "#AutoIt3Wrapper_Run_HighestAvailable=y" would be a good name for it.

Or you try checking the docs first!

hint:#AutoIt3Wrapper_res_requestedExecutionLevel=

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

#AutoIt3Wrapper_res_* is for resources so, I figure that #AutoIt3Wrapper_Run_* sounds good but yes, those are for compilation and not for when the script runs.
Maybe #AutoIt3Wrapper_Load_HighestAvailable by itself.

6 hours ago, Jos said:

Have a go when you want and when done make a proposal for update of Autoit3Wrapper. 😉 

That's a better idea for clearly communicating why I chose that name and how I think it should work. I'll have something by Wednesday.

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

  • Developers
Posted
5 minutes ago, argumentum said:

#AutoIt3Wrapper_res_* is for resources so, I figure that #AutoIt3Wrapper_Run_* sounds good but yes,

...and where do you think that setting for HighestAvailable is stored?

It is a resource setting hence the name and that's not changing.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
1 minute ago, Jos said:

It is a resource setting

Is more of a condition than a setting, in the behavior of the script, compiled or not.
When compiled, it is declared in the manifest, but when not compiled, all it takes is to see if the user can elevate or not. If not, it runs as user, but if the user can elevate, then make the "RunAs" request.

Therefore the use of the name is for different purposes, the one already stablished is for compilation, the new one I propose ( and could be named anything ) is for running the script from SciTE and behaving as the execution level would have been, when "highestAvailable" is desired, even if not compiled.

This is useful in a muti-user OS, were a user is limited and another has admin rights. Coding in such environment would benefit from having the option in the editor and keeping the script  as is while running the same file but under different users. Is a niche scenario but the one I was in, as is handy to test behavior under different user levels.

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

  • Developers
Posted
17 minutes ago, argumentum said:

Is more of a condition than a setting, in the behavior of the script, compiled or not.

No it is not. Please stop arguing and try to understand that these setting are part of the PE header manifest resource.

So as I already stated: these directives have a logical name and will not be changed.

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...