Jump to content

About (running) limitations


Deye
 Share

Recommended Posts

Hi there

I need an idea concerning a custom way to to run a script from scite

1.*  So I'd start the script with a few more udfs in the path
* When the script starts I will want to copy @ScriptFullPath to the temp\@ScriptName
Then straight away exit|run temp\@ScriptName without the need copy all needed includes to the temp\ path

2. Perhaps away so that the main script file won't stay open in scite (as " file is open") so that (just for instace) i will be able  to write something in to it

Any idea @solving either limitations
 

Link to comment
Share on other sites

What a mess, the only way to run a script from anywhere where the includes (udf's) are not present, is to change the script in the includes path to include the path where said udf's are. Meaning, you could create a script that creates a new file, very similar to the original script, with the correct includes paths, and then maybe create a batch file that starts the temp script, and then you can close the running script.

What a mess.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

16 minutes ago, careca said:

the only way to run a script from anywhere where the includes (udf's) are not present, is to change the script in the includes path to include the path where said udf's are.

Not exactly. There is a special registry value that can be created at "HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt" called "Include". It should be a REG_SZ (string) value. The contents of this value are a semi-colon delimited list of directories that should be searched for files when resolving #include's in addition to the standard locations.

Link to comment
Share on other sites

Ah, nice, didn't know about that.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

  • Developers
11 minutes ago, Nine said:

The contents of this value are a semi-colon delimited list of directories that should be searched for files

...which can also be reviewed and modified in SciTEConfig. :) 

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

Link to comment
Share on other sites

19 minutes ago, Jos said:

...which can also be reviewed and modified in SciTEConfig.

...or change at runtime before the #include are performed, based on an .ini file  :)

Link to comment
Share on other sites

@First I thought tried something that seemed to have worked

So now whats with this :

#include "test.au3" ;if "test.au3" doesnt exist first run this With this line commented Then remember To uncomment For the test

If @ScriptDir = @TempDir Then Exit MsgBox("", "", @TempDir)

$f = "test.au3"
FileOpen($f, 2)
FileClose($f)

FileCopy(@ScriptName, @TempDir)

Local $address = "HKEY_CURRENT_USER\SOFTWARE\AutoIt v3"
Local $s = RegRead($address, "Include")
If @error Then
    RegWrite($address, "Include", "REG_SZ", @ScriptDir & ";")
Else
    If Not StringInStr($s, @ScriptDir) Then
        $s &= @ScriptDir & ";"
        RegWrite($address, "Include", "REG_SZ", $s)
    EndIf
EndIf
MsgBox(0, $address, "Include = " & @CRLF & $s)

Exit Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@TempDir & "\" & @ScriptName), "", @SW_HIDE)

 

Edited by Deye
Link to comment
Share on other sites

...I see.  Not so much of a good idea then...:ermm:

But with a first script that sets the registry and then runs another script with #include like @Deye proposed, it is working perfect...

Edited by Nine
Link to comment
Share on other sites

I didn't make any fancy stuff (just a POC).  I manually delete the registry key value before starting the first script, and it working fine.  If I run the second script alone (after deleting the registry key) it doesn't work stating that the includes doesn't exist. 

First script :

RegWrite ("HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt","include","REG_SZ", "C:\Apps\AutoIt\BlockInput")
Exit Run (@AutoItExe & " /AutoIt3ExecuteScript Test.au3")

Second script :

#include <BlockInputEx.au3>

_BlockInput ($BI_DISABLE)
Sleep (10000)
_BlockInput ($BI_ENABLE)

If you want to run this, look inside my sig for that UDF.

Link to comment
Share on other sites

And Again everything stopped working even the example above will throw that same error 

A very similar to my main script environment,  Will this example still run for you:

#include <WinAPIFiles.au3>
#include "Test_Tuner_.au3" ;if "Test_Tuner_.au3" doesnt exist first run this With this line commented Then remember To uncomment For the test

If @ScriptDir = @TempDir Then Exit MsgBox("", "", @TempDir)

Local $sInclude = '' _
         & '#include-once' _
         & @LF & '#include <StaticConstants.au3>' _
         & @LF & '#include <WindowsConstants.au3>' _
         & @LF & '#include <GUIConstants.au3>' _
         & @LF & '#include <GUIConstantsEx.au3>' _
         & @LF & '#include <EditConstants.au3>' _
         & @LF & '#include <WinAPISysWin.au3>' _
         & @LF & '#include <ProgressConstants.au3>' _
         & @LF & '#include <AVIConstants.au3>' _
         & @LF & '#include <TreeViewConstants.au3>' _
         & @LF & '#include <GuiComboBox.au3>' _
         & @LF & '#include <WinAPIDlg.au3>' _
         & @LF & '#include <File.au3>' _
         & @LF & '#include <GuiMenu.au3>' _
         & @LF & '#include <Misc.au3>' _
         & @LF & '#include <String.au3>' _
         & @LF & '#include <Date.au3>' _
         & @LF & '#include <WinAPIGdi.au3>' _
         & @LF & '#include <GuiTab.au3>' ;_
;~       & @LF & '#include "ColorChooser.au3"' _
;~       & @LF & '#include "FontSelect.au3"'


$f = "Test_Tuner_.au3"
If Not FileExists($f) Then
    $h = FileOpen($f, 2)
    FileWrite($h, $sInclude)
    FileClose($f)
EndIf

FileCopy(@ScriptName, @TempDir, 1)
If _WinAPI_FileInUse(@TempDir & "\" & @ScriptName) Then Exit MsgBox("", "", "the file " & @TempDir & "\" & @ScriptName & @CRLF & " is open cannot continue the test")
If _WinAPI_FileInUse($f) Then Exit MsgBox("", "", "the file " & $f & @CRLF & " is open cannot continue the test")


Local $address = "HKEY_CURRENT_USER\SOFTWARE\AutoIt v3"
Local $s = RegRead($address, "Include")

If @error Then
    RegWrite($address, "Include", "REG_SZ", @ScriptDir & ";")
    $s = @ScriptDir & ";"
Else
    If Not StringInStr($s, @ScriptDir) Then
        $s &= @ScriptDir & ";"
        RegWrite($address, "Include", "REG_SZ", $s)
    EndIf
EndIf
MsgBox(0, $address, "Include = " & $s)

Exit Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@TempDir & "\" & @ScriptName), "", @SW_HIDE)


;~ AutoIt Error
;~ ---------------------------
;~ Line 2  (File "C:\Users\user\AppData\Local\Temp\About_running_limitations.au3"):

;~ #include "Test_Tuner_.au3"

;~ Error: Error opening the file.

 

Edited by Deye
Link to comment
Share on other sites

Link to comment
Share on other sites

Well, I did not test your script cause I do not understand the underlying goals.  When testing simple code that cleans and rewrites the registry 100 times. Got no problem.  IDK you way want to rethink your approach.

Link to comment
Share on other sites

@just leaving it here, its still be interesting  to know what is the underlining cause that make this tweak stop working  at any time

I needed this to work with guictrltuner_limitlessau3 where one copy of the script needs run from @tempDir another from @scriptDir &"\saveprogress" dir not together

running with this configuration somehow messes up the tweak so that even the simple example won't work any more

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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