Jump to content
satanico64

consolewrite extended fonctionnality, jump to file.

Recommended Posts

satanico64

Hi guys ! nice to see you again !

Here it is:

In my scripts, i use several include files. (about 20).

For debugs, i would like to use ConsoleWrite('(5) : Clic pour aller à la ligne.' & @crlf  )

But it only jump in the file currently opened. ( i have about 10 au3 file opened in scite, and if i click, it jump to line 5 of the current one ). :mad:

It would have be nice to ask: ConsoleWrite('(5,awesomefile.au3) : Clic pour aller à la ligne.' & @crlf  ). Or simply it would go to the line 5 of the script where the command was.

 

Have you found a tip for that ?

 

thanks !

have fun

\,,/  Nicolas  \,,/

Share this post


Link to post
Share on other sites
Marcelos

HI Satanico64:

I have found this workaround .

ConsoleWrite(@ScriptDir  &  '\myfile.au3('  &  @ScriptLineNumber  &  ',1) : WARNING: '  &  @crlf )

Share this post


Link to post
Share on other sites
Jos

I have found this workaround .

ConsoleWrite(@ScriptDir  &  '\myfile.au3('  &  @ScriptLineNumber  &  ',1) : WARNING: '  &  @crlf )

It is much easier to load the Full SciTE4AutoIt3 version and do Alt+d on the given variable or Functions.
One caveat with your ConsoleWrite line is when the filename contains spaces or brackets.  That is why I have put double quote support around the filename in my version of SciTE, and added those to Tidy and au3check. 

ConsoleWrite('"' & @ScriptDir  &  '\myfile.au3"('  &  @ScriptLineNumber  &  ',1) : WARNING: '  &  @crlf )

Jos

  • Like 1

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Exit

It is much easier to load the Full SciTE4AutoIt3 version and do Alt+d on the given variable or Functions.

@Jos     I like the Alt+d    Question: Is it possible to add the @extended value to the consolewrite? Where to alter the property file?
 


My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites
Jos

These are the defaults defined in au3.properties:

## Debug Output Options (to permanent change your selection copy them to SciTEUser.Properties and change it there
# Debug MessageBox Option 2="All"  1="No @extended"   0="No @extended & @error".
debug.msgbox.option=0
# Debug Console Option    3="All"  2="No SystemTime"  1="No SystemTime & Return"  0="No SystemTime, Return & Error".
debug.console.option=1
# Debug Trace Option      3="All"  2="No SystemTime"  1="No SystemTime & Return"  0="No SystemTime, Return & Error".
debug.trace.option=1
# extra propery used by AutoItAutoComplete.LUA to totally disable AutoComplete when set to 1

So just copy this line and put that in your SciTEUser.properties:

# Debug Console Option    3="All"  2="No SystemTime"  1="No SystemTime & Return"  0="No SystemTime, Return & Error".
debug.console.option=3

Jos

  • Like 1

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Marcelos

Hi

ALD+D is not useful if you have many files, and the consolewrite is in a file that is not the main .

when I do ALD+d ( and im using the full SciTE4AutoIt3  version) I get

ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hFile= ' & $hFile& @crlf ) 

the script name is not added, and even if I edit the properties file, to add @scriptdir or  @ScriptFullPath    is the main au3 file  that the script runs.

correct me if im wrong

thanks

Share this post


Link to post
Share on other sites
Jos

