Jump to content

JohnSAutoIt

Active Members
  • Posts

    35
  • Joined

  • Last visited

JohnSAutoIt's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Guiness, BrewMan, is there a pattern here? Wow, that's some code. I don't know how you guys dream that stuff up. Nice to know thanks. I'll probably stick with my WinActivate and ^v, ^c which also seems to be highly adaptable to any other programming editor or text application. Even with error trapping it's only about 4 lines. I find the other snippet holders way to complicated. Mine is very basic and I only have about a dozen snippets. Perhaps that's a measure of my programming IQ.
  2. I believe I've found the cause of the problem though I can't explain it. As I've been working on my Snippets script, I've been testing by hitting Tools - Go. That opens my Snippet GUI and I've then checked it out in conjunction with the SciTE editor. What I have found since is that if I compile the script into an exe and start the script by double-clicking the exe, it works fine with the "SciTE" window title matching and any script listing in the editor including unsaved ones.
  3. I've written a simple snippet holder that works fine with my common scripts that are in a fixed path, say c:\myscripts\autoit. To paste the snippet I copy the selected code to the clipboard then use: Opt("WinTitleMatchMode", 2) WinActivate("myscripts\autoit") Send("^v") The problem arises when I'm trying to paste into a script from another folder or a new unsaved script. The only constant in the window title for the SciTE editor is "SciTE". A typical full title would be C:\myscripts\autoit \Snippets.au3 - SciTE [1 of 4] A typical full title for an unsaved script would be (Untitled) * SciTE [3 of 4] If I use "SciTE": Opt("WinTitleMatchMode", 2) WinActivate("SciTE") Send("^v") it does not work and I have no idea why. This code will work for one of my regular scripts or an Include file I am editing (different folder path) but not for an unsaved script. I tried using handles but that did not work either. Anyway, I'm more interested in finding out why the above does not work.
  4. Thanks for the tip. I've been using _FileListToArray. In order to use the posted UDF I'll have to start from scratch reading into a 2D array (name and size) but that's fine.
  5. I've written a script to catalog DVDs to text file, though it will do any file tree. It list folders, files and the file sizes. It is based on using the _FileListToArray and FileGetSize functions, working through the selected tree. With disks it is slow going when you have 40-50,000 files in the tree. It is however comparable in speed with the commercial software I have been using (emulating their format) and more accurate. When you browse any file tree using Windows Explorer or in my case Directory Opus, all the information is visually available in a fraction of the time, including a complete *.* file listing. Isn't there some means of tapping into that almost instant information? Is the bottleneck simply the time taken to move the information to where you want it? The file listing is fairly quick. Getting the file sizes seems to take the most time. The _FileListToArray function in the File.au3 is purely related to path. I suppose one could add the FileGetSize at that stage rather than later?
  6. A belated resolution FYI based on Funkey's suggestion: Case $GUI_EVENT_MINIMIZE GUISetState(@SW_HIDE) TraySetState(1) ; show TraySetToolTip("AutoIt Scripts") Case $GUI_EVENT_CLOSE Exit EndSwitch If BitAND(WinGetState("AutoIt Scripts"), 16) Then GUISetState(@SW_HIDE) ; hide TraySetState(1) ; show EndIf I found that the GUISetState and the TraySetState lines had to be in that order. Now the window minimizes to tray even when it's by an external operation such as Win+D
  7. I resolved the problem - I should have been using ControlFocus - the pane is a control not a window.
  8. I'm trying to activate one pane of a window but I cannot get it to work. I've extracted the info using the Info Tool; window name from the Basic Window Info and class/instance from the Advanced Mode item WinActivate("[TITLE:Macro Express Pro - Explorer; CLASS:TcxGridSite; INSTANCE:1]", "") Using the TITLE property alone activates the entire window OK.
  9. I think I see the intent of using WinSetState. I tried it but still had the problem that the task bar item was unresponsive. I added a Function so I could monitor the window state. It seemed to follow what one would expect when Win+D activated, WinGetState was 23 so it was being seen as minimized, enabled etc. I resolved the problem by adding the WinGetState line: Case $GUI_EVENT_MINIMIZE GUISetState(@SW_MINIMIZE) GUISetState(@SW_HIDE) TraySetState(1) ; show TraySetToolTip("AutoIt Scripts") Case $GUI_EVENT_CLOSE Exit EndSwitch If BitAND(WinGetState("AutoIt Scripts"), 16) Then TraySetState(1) ; show WEnd Func SpecialEvent() ; restore from tray GUISetState(@SW_RESTORE) GUISetState(@SW_SHOW) TraySetState(2) ; hide EndFunc ;==>SpecialEvent That ensures the tray icon is visible when the GUI is minimized by whatever means. If externally minimized, the task bar item appeared as well as the tray icon but I can live with that (not a normal situation). I tried Melba23's lines on top of that addition - it did not immediately improve things so I called it a day. It's now usable. Thanks all.
  10. Thanks for the tip on AutoItWinGetTitle which I've never heard of! Your edit did what you described . Perhaps I was not specific enough - when I noted it minimized to the taskbar, that was it, no tray icon. With no presence on the GUI I have to close the process. Edit: The original GUI Create was as follows: $Input1 = GUICreate("AutoIt Scripts", 300, 630, 100, 60, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
  11. I have a GUI that minimizes to the tray. I used some code found in the forum that works fine with the GUI. However, if the GUI is minimized by other scripts or by Win+D, it minimizes to the Task Bar and does not respond other than right-click/close. The minimize and restore parts of the GUI are: Case $GUI_EVENT_MINIMIZE GUISetState(@SW_MINIMIZE) GUISetState(@SW_HIDE) TraySetState(1) ; show TraySetToolTip("AutoIt Scripts") Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func SpecialEvent() ; restore from tray GUISetState(@SW_RESTORE) GUISetState(@SW_SHOW) TraySetState(2) ; hide EndFunc ;==>SpecialEvent Clearly it needs some lines to cope with these external/Windows instructions but I have no idea how to define them.
  12. I thought I understood the example code but it does not work as I had thought. On "advance" it is not skipping the lower part of the loop. I added the hotkey and a short sound file to test in realtime. Global $Advance = 0 HotKeySet("{RIGHT}", "Advance") MainScript() Func MainScript() For $iSeq = 1 To 20 If $Advance Then $Advance -= 1 ContinueLoop EndIf Sleep(1000) For $k = 1 To 5 Step 1 ; 10 per sec Sleep(100) Next SoundPlay(@WindowsDir & "\media\ding.wav", 0) ;~ MsgBox(0, "main", "$k = "&$k &" $iSeq= "&$iSeq) Next EndFunc ;==>MainScript Func Advance() $Advance += 1 EndFunc ;==>Advance If the script is started running, you get a ding every 1.5 secs. If you repeatedly "advance" say every 1/2 sec then the sound file should not run until 1.5 secs after the last "advance" is pressed. What I am finding is that the sound file runs every 1.5 secs regardless. What am I missing? (Edit) I think I have found the problem. After hitting "Advance" the script whips back through the loop and passes into the lower part of the loop. I moved the Sleep(1000) above the ContinueLoop statement which seemed to improve things by holding the script until the next "Advance" command, if within 1 sec. The commands don't do exactly what I'm looking for but if my latest interpretation is correct I should be able to figure things out. (Edit2) Although the final resolution is OT for the thread title, I have finally sorted out a working loop: Global $Advance = 0 HotKeySet("{RIGHT}", "Advance") MainScript() Func MainScript() For $iSeq = 1 To 20 ; a bunch of doing stuff in here based in $iSeq value MsgBox(0, "Sequence #", "$iSeq = " & $iSeq) For $k = 1 To 10 If $Advance Then $Advance -= 1 ContinueLoop 2 ;skip to "For $iSeq" EndIf Sleep(200) Next Next EndFunc ;==>MainScript Func Advance() $Advance += 1 EndFunc ;==>Advance Normally the loop runs every 2 secs (10*200msecs). If "Advance" hit, the timing loop ($k counter) is broken and the script returns to the "For $iSeq" loop. $iSeq is incremented and the timing loop starts again (to be interrupted by the next "Advance" if applied).
  13. Thanks for the examples. They were a lot clearer than those in Help; one script at a time.
  14. As I intimated in the first post I had assumed that anything declared Global was valid throughout the script. That's what I had in place. Confirmed by you. The intention of the loop counter $iSeq change in Advance() was to increment it. I was not using it for any other purpose. Originally I had used $i but changed to $iSeq to ensure it was unique.
  15. I've read the Help but it does not explain what parameters have to be passed to a Func and those that don't (Help calls Func "a user-defined function that takes zero or more arguments"). I've also looked at examples and can't find a pattern. I assume that anything Global should be passed without doing anything? I had a script that worked fine. Both $iSeq and $k are passed from Advance() into main script when it resumes. Condensed version: HotKeySet("{RIGHT}", "Advance") ......main script For $iSeq = $iStart To $FileList[0] Step 1 ....bunch of other stuff For $k = 1 To 5 Step 1 ; 5 per sec Sleep($ImageTime200) Next Next .......end of main script Func Advance() .....bunch of other stuff $iSeq = $iSeq + 1 $k = 1 EndFunc ;==>Advance I split into more Funcs to get: HotKeySet("{RIGHT}", "Advance") MainScript() Func MainScript() For $iSeq = $iStart To $FileList[0] Step 1 ....bunch of other stuff For $k = 1 To 5 Step 1 ; 5 per sec Sleep($ImageTime200) Next Next EndFunc ;==>MainScript Func Advance() .....bunch of other stuff $iSeq = $iSeq + 1 $k = 1 EndFunc ;==>Advance The code in Advance() works fine (interrupting MainScript() ) but does not pass the values $iSeq and $k into MainScript() when it resumes.
×
×
  • Create New...