Macro Express Forums

# All Activity

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. ## Launch separate Powershell script silently

Consider using the Windows Task Scheduler.
14. ## Launch separate Powershell script silently

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. ## Launch separate Powershell script silently

From Samrae's example -- would this work, to launch it directly from ME without a batch file? Program Launch: "Powershell.exe"
18. ## Launch separate Powershell script silently

Good trick Samrae!
19. ## Launch separate Powershell script silently

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
20. ## Launch separate Powershell script silently

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?
21. ## Why do I get this error?

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

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

Running Macro Express as an Administrator worked!
24. ## 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.
25. ## Scripts not recognized in Word 2016

You might try running Macro Express as Administrator.
26. ## Scripts not recognized in Word 2016

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?