floyd
-
Posts
292 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by floyd
-
-
Welcome David
There are no Trig functions in the PGM Functions Library. You can, instead, use the built-in Windows Calculator. Simply create a macro to pass the info back and forth from Macro Express. This can be done using mouse and/or keystrokes along with the clipboard commands or by using Window Control commands.
-
I was unable to import the standalone into my MEX file
Was there an error of some sort during the import?
Can the script be posted on the site or emailed to me?Sure ... once I figure out why all of a sudden I can't upload zip files.
In the mean time, you already have the script. Load the mxe file into a text editor and do a "search and replace" all "PGMCRLF"s with real CR/LFs.
-
There is no global search function that will look through all macros in a library (mex) file. You could create a macro to do it though.
-
Randall is correct (as usual)
Variants are variables not declared specifically as integers, bytes, strings, and so forth. It is left up to the parser to decide how to convert them to run a specific operation. Parsers have rules for this of course, which allows you to take, what is usually a number, and treat it like a string as in: "<IVAR2:11:01:" & intStockCode & Chr(01) & ">". If intStockCode were really a number, you would have had to convert it to string before doing this.
plugging them into a huge blob of html codeCould not have said it any better. Love it!
-
Bob -
You're the best, thank youAppreciate the compliment, but I am not ... and neither is Joe . Kevin at Insight is the best. I have never asked him a question that he could not answer.
Either way is good. With your nested IFs you are really saying "IF this is OK and IF this is OK and IF this is OK, then do the task." But you have used 3 IF/END IF constructs to do it. Using logical ANDs within a single construct results in the same logic. There is no good or bad way to construct logic ... the best way,however, is your own way.
I also placed the:
Variable Set String %T5% "KEY"
Variable Set String %T8% "ORD CHAR"
outside the loop. There is no sense in redefining them each time through the loop.
-
Bob -
The solution is to append the current T1 string (changed or not) to a "save to" string after each pass through the loop and then overwrite the file with the "save to" string:
// Create a CR/LF string Variable Set %T1% to ASCII Char of 010 Variable Set %T13% to ASCII Char of 013 Replace "%T13%" with "%T13%%T1%" in %T13% // Create a "save to" string Variable Set String %T10% "" // Set search and replace variables Variable Set String %T5% "KEY" Variable Set String %T8% "ORD CHAR" // Process the text file ASCII File Begin Process: "ACTASSMEtestfile.txt" (Tab Delimited Text ) If Variable %T1% does not contain "?&ACTASS " AND If Variable %T1% does not contain "NKEY" AND If Variable %T1% contains variable %T5% Replace "KEY" with "%T8%" in %T1% Text Box Display: The new line changed End If // Append current T1 string and the CR/LF string to saved string (T10) Variable Modify String: Append %T1% to %T10% Variable Modify String: Append %T13% to %T10% ASCII File End Process // Overwrite the text file Variable Modify String: Save %T10% to Text File <REM2:><REM2:Create a CR/LF string><ASCIIC:1:1:010><ASCIIC:13:1:013><TMVAR2:21:13:00:000:000:%T13%%T13%%T1%><REM2:><REM2:Create a "save to" string><TVAR2:10:01:><REM2:><REM2:Set search and replace variables><TVAR2:05:01:KEY><TVAR2:08:01:ORD CHAR><REM2:><REM2:Process the text file><ADFBEG:F11:001:000001:000000:c:\temp\ACTASSMEtestfile.txt><IFVAR2:1:01:8:?&ACTASS ><AND><IFVAR2:1:01:8:NKEY><AND><IFVAR2:4:01:7:T5T><TMVAR2:21:01:00:000:000:KEY%T8%><TBOX4:T:1:CenterCenter000278000200:000:The new line changed%T1%><ENDIF><REM2:><REM2:Append current T1 string and the CR/LF string to saved string (T10)><TMVAR2:08:10:01:000:000:><TMVAR2:08:10:13:000:000:><REM2:><ADFEND><REM2:><REM2:Overwrite the text file><TMVAR2:17:10:00:000:000:c:\temp\ACTASSMEtestfile.txtF><REM2:>
-
doolysw -
Here is another option for you:
Even though our PGM Functions Library contains Julian date calculation functions, I think they are not needed in your situation. Instead, imagine that you have a folder named "c:\temp\20051003" (obviously derived from Oct-03-2005). In order to delete it, today must be Nov-03-2005, or "20051103".
You could easily create a "20051103" string using the
Date/Time: Save "yyyymmdd" into %T1% <DT:yyyymmddT:01:3:{P00031}{P00000}{P00000}{P00000}>
command, which generates a string from today's date, less 31 days. Then it is just a matter of using a Repeat with Folder loop to delete folders that are less than or equal to the string.
Instead of a using lot of string to number, number to string conversions, you are simply using the natural string comparison features built into Macro Express, or any other programming language.
-
Are you wanting to compare the actual creation date of a sub-folder or the name of the sub-folder?
-
Does the macro you run rely on other macros, and are they all in the macex.mex library, too?
-
Welcome hcour,
It looks like you dial-up the internet, then you go to the web site, and then launch the EzDownloader.exe program. What does this program do when it is done downloading your stock data? Does it stop and close itself automatically? What happens to the stock data. Does it get put into a file of some sort? How long does the download take?
-
Replace the Variable Modify String: Delete Part of %T11% command line with this one:
<TMVAR2:11:11:00:001:036:>
The Starting Position field cannot be a zero.
-
I assume the macro has recorded the pixel color information, but how would I view it?
I find it easiest to view the status of variables from within the Debug Window. Open the Scripting Editor and then choose Debug -> Debug Window -> Variable Values from the main menu.
And is there a function to search the screen for a certain color?No there is not. You would instead, use the Get Pixel Color inside nested Repeat Loops to scan each pixel. Depending on your screen resolution, a single scan could take some time to finish.
-
Here is a complete list of the DIR command switches and what they mean ... well at least as far as Windows XP is concerned:
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4] [drive:][path][filename] Specifies drive, directory, and/or files to list. /A Displays files with specified attributes. D Directories R Read-only files H Hidden files A Files ready for archiving S System files - Prefix meaning not /B Uses bare format (no heading information or summary). /C Display the thousand separator in file sizes. This is the default. Use /-C to disable display of separator. /D Same as wide but files are list sorted by column. /L Uses lowercase. /N New long list format where filenames are on the far right. /O List by files in sorted order. N By name (alphabetic) S By size (smallest first) E By extension (alphabetic) D By date/time (oldest first) G Group directories first - Prefix to reverse order /P Pauses after each screenful of information. /Q Display the owner of the file. /S Displays files in specified directory and all subdirectories. /T Controls which time field displayed or used for sorting C Creation A Last Access W Last Written /W Uses wide list format. /X This displays the short names generated for non-8dot3 file names. The format is that of /N with the short name inserted before the long name. If no short name is present, blanks are displayed in its place. /4 Displays four-digit years Switches may be preset in the DIRCMD environment variable. Override preset switches by prefixing any switch with - (hyphen)--for example, /-W.
You can see that the /-C switch just turns commas off.
-
MJB -
We've got all the tokens in the variables but now we'll need to get them back out.Can we add them to an array instead and then loop back through our array?
Macro Express 3.x lacks variable arrays.
//Pseudo Code:Repeat %N3% Times
Variable Modify Integer: Inc (%N2%)
Variable Set String %T3% "Text Type:<TMVAR2:09:%N2%:02:000:000:>"
Run Macro in Variable %T3%
End Repeat
I know this isn't right but is the idea at least right?
Yes, you are on the right track. The code below assumes that Excel has focus, the active cell is the first target celll, and the <Enter> key moves to the next row. It loops by incrementing the holding variable each time until it finds an empty one.
Variable Set Integer %N2% to 19 Repeat Until %T2% = "" Variable Modify Integer: Inc (%N2%) Variable Set String %T3% "<TMVAR2:09:02:%N2%:000:000:>" Run Macro in Variable %T3% If Variable %T2% > "" Text Type: %T2%<ENTER> End If Repeat End -------------------- <IVAR2:02:01:19><REP3:08:000001:000001:0002:0:01:><NMVAR:08:02:0:0000001:0:0000000><TVAR2:03:01:<TMVAR2:09:02:%N2%:000:000:>><RUNMACVAR:3><IFVAR2:1:02:4:><TEXTTYPE:%T2%<ENTER>><ENDIF><ENDREP>
-
MJB -
The loop parses the next token each time through and places it into the %T2% string variable. Before looping again we need to save it to the next sequential holding variable, which starts at %T20%. To copy %T2% to %T20% you would normally use the following command in the Script Editor:
Variable Modify String: Copy %T2% to %T20%
which looks like this in the Direct Editor (its native code):
<TMVAR2:09:20:02:000:000:>
We are, however, needing to increment to the next holding variable. Manually it would be like this:
First time through the loop: Variable Modify String: Copy %T2% to %T20%
Next time through: Variable Modify String: Copy %T2% to %T21%
Next time: Variable Modify String: Copy %T2% to %T22%
... and so on
The problem is to programmatically increment the holding variable without having to use constructs like If/End If or Switch/End Switch. Thus, the Run Macro in Variable command. It takes a command string written as native code and runs it as if it were the actual command, which is what this sequence does:
Variable Modify Integer: Inc (%N2%)
Variable Set String %T3% "<TMVAR2:09:%N2%:02:000:000:>"
Run Macro in Variable %T3%
We increment %N2% each time through the loop (20, 21, 22, and so forth). Then we create a command string %T3% using the %N2% variable as a replacement for the normally static to position in the native command. The result is this:
First time through the loop: <TMVAR2:09:20:02:000:000:>
Next time through: <TMVAR2:09:21:02:000:000:>
Next time: <TMVAR2:09:22:02:000:000:>
... and so on
And the Run Macro in Variable command runs the command each time.
-
Good point ... thanks Randall.
-
Rick D -
There is an easy way to parse tokens from a string if you have the PGM Functions Library. If not, here is a bit of code that will do the job for you. The example uses the string you provided in your post. It simply extracts each bullet and places them in sequential variables. You will of course want to modify it to suit your situation; adding the code to write the the cells, and so forth.
// Set the first "holding" string variable to 19 so that we do not have to deal with leading // zeros in the dynamic command. This means that we will use %T20% and up to hold the individual // bullets extracted from the main string. Variable Set String %T1% "*Document Users*Educate users and leadership on appropriate access controls and passwords*Place “Authorized Personnel Only” Sign on all entrances*Long Term*On going review of current procedures*Yearly review" Variable Set Integer %N2% to 19 // Repeat extracting bullets until the main string contains nothing. Repeat Until %N1% = 0 // Replace the next occurrence of an asterisk with a tilde. It will always be the first // character in what remains of the main string. Replace "*" with "~" in %T1% // Get position of the next asterisk. If result is zero then we have reached the last bullet. Variable Set Integer %N1% from Position of Text in Variable %T1% If Variable %N1% > 0 Variable Modify Integer: Dec (%N1%) Variable Modify String: Copy Part of %T1% to %T2% Else Variable Modify String: Copy %T1% to %T2% End If // Remove the current bullet from the main string and replace the tilde with an asterisk. Replace "%T2%" with "" in %T1% Replace "~" with "*" in %T2% // Increment the next "holding" variable and run the dynamic "Set Variable To" command // "<TMVAR2:09:20:02:000:000:>". Variable Modify Integer: Inc (%N2%) Variable Set String %T3% "<TMVAR2:09:%N2%:02:000:000:>" Run Macro in Variable %T3% Repeat End ---------- <REM2:Set the first "holding" string variable to 19 so that we do not have to deal with leading><REM2:zeros in the dynamic command. This means that we will use %T20% and up to hold the individual><REM2:bullets extracted from the main string.><TVAR2:01:01:*Document Users*Educate users and leadership on appropriate access controls and passwords*Place “Authorized Personnel Only” Sign on all entrances*Long Term*On going review of current procedures*Yearly review><IVAR2:02:01:19><REM2:><REM2:Repeat extracting bullets until the main string contains nothing.><REP3:08:000001:000002:0001:0:01:0><REM2:><REM2:Replace the next occurrence of an asterisk with a tilde. It will always be the first><REM2:character in what remains of the main string.><TMVAR2:21:01:00:000:000:*~><REM2:><REM2:Get position of the next asterisk. If result is zero then we have reached the last bullet.><IVAR2:01:13:1:*><IFVAR2:2:01:4:0><NMVAR:09:01:0:0000001:0:0000000><TMVAR2:10:02:01:001:N01:><ELSE><TMVAR2:09:02:01:000:000:><ENDIF><REM2:><REM2:Remove the current bullet from the main string and replace the tilde with an asterisk.><TMVAR2:21:01:01:000:000:%T2%><TMVAR2:21:02:00:000:000:~*><REM2:><REM2:Increment the next "holding" variable and run the dynamic "Set Variable To" command><REM2:"<TMVAR2:09:20:02:000:000:>".><NMVAR:08:02:0:0000001:0:0000000><TVAR2:03:01:<TMVAR2:09:%N2%:02:000:000:>><RUNMACVAR:3><REM2:><ENDREP>
-
It looks correct. Another option is to use the Switch/End Switch construct.
Multiple Choice Menu: Open a folder Switch (T1) Case: A Open Folder: c:\blue End Case Case: B Open Folder: c:\red End Case Case: C Open Folder: c:\green End Case End Switch ---------- <MENU2:2:T:01:CenterCenter:Open a folderBlue Red Green><SWITCH:T1><CASE:A><MYCOMP:c:\blue><ENDCASE><CASE:B><MYCOMP:c:\red><ENDCASE><CASE:C><MYCOMP:c:\green><ENDCASE><ENDSWITCH>
-
Randall -
I have not checked how you know if "vbs" is ready?If you mean how does the macro know if the Windows Script has finished, there is no need to know in this case. Because there is no post-processing tasks for the macro to do, it ends immediately after firing the script.
-
Randall -
I get "Can't find [long filename].vbs the first time I run,if there is already a Window open for IE6, the macro seems not to complete and hit the "login" button at the endI am unable to duplicate these.
-
It seems to me that the network speed would have nothing to do with the clipboard. Windows takes a lot of time to process the clipboard. Here is an excerpt from the Macro Express Explained book that may shed some light on the subject.
Global Clipboard DelayThis is not a command, but rather a system-wide preference. Windows needs extra time to process the clipboard. So, Macro Express added a global delay that it applies after every Clipboard command, and can be found in the Delays section of the Preferences dialog. (Options | Preferences | Delays).
There is no wait-for-clipboard-to-finish command. With all the other Wait For commands that Macro Express has, I am sure if it were possible, we would have it, instead of a global delay. Without this delay, Macro Express would continue processing commands while Windows is still playing with the clipboard, causing your macro possibly to misfire. All preferences are global in scope, which means that any setting here will affect the Clipboard commands in each macro that uses them. The default is a 250 millisecond (1/4-second) delay after each command. I found it to be a perfect setting on my system. But, because no two systems are the same, you will want to experiment to find the best setting for yours.
-
By Null, I think you mean Empty.
We probably do not use the same version of QuickBooks as you, and even if we do our invoice format is different. That being said, we do use macros for filling invoices and have no problems at all. Are you sure of your Text Type keystokes? Are you sure that the cursor is where it needs to be prior to each Text Type?
As Randall suggested, if the variable is empty, skip it.
-
Welcome ocillmusic -
If you post the Word document, or at least one page of it, then the group can look at it and possibly determine what you need to do.
-
When Joe and Paul first begin putting together the PGM Functions Library, environment variables were used. As it turned out, they did not fit the requirements of being able to save and restore multiple layers of variables. Why is this important? Well, If you are planning on creating reusable macros, then anything that happens within those macros must be entirely independent of anything outside of them.
A user must be able to call these little black boxes at any point in a macro application (even recursively) without changing, or affecting in any manner, the state of variables in the caller (parent) macro. And what about a situation where the user calls a macro, which calls another macro, and in turn calls another one, and then another? Where are we now, 5 or 6 level deep into the macro application? Environment variables cannot handle that kind of load.
Beginning on page 272 of the Macro Express Explained book, there is a section that explains how to properly handle variables within the multiple layers of cascading macros. This is also explained in the PGM Functions Library manual beginning on page 72.
Execute Once When A Window Opens
in Macro Express 3.x
Posted
One of the automatic activation features built in to Macro Express is Window Title. It is located in the Activation Pane of the Properties Tab. Whenever the window title of your choice gains focus, the macro will fire.
Remember, it is when a window gains focus. For example, clicking back and forth between the target window and your desktop 3 times will fire the macro 3 times.