Correct, it's intent is to do debugging and doesn't add file info as that is not needed in most cases.
You are welcome to make any modifications you want personally. ;)

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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

  • Similar Content

    • boomingranny
      By boomingranny
      Use this UDF to add a console gui to your script (with log file):
      It uses the Hidden Autoit window (that you probably didn't even know existed)
      Closing Console window will terminate script.
      example of console:

      #include-once #include <GuiEdit.au3> EnableConsoleGui("example.log") ;example: ;------------------------ ConsoleWrite ("Hello World") For $i = 1 To 10 ConsoleWrite (".") Sleep(200) Next ConsoleWrite ("done") ConsoleWrite(@CRLF) ConsoleWrite ("close me to exit"&@CRLF) While 1 Sleep(1000) WEnd ;------------------------ ;end of example code Func EnableConsoleGui($Logfile="") ;EnableConsoleGUI ;by Daniel Barnes 20/04/2018 ;Uses AutoIt's Hidden window as a console (output only) Global $pidChild ;if we don't have a parent (as the parent window would have our script name) If Not WinExists(StringTrimRight(@ScriptName,4)) Then Opt("TrayIconHide",1) ;get Autoit's hidden window handle local $hWnd = WinGetHandle(AutoItWinGetTitle()) ;move the autoit hidden window to the middle of the screen WinMove($hWnd, "", (@DesktopWidth / 2) - 250, (@DesktopHeight / 2) - 250, 500, 500) ;get the Handle of the edit box in Autoit's hidden window $hEditBox = ControlGetHandle($hWnd,"","[CLASS:Edit; INSTANCE:1]") ;show it WinSetState($hWnd, "", @SW_SHOW) ;set its title = our script name WinSetTitle($hWnd,"",StringTrimRight(@ScriptName,4)) ;Spawn a child "copy" of the script, enabling reading of its console... If @Compiled Then ;2 = $STDOUT_CHILD. This avoids requiring the AutoItConstants.au3 in this sample code $pidChild= Run( FileGetShortName(@ScriptFullPath),@ScriptDir,"",2) Else ;2 = $STDOUT_CHILD. This avoids requiring the AutoItConstants.au3 in this sample code $pidChild= Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath),@ScriptDir,"",2) EndIf OnAutoItExitRegister("EnableConsoleGui_CloseChildPID") ;read the console, while the child window exists (and the console window is visible) While ProcessExists($pidChild) $ConsoleRead = StdoutRead($pidChild) If $ConsoleRead then $text = StringLeft(ControlGetText($hWnd,"",$hEditBox),65535) If $Logfile Then FileWrite($Logfile,$ConsoleRead) $text &= $ConsoleRead ControlSetText($hWnd,"",$hEditBox,$text) ConsoleWrite($ConsoleRead) ;scroll to bottom of console edit window _GUICtrlEdit_SetSel($hEditBox, 65535, 65535) endif Sleep(250) WEnd exit endif EndFunc Func EnableConsoleGui_CloseChildPID() ;if this func isn't used ;when you close the console gui ;the child "clone" of your script will keep running ProcessClose($pidChild) EndFunc
    • fosil
      By fosil
      Hi everyone.

      I'm currently working a program that constantly prints out log files through "consolewrite" and the "#AutoIt3Wrapper_Change2CUI=y" wrapper.

      Part of this program requires me to run a batch script.

      My issue is the batch script launches from the same window as consolewrite. I need the batch file to be launched through a different window as currently this causes an issue with the logs (which need to be very precise) but also causes the batch file to produce some funny behavior...

      Does anyone know how I can force the file to run on a second DOS window?

      Thanks in advance!!!
       
      Edit: Im using the "run" command if that helps. I tried "shellexecute" but that seemed to not launch the batch scripts at all.
    • rcmaehl
      By rcmaehl
      I might be doing something wrong but I'm running a CUI compiled application in Powershell ISE and it's not outputting unicode characters in the console. I for a fact Powershell ISE supports unicode so I'm thinking it's something with AutoIt. Does ConsoleWrite just not output Unicode? Do CUI compiled applications run inside the old Windows Console when executed through Powershell? is there something else preventing this?
    • Reizvoller
      By Reizvoller
      Hello!
      So I have a little script here 
      Func getThe () Local $nearPix = 0123 Local $winPos = WinGetPos ($workWin) FFSaveBMP ("yBarPosArea", "True" , 600, 239, 600, 555, 30, $workWin) $nearPix = FFNearestPixel (600, 220, "0xC1C1C1" , False, $workWin) If $nearPix == 0123 Then ConsoleWrite ("No val for NearPix") ElseIf $nearPix <> 0123 Then ConsoleWrite ("Val is there") ConsoleWrite ($nearPix[0]&","&$nearPix[1]&@CR) EndIf EndFunc And when it comes time to run it I get a return of 
      When it says "non-accessible variable" , what is it meaning by that? The scope is "Local" and it is within the same function. The variable was even referenced in the step right before the one throwing the error. Any insight would be thoroughly appreciated. Thank you!
    • BinaryBrother
      By BinaryBrother
      Here is my code. Adopted from a post UEZ made.
      _GenerateUID() Func _GenerateUID() Local $lReturn, $lDriveSerial,$lRandomSeed = "" Local $lChr[2] For $N = 1 To 32 $lChr[0] = Chr(Random(65, 90, 1)) ;A-Z $lChr[1] = Chr(Random(48, 57, 1)) ;0-9 $lRandomSeed &= $lChr[Random(0, 1, 1)] Next $lDriveSerial = DriveGetSerial(StringLeft(@WindowsDir, 3)) $lReturn = StringToBinary($lRandomSeed & $lDriveSerial) ConsoleWrite($lReturn) ;<--- Is printed as a String. ConsoleWrite(@CRLF & $lReturn & @CRLF) ;<--- Printed properly as Binary? Return $lReturn EndFunc ;==>_GenerateUID Output:
      --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop V9P03Y144OZW38YC80IW1IJXWH4003501486415223 0x5639503033593134344F5A57333859433830495731494A58574834303033353031343836343135323233 +>10:40:52 AutoIt3.exe ended.rc:0 +>10:40:52 AutoIt3Wrapper Finished. >Exit code: 0 Time: 0.544
      Whenever ConsoleWrite is fed pure binary, it will output it as a string. Whenever a string is mixed with the binary, it outputs the binary as binary.
      I found this especially confusing when I consulted the Help Documents for an answer...
       
      I'm sure I'm missing something, as usual. As always, thanks for your time!
×