
TMXOD
Members-
Posts
18 -
Joined
-
Last visited
Everything posted by TMXOD
-
Retrieve External Process' current/working directory
TMXOD replied to TMXOD's topic in AutoIt General Help and Support
I'd love to see that code (pretty or not ) -
If you have PERL properly installed, you may also try using the ShellExecute() function, as it will allow you to run the script with its associated program (or any program for which the file type has an associated action (e.g. Edit, Run, Debug, etc.)
-
Retrieve External Process' current/working directory
TMXOD replied to TMXOD's topic in AutoIt General Help and Support
That UDF uses the Win32_Process WMI class, which does not provide the working directory. I know it's possible, since Technet's Process Explorer can do it, but it seems like something that would be documented/known... (i.e. don't feel like setting up a reverse engineering setup to dig up a single API call)... -
Get Location + PID of Processes..??
TMXOD replied to cypher175's topic in AutoIt General Help and Support
For this scenario, you may also wish to use the _Singleton() function of the Misc.au3 UDF. For more advanced scenarios, you could also try WMI: Local $objWMI = ObjGet("winmgmts:\\localhost\root\CIMV2") Local $objItems = $objWMI.ExecQuery('SELECT ProcessId,ExecutablePath,CreationDate FROM Win32_Process WHERE ExecutablePath LIKE "%process_name%"', "WQL", 0x10 + 0x20) If IsObj($objItems) Then For $objItem In $objItems ConsoleWriteError("PID:" & $objItem.ProcessId & " NAME:'" & $objItem.ExecutablePath & "' DATE:" & $objItem.CreationDate & @CRLF) ;;handling code goes here Next EndIfSee This MSDN Article for the functional meaning of each property. You could add each process onto a 2-dimensional array and sort by the CreationDate to get the earliest process and kill the others. -
When writing a script, I can retrieve the script's working directory by using the following macro: @WorkingDir When launching an application from within a script, I can set its initial working directory by using the following syntax for the 'Run' function: Run("x:\path\to\application.exe","x:\working\directory") The question is: How do I retrieve the working directory of an application that was already started when my script began execution? I looked in the PSAPI documentation in MSDN, the Win32_Process WMI class, as well as multiple forum searches for variations on 'current/working directory existing/running process' without positive results... Any help getting this working would be greatly appreciated...
-
I started work on a Email-to-Fax gateway powered by Mozilla Thunderbird+Attachment Extractor, PDFCreator, and AutoIt. The general flow of the program is as following: (Client side) User types in destination fax numberUser types in destination nameuser types the file whose contents are to be faxeduser types in notification email addressFile is converted to PDF using PDFCreator using the following constraints (to allow for weird files, like CAD drawings or propietary image formats, which the server may not be able to decode): Color: GrayscalePaper Size: LetterResolution 200dpifax descriptor file is created file name to faxdestination namedestination numbernotification email addressinstallation-unique confirmation code (avoid spam)fax descriptor and PDF files are attached to an email message containing a specially-crafted subject (avoid accidentally sending spam through fax)message is sent using MAPI(server side, when a message is received) if the message has the specific subject, continue; else abortextract attached PDF and fax descriptor from received emailread information from file descriptor, abort if confirmation code invalidfax is sent using local COM Objectuser is emailed when fax is sent or an error occurs I'm having problems with the actual sending of the fax. I'm going from what I found at this page. The VBScript works, when adapted to my test, but what I think is an accurate translation to AutoIt does not. The code is: Dim $faxServer = ObjCreate("FAXCOMEX.FaxServer") If @error <> 1 And IsObj($faxServer) Then $faxServer.Connect ("") Dim $faxDoc = ObjCreate("FAXCOMEX.FaxDocument") If @error <> 1 And IsObj($faxDoc) Then With $faxDoc .Body = @ScriptFullPath .DocumentName=@ScriptName & " source" .Recipients.Add("5555555555") ; hiding actual destination phone number .Sender.Email="root@localhost.com" ; hiding actual email address .Sender.Name="ME" ; hiding actual name .Sender.FaxNumber="5555555555" ; hiding actual home phone number EndWith $faxServer.Folders.OutgoingQueue.Branding=False $faxServer.Folders.OutgoingQueue.Save() Dim $jobid=$faxdoc.ConnectedSubmit($faxServer) ;<--AHK ConsoleWrite("Finished -- JOB ID: " & $jobid & @CRLF) EndIf EndIfThe error occurs in line 16 (the one marked as "<--AHK"). The error message is "The requested action with this object has failed." I think the problem is how I'm passing one object as the parameter to ConnectedSubmit. Am I doing this right? or do I need to do this differently?
-
Update: I ripped the required functions from <Array.au3> to get _ArraySort() working without the rest of the include file, so I can modify the structure of the functions to be able to call a comparison function that is user-specifiable, which I will implement using Call() + input authentication (never trust the user). I'd like to start my work by thanking Jos, LazyCoder, and Tylo, for making a great, adaptable sort algorithm which I can now hack apart and hopefully improve... The main drive for this is that if these changes were allowed into the distributed UDF file, it would allow greater flexibility to the scripter, since if they wanted items compared differently, all they would have to do is write their own comparison function and pass it as a parameter to _ArraySortMod()... Since I haven't yet done any modifications to the _ArraySort() functions, and I am still planning on how to do this, anybody have any ideas, possible pitfalls, suggestions, warnings, or anything constructive at all to say, please reply to this thread... Of course, implemented ideas will be attributed to its contributor... For those interested, I'm thinking of following the c sort API, in which for items A and B, the function will return 1 if A > B, -1 if A < B, or 0 if A = B
-
When sorting arrays, the sorting algorithm needs something to go by to decide what goes before and after what. most comparisons used work alphabetically (A < B < C < D < E ... < Z) and alphanumerically (A1 < A10 < A2 < A3 < B1) The problem is that when dealing with versions and other file name specifics, 10 should go after 9, and not between 1 and 2. Natural order comparison solves this problem by doing alphabetical ordering for text, and numerical ordering (0<1<2...<8<9) for number parts of the given string. This code has been adapted from the JS source I found on the internet. Full copyright information in the attached file. This can be combined with a custom quicksort to replace _arraySort when dealing with file names with versions in them. Next step: a launcher for Azureus as a service that will update the jar file to the latest available beta, running it with the latest installed JRE... both purposes deal with names with versions in them, the best use of Natural Order sort. EDIT: fixed bugs in attached file, uploaded new version EDIT 2: preliminary natsort function uploaded in quicksortmod.au3... Thx to Jos, Tylo, and LazyCoder for writing the base functions... Even if you don't care about natsort, you might care about this: I modified the functions to take in a programmer or user-specified comparison function, with authentication to prevent security leaks. natcompare.au3
-
In this case, where the user interface is simple, and nothing but numbers are used for input, and the access key is changed for itself (from Start to Stop), the risk of missing keypresses is negligible. The fact of the matter is that it looks like AutoIt is at fault, given that I've made similar code to this in VB6, VB.NET, Java (both Swing and SWT), but not C/C++/C#(since GUI programming in these languages is painful), and Windows always showed the access key, even after changing the button text and the access key.
-
Because I was bored, I took upon my little brother's challenge of creating a countdown for his birthday. The code runs fine, but I am having problems with a minor cosmetic feature: the text of the button that starts and stops the countdown timer changes depending on what clicking the button would do. When creating the button with GUICtrlCreateButton, I set the access key by adding the ampersand ('&') character before the key I want to set as the access key. I do the same when using GUICtrlSetData to change the button's text. The problem is that sometimes the underlining appears and sometimes it does not. Any Ideas? The entire source code (for context) is in the attached file, as the code is too long to post here. cdown.au3 Pictures for clarification: with underlining: without underlining: I've noticed that the underlining comes back when pressing the Alt key, but my Windows settings say to always display the access key, [sarcasm]so the problem must lie in AutoIt, as we all know that Windows has no bugs, right.... [/sarcasm] The problem occurs when the script is interpreted through AutoIt3.exe and when compiled with Aut2exe.exe. Can anyone else replicate the problem? if you can, post here, so I can have proof of the bug's existence when filing the bug report.
-
That would do it... Thanks for pointing out that about how AutoIt works... EDIT: I worked around it by writing an all-purpose Boolify function, where you pass a var and returns either true or false. That problem is now solved... Off to finish my alarm clock... EDIT: now I'll write something to make the sound file play but make the cancel/snooze work immediately, not having to wait until the file finishes playing. I'm thinking a separate script that loops and have the master script kill it when cancelling/snoozing... ANOTHER EDIT: It is done... everything works, and I see no problems other than the obvious one when attempting to compile (@autoitexe will be the compiled script and the slave script will not work...). If any admin/mod sees this, feel free to move this topic/thread/whatever this is called into the scripts/scraps subforum. Thanks... BTW: latest working version of the script is this one --->
-
The attached file is a script I am working on. When finished, it will be a fully functional alarm clock. From what I have right now, I only have a single problem. A MsgBox should come up and explain to the user that the time they inputted has already passed today and that the alarm will be set for the following day. (ALARMCLOCK.AU3, lines 126 to 129) ;... Global $warned= IniRead(@ScriptDir & "\alarm.ini", "Misc", "WarnedAboutTomorrow", False) ;... If $warned = False Then MsgBox(64 + 262144, "Alarm Error", "The time currently selected has already passed today." & @CRLF & "If the alarm is activated with the current settings," & @CRLF & "it will go off tomorrow at that time.") $warned = True EndIf The problem is that the msgbox never shows up. Try it out for yourself. Make sure you use latest AutoIt3 beta. Debugging information will be printed to StdOut... Unless I have overlooked something somewhere else in the code, that should work. Weird, huh?
-
@JdeB OK... so I changed the "fore" and "back" properties of whitespace, yet my UDFs are still not changing color. This is the affected part of my SciTEUser.properties file whitespace.fore=#ffffff whitespace.back=#000000 I have changed the background and foreground color for all types of normal text (white=fg, black=bg) to better fit my computer's color scheme, yet changing the whitespace colors as you stated above will not change the coloring of UDFs. Any idea why? (I know this is off topic, but I have no idea where else to post this)