Jump to content

KJohn

Active Members
  • Posts

    450
  • Joined

  • Last visited

Profile Information

  • Location
    USA

Recent Profile Visitors

1,297 profile views

KJohn's Achievements

Universalist

Universalist (7/7)

1

Reputation

  1. KJohn

    neoSearch

  2. Replace this in your code: If @error = -1 Then ExitLoop with this: If @error Then ExitLoop and see what happens.
  3. Windows created with the $WS_POPUP style have the annoying feature of not minimizing like other windows when you click on their taskbar button (when they are the currently active window). I was thinking of getting around this by registering a function which minimizes the window against the appropriate windows message using GuiRegisterMsg(). I've cracked my head trying to figure out which of the window messages listed in the help file is the one I want. I've tried anything that could remotely sound like what I want, and no luck. It's impractical to test against each and every one of those window messages, so if anyone knew what the message code that I am looking for is, I'd be really grateful. (or alternatively, another solution to the issue I'm trying to solve would do just fine). Thanks!
  4. I have updated the first post with important information, please read that first. I am not sure how to do that but I know this is a file system problem that Windows itself is unable to work around. And consequently AutoIt.Most notably, any string with a space in an autorun field or even the run dialog box pointing to the partition where paths with spaces in them were created while 8dot3 was disabled fails. This is one possible solution. ShellExecute works perfectly without the extra quotes. I understand the parameter thing but from what I've understood so far, I think FileGetShortName will fail because there are no alternative shortnames stored in the file system if 8dot3 was set to disabled when the relevant path was created. And exactly why this is happening is detailed in the first post.
  5. But this is breaking my applications that used to run perfect in Vista! It is ridiculous to sit and code around this - I can do it but what kind of a solution is that for something so fundamental!
  6. I recently installed Windows 7 Professional RTM which I got from MSDN AA. There is this problem that I'm facing and I'm unable to figure out what exactly I need to fix: Take this path: C:\Users\Koshy John\example.exe Let's suppose the file exists: - FileExists("C:\Users\Koshy John\example.exe") returns 1 - Run("C:\Users\Koshy John\example.exe") fails. But Run('"C:\Users\Koshy John\example.exe"') will succeed - note the quotes and the space in the path. The only thing I can think of that could cause this behavior is turning off 8.3 filenames (I think they are disabled by default on each drive separately, I just changed that to a global behaviour. I turned it on again but with no avail.) Do you remember any other setting within Windows that could cause this sort of behaviour? Or is it something wrong with AutoIt on Windows 7? I don't mind "fixing" my code to take care of this problem but what sort of behaviour would extra quotes have on older operating systems? UPDATE: It is a file system problem. I rebooted into vista to check and only paths with spaces on my D: (where Windows 7 is installed) require me to enter quotes. It is not an AutoIt problem but if you know of a solution, let me know. I do wonder though: how can autoit play safe if such a situation arose randomly on one of the many machines it encountered? UPDATE2: After enabling 8dot3 on D:, I created a folder with a space in it and tried running an executable stored within it (without quotes), and it worked! But none of the older paths created when 8dot3 was disabled work without quotes (and that means just about everything else because Windows 7 turns off 8dot3 filename creation by default). I thought 8dot3 was for legacy applications and not for fundamental things like the Windows Run dialog (both Vista and 7)! Now you must be wondering why I am not required to enter quotes on C: even though 8dot3 has been disabled, that is because it is enabled by default on Vista and most of the folders already had alternative 8dot3 names stored in the file system by the time I disabled it. But on the other hand, Windows 7 (and Windows 2008) starts off it's installation with 8dot3 disabled by default leading to none of the folders created before re-enabling 8dot3 having alternative shortnames at all! I hope I have brought more clarity to the situation... Update3: ShellExecute works perfectly without quotes, just like fileexists. While Run continues to fail without quotes. I now think this must be taken to the AutoIt developers - would moving this topic to developer chat help?
  7. Thanks for the reply. That's the idea but I'm looking for slightly more complex code than that. Where did you find this by the way?
  8. I am doing an Advanced Software Engineering paper (revolving around Design patterns), and one of the things we do is take turns finding actual code (C#,C++,Java) in the wild (like on Google code search) and discuss it. Please note that this is different from simple example code found on "helpful" websites. My problem is that I am not adept at using Google code search to find what I am looking for since I am looking for something very abstract (pun unintended) - an "idea" if you will. The problem is that rarely is it ever explicitly mentioned that an Abstract Factory is being used in the code as a comment so it can't really be searched for. You can give me a fish: if you can link me to code in the google code repository (which uses the abstract factory pattern), and/or teach me to fish (which is what I really prefer). My presentation on Abstract Factory is over but I do not want the collective effort of compiling examples to weaken because of my inexperience. So if you could help me in some way, I'd be really grateful.
  9. Actually, if one of the mods just used this to update the code, rezip it and replace the file in the downloads section, people downloading that program will not get frustrated (there are 126 files to update!).
  10. You can get BrainPain here at: http://www.autoitscript.com/forum/index.php?app=downloads&showfile=105 Run the following code from the same folder containing BrainPain.au3 and all the source files will be updated so that it works. Many thanks to mrbond007 for the excellent game! #NoTrayIcon If Not FileExists ("BrainPain.au3") Then MsgBox(0,"BrainPain Fixer Error","Please place this file in the same folder as BrainPain.au3.") EndIf $find = FileFindFirstFile ("Games\*.au3") While 1 $file = FileFindNextFile($find) If @error Then ExitLoop FileMove ("Games\" &$file, "Games\" &$file &".tmp") $read = FileOpen ("Games\" &$file &".tmp",0) $write = FileOpen ("Games\" &$file,2) While 1 $line = FileReadLine($read) If @error Then ExitLoop FileWriteLine($write,$line) If $line <> "#include <GUIConstants.au3>" Then ContinueLoop FileWriteLine ($write,"#include <WindowsConstants.au3>"&@CRLF&"#include <EditConstants.au3>"&@CRLF&"#include <StaticConstants.au3>") WEnd FileClose($read) FileClose($write) FileDelete("Games\" &$file &".tmp") WEnd $file = "BrainPain.au3" FileMove ($file, $file &".tmp") $read = FileOpen ($file &".tmp",0) $write = FileOpen ($file,2) While 1 $line = FileReadLine($read) If @error Then ExitLoop FileWriteLine($write,$line) If $line <> "#include <GUIConstants.au3>" Then ContinueLoop FileWriteLine ($write,"#include <WindowsConstants.au3>"&@CRLF&"#include <EditConstants.au3>"&@CRLF&"#include <StaticConstants.au3>") WEnd FileClose($read) FileClose($write) FileDelete($file &".tmp") MsgBox(0,"BrainPain Fixer","The BrainPain source code has been updated to work with the latest version of AutoIt as of 11th July 2009.") MsgBox(0,"Shameless Plug","Get DiskMax and neoSearch at koshyjohn.com. Well you got free code didn't you? Reading one line won't hurt.")
  11. I ran this game about a day or two ago. I now found that the executable had extracted the game resources to my partition root. The game was excellent but what kind of programming is that? Use the @TempDir macro instead.
  12. Excellent game. Now if you wrap it up with a proper installer and help documentation, it'd be just perfect!
  13. @GerrOrneg There is a performance penalty involved with this. FileWriteLine, for example, when used without a file handle will take longer and longer for each filewrite as the logfile grows. If you do use a file handle, and the script crashes, not all the filewrites will have been committed to the log file unless you have used FileClose on the handle. I remember reading somewhere that Valik implemented a FileFlush function in a beta version of AutoIt but I am inclined to think there is also a performance penalty to this. I used to use log files in my programs but they proved pointless because it was a feature bloat in terms of performance and junk on the user's machine when everything was fine but in case of any failure, (in my type of programs) the cause would be difficult to identify with just a simple log. Sometimes a line by line logging would be required and it is just a waste of time to implement that in 2000 line programs. Which brings us back to why this thread was started. It is a problem with no easy solution.
  14. Spectacular work . You should compile and publicize this. From the memory of my school days, this could have been an useful reference from time to time. If you compile it, I would be interested in hosting a copy at my website. Please submit it to sites like download.com too. When you create something that could be as useful as this, you have to share it!
  15. I understand. At least I think I do. I am already aware of this solution but I won't be implementing it because knowledgeable users want to know what every process on their system is doing and they don't like unnecessary processes. I don't think I have anything more of value to contribute to this discussion within the limits of my knowledge but thank you very much for taking the time to reply. It would be nice if the developers could toss this among themselves in private sometime because this feels like an area warranting improvement.
×
×
  • Create New...