Jump to content
Macro Express Forums

paul

Members
  • Posts

    1,049
  • Joined

  • Last visited

Everything posted by paul

  1. I've now had a chance to do some testing, and I got the results I expected, which are different to what you describe! I created an Access 2003 mdb, with a single macro called Autoexec, which runs a non-existent function called TestIt. When I open the database, the macro halts with an error, which is what you'd expect. Then I created an ME macro to open the above mdb database using Access 2003, and display a message "Arrived", as in: Program Launch: "MSACCESS.EXE" Text Box Display: As I expected, running this macro does the following: - opens Access * Access displays the macro error message complaining about the missing function - immediately displays the ME dialog box "Arrived" without waiting for Access to terminate. I couldn't understand why ME would wait for Access to terminate, regardless of whether its Autoexec macro ran successfully or not, since that's not the way ME was designed to work. And indeed, it doesn't. So you must have something else going on, though I cannot imagine what!
  2. Can you zip and send the macro in question? I know Access well, and may be able to understand your problem better when I see the actual macro code.
  3. I'm sorry, I don't understand what you're asking here?
  4. Is Access still running when the Autoexec macro has finished, or do you quit Access at the end of your autoexec macro? If the latter, then you can check whether Access is still running in your ME macro. Otherwise, perhaps your autoexec macro could create a file somewhere when it's finished. Then you can have your ME macro check for this file's existence, and continue processing once the file is ready (remembering to delete the file in the ME macro). A better solution might be to anticipate and allow for NULLs in your queries, so that they work with and without NULLs!
  5. One method I use is to identify a part of the web page when it's finished loading that differs from when it's not yet ready, then use the Get Pixel command within a Repeat to work out when the page is ready.
  6. Given ME's inability to run scheduled tasks when a machine is locked, I get around this (in Windows XP) by creating various scheduled tasks (using Windows' own scheduler) to run ME macros, as in folder\Meproc.exe /AMacroname (and you can extend this syntax to initialize variables as well, so long as the macro starts with a Variables Restore command). I take this concept further by having a pair of macros that work in concert with each other. The first allows my machine to autologin, and reboots the machine immediately. The second removes the autologin and hibernates the machine. In between I run whatever processing I require. One important note: when you create a scheduled task that is to run when your machine is hibernating, you must go into its settings tab and check "Wake the computer to run this task".
  7. Here are the comments for the code in question: Check for completion of process This is graduated as follows: For the first 2 seconds, check the semaphore every 50 milliseconds After that, check every second for a maximum of %N1% seconds The first wait is done using the standard Delay in Milliseconds, while the second (and usually longer) wait is done with the Wait Time Delay 1 seconds command (which uses no CPU). So, no, I don't believe this imposes much of a burden on the system. And timeouts are handled by the second wait which has a user-definable maximum wait period.
  8. I have written a VB server program which interfaces well with ME (it's part of our PGM Library package). It uses the registry to communicate with the server, and I have written it in such a way that new functionality can very easily be added by writing a new VB "DLL". One issue you need to take care of (among several others) is to force ME to wait until your external program has finished processing (I use a semaphore flag for this, again via the registry).
  9. Take a look at the Pad Left command, followed by a Replace of " " with "0".
  10. Quite often, things that ought to be a control aren't! When navigating around web pages, I tend to use the Find dialogue to find text near the 'control" I want to use, then type one or more tabs to move the cursor to the relevant input box. For example, in my bank account web page I do this: Activate Window: "Logon - Microsoft Internet Explorer" Text Type: <CTRLD>f<CTRLU> Wait For Window Title: "Find" Text Type: Client number<ENTER> Text Type: <ESC> Delay 300 Milliseconds Text Type: <TAB> Delay 300 Milliseconds Text Type: %T2%<TAB>%T3%<TAB><TAB><TAB><ENTER> where T2 has been prefilled with my client number, and T3 with my password (using secure macros).
  11. The relevant Word VBA code is a simple one-liner! objWord.Dialogs(PRINT_DIALOG).Display This allows the user to change printers without affecting the default printer setting. If you refer back to one of Joe's several messages about constructing dynamic VB Script modules, you should be able to incorporate the above line into a simple vbs script.
  12. This was a red herring! The real cause of the problem (which I failed to realize even though I've run the routines manually for months!) was that in a .bat file, running a macro using Meproc returns control to the .bat file immediately, long before the macro has finished its business. So there should be no issues running stuff as soon as the machine reboots, although being able to schedule tasks using Windows XP's SchTasks.exe utility is quite elegant.
  13. I use Windowx XP, but I imagine the 2 registry values below are equally relevant to Windows 2000. Here's the macro I wrote together with comments. Variable Set String %T1% "1" -- for some reason, the registry value AutoAdminLogon is a string value Macro Run: lo -- this returns my Windows password in variable T99 Write Registry String: "AutoAdminLogon" -- save T1 into HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon Write Registry String: "DefaultPassword" -- save T99 into HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword Program Launch: "shutdown.exe" -- parameters are -s reboot -f -l 10 -- which translates to -- Shutdown method=reboot -- Force applications to terminate -- Display message for 10 seconds (in case I'm using the machine and don't want to reboot) You can get the shutdown utility from here: http://www.beyondlogic.org/solutions/shutdown/shutdown.htm One curiosity I'm still trying to understand: One of the jobs I need to run uses SQL Server, for which I use Windows authentication - i.e. I rely on my windows userid and password to give me access to SQL Server. Running such a job from an ME macro which itself was run via the startup macro I invoke when starting ME does not give me such access - my credentials don't seem to work. So I'm in the process of creating a scheduled task with ME to run this SQL Server job, and I believe that will work OK. To restore the normal logging in procedure, change the AutoAdminLogon value to 0, and delete the DefaultPassword value. Let me know how it goes.
  14. I also run Windows XP Pro (SP2), and experience neither of the problems you describe. I've just tried the random number generator using a maximum value of 10, and got 1, 2, 4, 9 in my 1st 4 attempts.
  15. I haven't found a way of persuading ME to unlock a workstation. What I do, every night, is run a scheduled ME macro which: - changes the registry so as to avoid any requirement for a password - reboots my computer - runs that night's processing - restores the password requirements - hibernates the machine Note that this macro is started by the Windows scheduler, as I haven't been able to get the ME scheduler to work when the workstation is locked.
  16. If you can live with the extra keypress required (i.e. the Enter key), then the command "Variable Set String %T1% from Prompt" would do the trick.
  17. What's wrong with the "Move Mouse to Tray Icon" command? Doesn't this achieve, more reliably, what your code sets out to do?
  18. I'm guessing your "CR after each part number" may not be as described. I'd recommend opening the text file in hexadecimal, and checking that every ASCII 13 (0D in hex) is followed by ASCII 10 (hex 0A). If this guess is wrong, please make your text file available (perhaps you should email it to me at paul_t@westnet.com.au) and I'll take a look.
  19. Unfortunately, there's no message or messages designed to do this!
  20. I'm pretty sure there's an Excel "function" that will locate text and return the cell reference - which I imagine is what you need.
  21. Not with ME! One way to achieve this is to write a program, e.g. in VB, which will require the use of several Windows API calls, i.e. DrawMenuBar, EnumWindows, GetSystemMenu, GetWindowText, RemoveMenu and SetWindowPos.
  22. Well, there's no magic to this. You need to work out how you would do this manually yourself (i.e. record the keystrokes you would use to achieve what you want), then you should be able to create a macro to replicate those keystrokes (and you'd need to allow sufficient pauses between different keystrokes to prevent your macro getting ahead of itself).
  23. It's sometimes useful to be able to display a pause dialog box which closes itself after some number of seconds. I have a need for this capability, and wish to take one of two actions, depending on whether the dialog box is closed by the macro after the specified timeout, or manually by the user. I've developed a series of macros and other utilities which I want to run in two different ways: when testing, I need to inspect the results produced in the previous step before continuing when running unattended in a production environment, I need the process to run from beginning to end without the need for user intervention Here is the code for a macro that accomplishes this. Please note that this implementation of the macro uses two functions from our PGM Library to capture the current time to the nearest millisecond, so if you don't have this library you need to recreate their functionality. <REM2:This macro displays a Pause dialog box that closes itself after><REM2:the number of seconds specified in N91, and then checks to see><REM2:how the dialog box was closed (i.e. automatically because of a timeout,><REM2:or manually because of user intervention).><REM2:If the close was automatic, the macro continues, otherwise it waits><REM2:for a specific key press (in this example, the Esc key) before continuing.><REM2:><REM2:This implementation uses the PGM Library functions><REM2: { Utility - Start Timer } and><REM2: { Utility - Get Timer }><REM2:to set and return the elapse time in milliseconds.><REM2:><REM2:Local variables -><REM2:T1, T2, N1 = Temporary variables><REM2:T91 = Pause message to display><REM2:N91 = Number of seconds to wait before a timeout occurs><REM2:____________________________________________________________________________ ________________><REM2:><REM2:Timeout number of seconds><IVAR2:91:01:8><REM2:><REM2:PGM Library Function><MACRUN2:{ Utility - Start Timer }><REM2:><REM2:Display Pause dialog box for N91 seconds><TBOX4:T:2:CenterCenter000300000200:%N91%:Pausing (closes after %N91% seconds)%T91%><REM2:><REM2:Check to see if Pause dialog box window is still open><REP3:08:000002:000002:0001:1:01:N1><IFOTH:12:2:Pausing><BREAK><ENDIF><ENDREP><REM2:><REM2:PGM Library Function><MACRUN2:{ Utility - Get Timer }><REGRSTR:1:HKEY_CURRENT_USER\Software\Professional Grade Macros\Parameters\ReturnString1><REM2:><REM2:Derive number of seconds the Pause dialog box was open><IVAR2:01:13:1::><TMVAR2:11:01:00:001:N01:><IVAR2:01:13:1::><TMVAR2:11:01:00:001:N01:><TMVAR2:05:01:01:000:000:><REM2:><IFVAR2:5:01:5:N91><REM2:Automatically closed after timeout, therefore continue with macro><TBOX4:T:2:CenterCenter000300000200:005:Elapse Time (closing after 5 seconds)Dialog box closed itself after %N1% seconds Continuing on with macro><DELAY:5><ELSE><REM2:Manually closed by the user, therefore wait for the Esc key before continuing><TBOX4:T:2:CenterCenter000300000200:005:Elapse Time (closing after 5 seconds)Dialog box was closed manually after only %N1% seconds Waiting for the Esc key to be pressed before continuing><DELAY:5><WAITKEY2:000000:000000:48><ENDIF><REM2:><REM2:Continue on with macro><TBOX4:T:1:CenterCenter000300000200:000:ContinuingMacro continues> In itself, this macro does nothing useful. But it can easily be modified to provide quite useful functionality, by replacing the informational messages with other code. You can also address its use of variables by doing Variable Save/Restore commands at suitable points.
  24. This IF test won't work - use the method I describe above instead.
  25. It's not clear to me why you keep referring to Notepad - as far as I can see, it's irrelevant to your problem. And if you insert a new line between different combinations of Job, Code and Date the process will simply not work. Here's what you should do: 1) Start with an empty file somewhere, e.g. C:\Mypath\UniqueCombinations.txt, and read its contents into T1 2) Get a mail, and place into T2 "/" (without the quote marks), the email job (which is preferably always the same length - you can pad it out with blanks to make it so) followed by a comma, the email code (again preferably a uniform length) followed by a comma, and the email date (uniform length and format) followed by "/" I use commas to help you understand the meaning of any given string simply by viewing it 3) Check if T1 contains T2 (it won't, because T1 is currently empty). Process the mail because it's unique. Append T2 to T1 (use the Variable Modify String - Append Text command with %T2% as the text to append, OR the Variable Set String command with %T1%%T2% as the initial value) 4) Continue until you've processed all messages; don't append T2 to T1 if the job/code/date combination already exists 5) When you've completed the current batch of messages, replace C:\Mypath\UniqueCombinations.txt with the contents of T1 (Variable Modify String/Option 2/Save to Text File)
×
×
  • Create New...