Jump to content
Macro Express Forums

All Activity

This stream auto-updates     

  1. Last week
  2. HEX Variables

    Gottit! Thank you for your assistance and patience.
  3. HEX Variables

    Sixteen IF statements in all, to place a displayable text character into a text variable: If Variable %N1% = 0 Variable Set String %T10% "0" End If If Variable %N1% = 1 Variable Set String %T10% "1" End If .... If Variable %N1% = 10 Variable Set String %T10% "A" End If .... If Variable %N1% = 15 Variable Set String %T10% "F" End If
  4. HEX Variables

    Ok, great. Could you give me some assistance converting the number to text? The closest I could find is using the following: Variable Modify String: Replace %N1% in %T10% with "A"
  5. HEX Variables

    Yes, integer arithmetic would give a whole number quotient. To isolate the remainder you could multiply the quotient by 16 and subtract the product from the original random number -- again entirely with integer arithmetic. Or as you say, just generate two separate random numbers, one for each character you want to end up with. I tried "Variable Set to ASCII Char" and it did not product a useful result. I was assuming that you want displayable characters -- for example, random number 26 is hexadecimal x'1A', so you want two displayable characters, '1' and 'A'. You are right about having to work hard only for generating characters 'A' through 'F'. The test macro below will properly produce a text string for value '9' but will NOT produce an 'E' for value 14. Run it and see. Variable Set Integer %N1% to 9 Variable Modify Integer: Convert %N1% to text string %T1% Variable Set Integer %N2% to 14 Variable Modify Integer: Convert %N2% to text string %T2% Text Box Display: %T1% %T2% But you don't know ahead of time whether you will be generating a numeric character or a letter character. The series of IF statements I suggested will handle both cases.
  6. HEX Variables

    That is brutal (in a positive way)! Thank you very much. Bear with me, but in using integer arithmetic wouldn't I only be getting a whole number an no remainders? ...which is fine actually as it just means I need to 'double the recipe' to get the double characters that I want. And in terms of converting the integers, I think I only need to do that for generating 'A' through 'F'. Having said that, I am having trouble with the IF statements in the conversion. Would I use a "Variable Set to ASCII Char"?
  7. HEX Variables

    A hex value expressed by two characters can be anything from x'00' to x'FF', which is decimal 0 to 255. So you could (1) Generate a random integer from 0 to 255. (2) Using Macro Express's integer arithmetic, divide the generated integer by 16, ignoring the remainder, and you will have a quotient from 0 to 15 representing the leftmost hex character. (3) The remainder from the above division will likewise be an integer from 0 to 15 repesenting the rightmost hex character. (4) Use a simple lookup array, or a series of IF statements, to convert the two integers to letters/numbers. IF QUOTIENT = 0 THEN LEFTLETTER = '0' IF QUOTIENT = 1 THEN LEFTLETTER = '1' ... ... IF QUOTIENT = 14 THEN LEFTLETTER = 'E' IF QUOTIENT = 15 THEN LEFTLETTER = 'F' ... ... IF REMAINDER = 0 THEN RIGHTLETTER = '0' IF REMAINDER = 1 THEN RIGHTLETTER = '1' etc. There is probably a more elegant way to do it, but I'm into brute force this morning.
  8. HEX Variables

    I'm attempting to create a 2-character random HEX value. I've done a 'Variable Set Integer' using random numbers from 1 to 9, and a 'Variable Set String' from random letters but have the following issues: I am unable to limit the random letters to 'A' through 'F' (for HEX nomenclature) The final value will always be a number and letter, or whatever order it is set to. Any suggestions?
  9. Earlier
  10. Macro stops at login

    I've used dedicated machines using VNC instead of RDP. With VNC, when one disconnects, the session keeps functioning. I'm sure many remote apps like it work the same way. I've used LogMeIn also.
  11. Macro stops at login

    On a couple occasions I set up ME on an always-active network server to do off-hours functions like this. Depends whether you have such servers available, whether you have permission to use them, and so on. You might not even need ME if you can use the Windows scheduler on the server to start the job.
  12. Macro stops at login

    Thanks Cory. At least I know I can't do that. I will have to look into options you are suggesting. Jody
  13. Consider using the Windows Task Scheduler.
  14. It probably isn't relative but one thing to bear in mind is that PS is by default, Unicode and MEP is ASCII/ANSI. I remember I was doing something in PS with MEP and I found a workaround by reading every other character. Unicode is 16bit so as long as the characters were still in the ACSII set, this trick worked. Someone once suggested that PS file encoding output could be modified to be ASCII. Set-Content cmdlet with '-Encoding ASCII' it might have been. But that was long ago.
  15. Macro stops at login

    It's not an MEP limitation, it's Windows. When you lock your workstation Windows knows there is no way a user can interact with any of the programs and essentially suspends all user controls. ME commands that do things like copying files still work. This problem exists in Remote Desktop sessions that are disconnected as well. I can't think of any way you will be able to get past this limitation in Windows. You might want to see if there are any command line options for your ERP software. Or look for an option to keep you logged into the software and use the Windows Scheduler to somehow refresh that report. Maybe you can access your computer remotely via RDP and run the report prior to leaving for work. Can you turn off your monitor instead of locking? Sorry, I can't think of any great ways around this.
  16. Macro stops at login

    I have created a macro that starts up our ERP software and runs a dashboard before I get to work. I've tested it and it works fine. Before I leave work, I "Lock" my PC and when I log back into Windows 10, in the morning, the macro is at my ERP login screen. If I have my PC "Locked", will it not be able to send keystroke commands to enter my username and password? Any help would be appreciated. thank, Jody
  17. From Samrae's example -- would this work, to launch it directly from ME without a batch file? Program Launch: "Powershell.exe"
  18. You could put the commands to run the PowerShell script into a batch file and run it from Macro Express Pro using the Program Launch command. A quick Google search turned up this example of how to run a PowerShell script in a batch file: Powershell.exe -executionpolicy remotesigned -File C:\Users\SE\Desktop\ps.ps1
  19. I have a PowerShell script that creates a text file, that I will subsequently email via MEP. I want to kick the PowerShell script silently from MEP. I have read that I cannot embed PowerShell scripts in MEP, but does anyone know how to silently kick-off a PowerShell script from MEP?
  20. Why do I get this error?

    You're welcome.
  21. Why do I get this error?

    Thank you Cory for your answer. Much appreciated I'll contact support. Oded.
  22. Scripts not recognized in Word 2016

    Running Macro Express as an Administrator worked!
  23. Scripts not recognized in Word 2016

    Update 1: I thought this might be a Microsoft Office issue, but the macros work fine in PowerPoint. Update 2: When the Macro Express hotkey is the same as a Word hotkey, the Word hotkey works. Usually the opposite is true: Windows "sees" Macro Express hotkeys first. Samrae, I will try your suggestion.
  24. Scripts not recognized in Word 2016

    You might try running Macro Express as Administrator.
  25. I am developing Macro Express Pro scripts to run in Microsoft Word on a Windows 10 machine. Although the scope of my scripts are set to Global, my hotkey and shortkey macros are not activating while I am in Word. The scripts are activating fine in every other program. Changing the scope to Word doesn't help. Any thoughts on what might be blocking scripts from activating while I am in Word?
  26. Why do I get this error?

    That's most likely a bug in MEP. Please report it to ISS. Then ask them for support. It could be related to the most recent version. If so, you might want to go back a version. It could be triggered by your macro but it's in an exception in MEP. Ideally no exception should ever occur in a program and no matter what your macro does, MEP shouldn't have an exception and should be able to handle anything you throw at it. In my experience programming even with the best IDE tools, I still make this mistake sometimes. I suggest you close your macro file and create anew macro file containing no macros and see if it continues to happen. That will help ISS a lot. If it goes away, then do isolation troubleshooting to determine which is causing the problem. Even if you don't have any running MEP is constantly processing your macros activations. It might be in there. Technical side: There are two types of variables, values type and reference type. Value types hold the actual data and are specifically dimensioned. But most programming uses objects that can expand, contract and do all kinds of things in dimension. One can't move blocks of data around in memory so object variables are made of two parts. One is the data which is dynamic and in location and size around (address changes) and the other is a a value type variable which contains the current address of the object. It is called, intuitively enough, a pointer. When I 'reference' my object in the program, it gets the pointer and finds my object. Hence "reference" type. Sometimes one can do something in a program that makes the pointer invalid. It's like calling someone's phone only to find the number has been disconnected. So in ones' program when one references an object using a pointer and the system doesn't find the object there, it throws an exception. Usually one creates handlers for exceptions but we avoid handlers because they adversely affect performance and complicate the code. I frequently write code that seems like there is no way on earth I could ever invalidate a pointer, and yet somehow it still happens. Code can get very complex and objects (reference type) can contain numerous objects in a complex hierarchy. At times it can be practically impossible to mentally consider every possible exception.
  1. Load more activity
×