Jump to content
Macro Express Forums

paul

Members
  • Posts

    1,049
  • Joined

  • Last visited

Everything posted by paul

  1. Yes, you're right. I even tried it within a repeat loop, but that made no difference. Would writing to the registry work for you, as you can write any type of variable to the registry?
  2. Sorry - I haven't used this feature and didn't realize the .ini file options were so inextricably tied to string variables. There is a way round this. It's a bit of a kludge, but does seem to work. Suppose this command: <VARIABLE MODIFY STRING Option="\x13" Destination="%T[3]%" Filename="%userprofile%\\Documents\\Macros\\MouseVariables.ini" Key="Location" Value="X" NoEmbeddedVars="FALSE"/>[/size] If you edit this and change %T[3]% to %N[3]%, you get an error message about the variable being of the wrong type. However... If you toggle the direct editor using the last icon to the left of your script, then you can replace Destination="%T[3]% with Destination="%N[3]% Toggle the direct editor again, and it works. BTW, I encourage you to use meaningful variable names instead of the old %t[3]% syntax because it makes later editing of the macro easier.
  3. MEP is not like .net, so there's no reason to convert the integers to text before you write them to the .ini file, unless you want fixed length (only relevant if you're writing several values in a single line, in which case I'd separate them with commas or tabs).
  4. I have attached an executable you might find useful - it terminates MEP using the context menu of the tray icon, then restarts it. This assumes that MEP is located at C:\Program Files (x86)\Macro Express Pro\MacExp.exe. For those of you with AutoIt, I include the source code. #NoTrayIcon #Include <GuiToolBar.au3> Dim $hSysTray_Handle, $iSystray_ButtonNumber $iSystray_ButtonNumber = Get_Systray_Index("Macro Express Pro") If $iSystray_ButtonNumber <> -1 Then Sleep(1000) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") Sleep(500) Send("t") EndIf Sleep(1000) ShellExecute("C:\Program Files (x86)\Macro Express Pro\MacExp.exe") Func Get_Systray_Index($sToolTipTitle) $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then MsgBox(16, "Error", "System tray not found") Exit EndIf Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then MsgBox(16, "Error", "No items found in system tray") Exit EndIf For $iSystray_ButtonNumber = 0 To $iSystray_ButCount If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) <> 0 Then Return $iSystray_ButtonNumber EndIf Next Return -1 EndFunc RestartMacroExpress.zip
  5. I imagine you'll have to change my pixel colour of 11316393 to whatever your graphics card is displaying for loaded pages. I'm using the dead centre of that X as my pixel location.
  6. You need to activate the Firefox window within your repeat loop, otherwise most mouse clicks by you will prevent your macro from finishing! My macro contains 2 additional capabilities: - a timeout, so that if the page never completes loading, I still regain control after the specified timeout (default is 120 seconds); I can tell if the page timed out in the If test after the repeat loop. - an additional delay for "difficult" pages, which I have, on occasion, found useful. Note that my firefox window is called xFirefox (when I start the computer, I rename Firefox to xFirefox using Actual Window manager, because ME has a long-standing bug and its Move Mouse to Tray icon doesn't work reliably for my tray which is displayed over 2 lines; as I always have Foobar2000 open in the tray, I need Firefox to start with a unique letter other than F). The pixel colours 11711149 and 8747885 used to work in earlier versions of Firefox.
  7. I don't use the icon (it's not even displayed on my screen), but I have reloaded it via Customize so as to be able to answer your question. I get no red while it's spinning (but obviously don't know how many FF versions that's been true for). I suspect I do something quite similar to you, but I use the X (Stop loading this page) instead of the spinning icon. I occasionally have to change the location or pixel colour, but the changes are isolated to a single macro. Here's the code I use, which works as of FF 14.0.1 - it's called FirefoxLoaded. <IF NOT PROGRAM Option="\x01" Program="FIREFOX.EXE"/> <MACRO STOP/> <END IF/> <IF VARIABLE Variable="%nTimeoutSecs%" Condition="\x00" Value="0" IgnoreCase="FALSE"/> <VARIABLE SET INTEGER Option="\x00" Destination="%nTimeoutSecs%" Value="120" _COMMENT="Default of 120 seconds before timeout"/> <END IF/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%nTimeout%" Value1="%nTimeoutSecs%" Value2="4"/> <COMMENT Value="Check background below X, wait until inactive"/> <REPEAT START Start="1" Step="1" Count="%nTimeout%" Save="FALSE" _COMMENT="nTimeoutSecs x 4"/> <WINDOW ACTIVATE Title="xFirefox" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/> <GET PIXEL COLOR Option="\x01" Rel_To_Screen="FALSE" X="69" Y="58" Destination="%nPixel%" _COMMENT="11711149 8747885"/> <IF VARIABLE Variable="%nPixel%" Condition="\x00" Value="11316393" IgnoreCase="FALSE"/> <REPEAT EXIT/> <END IF/> <DELAY Flags="\x02" Time="250"/> <END REPEAT/> <COMMENT/> <IF VARIABLE Variable="%nPixel%" Condition="\x01" Value="11316393" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang3081{\\fonttbl{\\f0\\fnil\\fcharset0 Arial;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red255\\green0\\blue0;}\r\n\\viewkind4\\uc1\\pard\\qc\\cf1\\b\\fs32 Firefox timed out\\cf0\\b0\\f1\\fs16 \r\n\\par }\r\n" Left="Center" Top="385" Width="278" Height="72" Monitor="2" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x01" Delay="3"/> <DELAY Flags="\x01" Time="3"/> <MACRO STOP/> <END IF/> <READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\Software\\Professional Grade Macros\\PhtData\\FirefoxAfterLoadDelay" Destination="%nDelayExtra%"/> <IF VARIABLE Variable="%nDelayExtra%" Condition="\x03" Value="0" IgnoreCase="FALSE"/> <DELAY Flags="\x01" Time="%nDelayExtra%"/> <VARIABLE SET INTEGER Option="\x00" Destination="%nDelayExtra%" Value="0"/> <WRITE REGISTRY VALUE Key="HKEY_CURRENT_USER\\Software\\Professional Grade Macros\\PhtData\\FirefoxAfterLoadDelay" Destination="%nDelayExtra%"/> <END IF/>
  8. Yes. I've also learned several languages in my 40 years of programming; I suppose I've learnt 13 or so, but believe I've become expert at perhaps only 5 or 6. I always wonder whether the relentless pressure to produce more output in less time has led to a marked decrease in quality. They used to say that if you wrote 5 lines of bug-free Cobol a day, you were doing well. I wonder what that translates into these days!
  9. Uses for Windows API routines are very limited in ME, with Postmessage being the only option. FYI, here's some AutoIt code to fire a macro called, in this case, Textbox. I'm sure you're able to convert this into VBA if it's of interest.
  10. 2 issues to be aware of: - when you invoke MultiCharts from ME, then ME will probably not know when MultiCharts has finished. Assuming that the MultiCharts process terminates once finished, you have loop within ME until the MuliCharts process has been unloaded from memory - Access is an MDI application; this makes the process of handling its windows quite complicated, and not one that ME handles well. However this should be irrelevant if you are simply reactivating the Access window If you don't want to use the registry method of checking when ME has finished, you could also create a file and have Access check for its existence of absence.
  11. I do not think the version of MS-Access I am using can read the registry. Really? What version of Access are you using? Are you competent in VBA?
  12. I personally always use the delimiter approach - I then don't need to count characters to ensure a constant fixed length.
  13. If I understand your message correctly, you need %N1% to increment by 1 each time you use it. You can do this directly in the Repeat statement itself (you'll see something like "store the counter into a variable"), or by including the statement "Variable Modify Integer %n1%: Increment" within the Repeat loop.
  14. Have you checked the Control Panel for Ease of Access and the Make keyboard easier to use options?
  15. I'd do as follows: - Place all the URLs into a text variable, delimited by some separator character, or fixed length (e.g. each URL is 100 characters long) - Place all the userids into a 2nd text variable, delimited or fixed length - Place all the passwords into a 3rd text variable, delimited or fixed length Write the main code within a repeat loop, repeating 4 times. Within each loop, extract the next value from each of your 3 text variables, and do the processing, exiting the macro when successful. Fixed length will make the extraction simpler, e.g. extract characters 1-100, then 101-200, etc., where you hold the start position in an integer variable; alternatively, you search for the next separator and extract accordingly.
  16. Some macro commands work when the PC is locked, but many don't. I have solved this problem in the past as follows: - Using the windows scheduler, I start a task at a specified time that writes 2 values to the registry and reboots the computer; the 2 registry values allow the computer to boot without soliciting a user or password - When Macro Express starts, it detects the 2 registry values and immediately restores them so that the next boot will require the usual credentials; it then runs whatever macro(s) you require, and reboots the machine once the macros have finished
  17. You can also have a macro start automatically when a specified window closes, or when a process stops running.
  18. paul

    OR

    Please explain what you are trying to achieve, as your request makes no sense to me. If you want to randomly type x, y or z, that can be done quite easily.
  19. It's a one-liner using AutoIt! WinSetTitle("Tools4Movies", "F:", "Tools4Movies DVDCatalyst")
  20. I could write reams on this! And I couldn't agree with you more (even though I would have called myself a professional programmer). The causes are many and various: - The IT world is heavily populated with mediocrity - Many in the IT world have no business experience, and don't know how to think for themselves - Today the demands are such that a programmer is often required to know many languages; but to what level, and how much real knowledge is there? I actually spent most of my professional consultancy days fighting IT departments on behalf of users. Nowadays it's much harder, because IT seems to have conquered the world.
  21. All I can say is your professional programmer friends are quite ignorant! The only major difference of note between the capabilities of C# and VB.NET is that the former allows you to write non-managed code, something which I imagine 99% of programmers should not need, or ever be allowed, to do. You know, non VB programmers have always looked down on, and sneered at, those who do use VB, and I've never understood why. Perhaps it has to do with the perception (for which there is, or used to be, some justification) that VB programmers come from the ranks of the hobbyist programmer, while C# are more likely to have learnt their skills at university, or in some more professional manner. I used to look down on VB myself, because I know there was a far superior language that unfortunately never became mainstream, namely APL. But that's another story.
  22. No, I didn't know that. Thanks for sharing.
  23. This is what I do in a macro which is only called by other macros. It displays a countdown message ("sleeping in n seconds") where n reduces by 1 each second. If any mouse movement is detected, the macro stops since I don't want to put the computer to sleep if I'm using it. n91 is preinitialized to 10. Text Box Display: Pausing Get Mouse Position into (%nMouseX1%, %nMouseY1%) Relative to Screen Repeat Until %n[91]% Equals "0" Delay: 1 seconds Get Mouse Position into (%nMouseX2%, %nMouseY2%) Relative to Screen If Variable %nMouseX1% Does not Equal "%nMouseX2%" Or If Variable %nMouseY1% Does not Equal "%nMouseY2%" Macro Stop Else If Window "Pausing" is running Variable Modify Integer %n[91]%: Decrement Else Macro Stop End If End If Update Textbox: Pausing End Repeat
×
×
  • Create New...