Jump to content

au3 runs, compiled does not


Recommended Posts

I am working with a tool that reads templates from txt file and pastes them into wherever you are working 

  • intent - read *.txt file contents, copy to clipboard, then past to location currently being used
  • I have the script working with hotkeys when in IE, np++, word, excel, etc and has worked for past 3 years when using hotkeys
  • use the same script, isolate out the individual section to make au3 of it
  • using a middle mouse button shortcut that points to the file, the au3 works and when compiled it does not and not sure why
  • just playing around, added notrayicon, sleep delays and includes, still working with au3 and not when individual script compiled, txt / au3/ compiled exe files are in same location

Any help and recommendations is much appreciated

Thanks - Todd

4CL01_BACKUP.au3

Edited by toddcbrf2

“Anyone who has never made a mistake has never tried anything new.”― Albert Einstein

Link to comment
Share on other sites

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#NoTrayIcon
TRAYCL01()

Func TRAYCL01()
$TRAYCL01 = FileRead ("4CL01.txt")  ; Check if file opened for reading OK
    If $TRAYCL01 = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
    Sleep(300)
    clipput ($TRAYCL01)
    Sleep(300)
    Send("^v")
    ControlSend("", "", "", ".", 0)
EndFunc   ;==>FileCreate

Spot the difference, TD ;)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

Spot the difference, TD

​I don't see any difference between his and yours.

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

Link to comment
Share on other sites

  • Developers

Hint: The difference is in line 8

Yea right ...  Not sure what you are trying to prove other than that you are as confused as the OP, since there are no differences between what you posted and the OP's code.

@toddcbrf2, are you sure you set the proper WorkDir with the shortcut that shells the compiled script so your script knows where to find the text file?

Jos

 

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

  • Developers

So .. you know as well as I that that must have been a typo while posting or else the code would not have ran at all.   right?
Conclusion as before: Think before typing and stop confusing the hell out of people. ;)

Jos

Edited by Jos

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

Thanks for feedback - you are all right - the '.' (period) was a typo and is not the cause.  No changes are made to the au3 file or to directory/files when compiling so structure isn't different.  

Observations

  •  when run the function from hotkey, works as desired - observe the app (web page, np++, excel ) location where intended template is to be pasted, the app stays activated when the au3 function executes
  • when run from middle click menu, does not work as desired, the app web page, np++, excel, etc) goes inactive for a few seconds, then is active again afterword

It appears that when using another software, the intended active window is deactivated for a second then reactivates after the script is complete

Thanks again for checking it out -  do you think I need to detect active window before executing, do the FileRead, paste to clipboard, re-activate the same window and then paste?  

Edited by toddcbrf2

“Anyone who has never made a mistake has never tried anything new.”― Albert Einstein

Link to comment
Share on other sites

  • Developers

So what exactly doesn't work and where is your compiled version getting stuck?
Add some debugging lines or add the TrayIconDebug option to the script to see what is happening:

Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info

Jos

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

it's when I run the included script - can point to it from several different methods - hotkey from another app or middle mouse menu.  Sorry, I should clarify more - the au3 works as expected but the compiled exe does not - seems like screen activation/timing 

Thanks Jos - will check out the debug

 

“Anyone who has never made a mistake has never tried anything new.”― Albert Einstein

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