Jump to content
Macro Express Forums

duchi

Members
  • Posts

    20
  • Joined

  • Last visited

Recent Profile Visitors

273 profile views

duchi's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Ended up creating an additional macro to call which contains a series of switch/case statements to represent each of the macro's to call. This way, I can take advantage of the built in sharing of variables across macro's, have no timing issues, and jump to the end past conditional statements which don't apply once a match is found so it's fairly efficient. Switch(%strVariableToCompare%) Case: 12345 Macro Run: "macroName1" End Case Case: 54321 Macro Run: "macroName2" End Case ... End Switch
  2. Thank you all for the replies. It seems that I may have muddied the problem a bit trying to explain it. I noticed that I had "Run Macro" as opposed to "Macro Run" as the command which I already knew I would like to use as it contains the characteristics I require. rberq's solution would work if global variables can be reliably passed between the macro's without using the Macro Run command. I've tried the Variable Save, Variable Restore, and the Clear Variables commands to pass variables but with varied results as disposing of the variables didn't occur reliably. Samara's solution would not work since the macro to run is pre-assigned. The problem is that I cannot call a macro by Name because I don't know which macro to call until run time. Sounds more and more like I'll need to make a giant list of switch/case statements to be able to assign a variable to each of the macro's. Thank you guys for your time.
  3. I've been trying to figure out ways to address a scenario which I've been unsuccessful in solving... I would like to utilize the "Wait for this macro to terminate before proceeding" function in the Run Macro command coupled with the ability to share global variables between the main macro and the called macro. I wonder if someone here has a solution or some good alternatives. The scenario: A main script will be initiated, but will call another within its sequence to complete; there are over 100 macros which can be called; which of those macros to call cannot be previously determined(can only be determined at run time). To this point, I have been using short keys to call one of the macro's, as I've used short key association with keywords determined in the main script. example: all 100+ macro's to be called have short key assignments like 001 thru 100+, the main macro gathers the data it needs from a source to determine which of those to call, and then use the Type command to initiate the short key for that macro. This method works, however, the main macro runs thru before the called macro completes. I've solved this with a few Wait For type delays; but I'd like a more accurate way of determining when the called macro is completed prior to the main macro moving on and the ability to share variables. I haven't found a way to use the Run Macro command to call one of those macro's by name because there is not a way to know what the name of the script would be until run time. More specifically, I haven't found a way to make an association with short key 001 and the name of the macro. I noticed that the Run Macro command has a variable option for the Macro Nickname so I've thought about creating a list of the macro's within a sequence to assign a variable to; but I cannot locate a command which would allow this. Does anyone know of a way to associate a macro name with a variable? Am I over thinking this? Run Macro in Variable? Forgive me if the above is unclear. I can re-create it in another way if necessary.
  4. Aloha guys. I had been in regular contact with Joe W. via email a few months back for business related reasons and all of a sudden I've had no email responses and have seen no forum activities by him. I am genuinely concerned. I'm hoping that there are personal non-health related reasons why he is not able to contribute to email and forum correspondence. Would any of you know what Joe's status is? thank you in advance, duchi.
  5. you're printing %EOB_Type% to the message box which is the result of the multiple choice prompt. is the value contained in %Den_code% what you want printed? the text contained between the 2 are the same no? if you want to print the string contained in %Den_code%, then you'll need to change the "Case" statements to point to the specific menu choice text selected in the multiple choice menu and not the choice position i.e. A-ZZ. also, if you are already using the string you want displayed in the multiple choice menu, then i think you can eliminate the Switch/Case routine and just print the menu choice.
  6. after months of sorting out programming code, i've FINALLY been able to get VB coding to work in not only Excel but in mep as well in the external script function...i pieced this together from the youtube series i referenced above. i'm posting it to save people from going thru what i went thru to search for something "simple" to manipulate a form on a webpage. you'll have to modify it to fit your specific requirements but this will give you a very good start. what it does: it will designate and open an Internet Explorer window with the website you specify. it will automatically populate username and password fields with data you specify. it will 'click' on a button to submit the form and logon to the website. remarks: the line 'DoEvents is not an accepted statement in mep; thus it has been commented out. this is just a start... it is not a do all fix all type script. i've tested this and it works within the mep environment under VBscript. you will need to modify some of the coding to adapt to your requirements...specifically the html tags that the data you need is contained within which could be: name, ID, or value. edit - i couldn't change the color of the elements that should be changed... the 'TagName' modifier of objIE.Document.getElementsByTagName in the For loops should be changed to the tag identifier which suits your requirements. the items marked in GREEN need to be modified to fit your requirements.(except "InternetExplorer.Application") i couldn't change the color of this since it appears as a string in quotes in the code snippet and inherits this color code. obviously feel free to re-name the variables to whatever you desire. there is no encryption for the fields available in this script. if someone can see this script, your script password contents are visible as well. this can be tailored to fit the needs of various requirements and not just a logon screen. it can be thought of as being similar to the 'remember me' or autofill type website automation; however it can be modified to do a lot more than just a username and password autofill. be sure to review the TOS of any website you use this on. i use this with a hotkey combo to open a browser and auto logon to a website which i use daily and it works perfectly. hopefully you can utilize it for your use as well if it requires this type of automation. the cool thing about using this is that there is no tabular navigation or mouse manipulations required... it can be used in an Internet Explorer window with any zoom setting and window size and almost any version(i think). completely scalable as i would describe it...and super fast and efficient. set objIE = createObject("InternetExplorer.Application") objIE.Visible = True objIE.Navigate ("http://www.your_website_goes_here.com") ''make sure page is fully loaded Do ''DoEvents If Err.Number <> 0 Then objIE.Quit Set objIE = Nothing End If Loop Until objIE.ReadyState = 4 ''auto enter field data into webpage Set the_input_elements = objIE.Document.getElementsByTagName("input") For Each input_element In the_input_elements If input_element.getAttribute("name") = "field_tag_goes_here" Then input_element.Value = "enter_user_name_here" End If If input_element.getAttribute("name") = "field_tag_goes_here" Then input_element.Value = "enter_password_here" Exit For End If Next ''click on Login button Set the_input_elements = objIE.Document.getElementsByTagName("input") For Each input_element In the_input_elements If input_element.getAttribute("name") = "name_of_button_goes_here" Then input_element.Click Exit For End If Next
  7. i've been looking at this and the post labeled Dynamic Array seems to be somewhat related. the last part of your post i don't quite understand... maybe you can post what you have (without giving away what the purpose is) and someone here can help sort it out and clean it up. so you can begin by creating a multiple choice menu A,B,C... and opening up additional options is fairly straightforward and can be accomplished using conditional statements which will open up additional choices D and E if certain previous choices are made and loop for additional entries, saving the data to unique variables over each repetition. the next module is not as clear. i'm not understanding what the file manipulation is to accomplish. lastly, the bit about how to enumerate the array variables can be done with some string manipulation i believe. maybe start with breaking this up into modules... collect data into array; modify data into date sequenced files?; copy data/files into whatever requirements you have. how far did you get with your script thus far?
  8. Are you saving a password in a script which you've used the 'encrypted text' command and don't want to reveal it in a backup file? Or are you password protecting the script file(s) and don't want the scripts revealed in a backup file? Not understanding the 'text box with line breaks in between' reference. To not allow the backup file(s) to be revealed, specify in the Preferences, the file path which 'backups' are saved to and ensure they are saved to a secured drive and NOT the same place the *.mex file(s) is. Or don't use the provided backup option. Backup the *.mex file(s) to a safe location regularly and not worry about backup files which aren't password protected. This is the route I chose btw. Make zero backups using the Preferences and make them on your own. You can always create a script to make that backup for you! Someone please correct me if my understanding of this concept is wrong but, how does having 10 backups(the default in MEP) in the same place avoid data loss if that volume is destroyed or otherwise becomes corrupted? Unless it's 10 backups in 10 different places...but alas, it doesn't appear that the options allow that.
  9. Like Samrae stated, review the details of the variable. Click the variables tab in the script and see if the variable you are confirming is in the list. Create it if it isn't... review the details and modify them as appropriate. Try not to look at it until you've exhausted the above, but I've included a screen print of how the properties of the StringArray variable should look. Try using names which you've created to keep things simple and understood by you. It seems you may be getting hung up on the concept of creating and naming variables perhaps? I'm confused because in post #9 you referenced variables used correctly...or did another user write that for you? Keep trying, you gotta understand this concept of creating and maintaining variables in an effort to create robust and intuitive scripts on your own.
  10. You have to add new variables to your list of variables by double clicking the line in the script that contains a variable which hasn't been defined. That's the only way I know of to do it other than manually adding a variable to the list. In other words, if you copy and paste a script from another macro (or this forum) that contains a new variable, you have to define it. I thought the latest update of mxp did that automatically but obviously sometimes it doesn't pull them over. be sure to do the above for every line that has undefined variables or you will get the same error msg after each run of the script until all variables have been cinfirmed.
  11. i've never used it before but if you use text variables for the array instead of integers in the script, you could look into the 'join string' command and dump the entire contents of the array without typing out every variable which is especially helpful if you're gonna have more than a few. or use another loop to store into a text file or the registry or other clever ways you can come up with. edit: ok just for fun i tried the join string function and it works beautifully! Variable Set Integer %array_number% to 1 Repeat Start (Repeat 100 times) Variable Set String %OriginalString%: Prompt If Variable %OriginalString% Equals "0" Repeat Exit End If Variable Set String %StringArray[%array_number%]% to "%OriginalString%" Variable Modify Integer %array_number%: Increment End Repeat Variable Modify Integer: %array_length% = %array_length% - 1 Join String %StringArray%[1..100] with " " into %StringJoined% Text Box Display: array length: %array_length% array elements: %StringArray[1]% %StringArray[2]% %StringArray[3]% total array with one space in between: %StringJoined%
  12. oh and to get the length of the array, use the 'store counter in variable' option in the 'repeat start' command and give it a name like array_length. it will include the last zero typed to exit the loop so you can use a modify integer rountine to subtract 1 from the total length if you need to be exact. TextBoxDisplay: array_length new_number[1] new_number[2] new_number[3] etc etc
  13. The last part of my post stated that you'd end up with this series of variables: new_number[1] new_number[2] new_number[3] etc etc You could enter those variables into a msg box (or wherever you need them) to see what they contain.
  14. looks like you're on the right track...here's the way i see it, i would flip the logic around a bit. eliminate the prompt for the number of times to loop and just wait for a ZERO; since as you previously stated, the case for the number of entries can vary so why enter it if you already know how to exit?... so you could start with: 1: Variable Set Integer %array_number% to 1 2: Repeat Start (Repeat 1000 times) 3: Variable Set Integer %number%: Prompt // ENTER INTEGER 4: If Variable %number% Equals "0" 5: Repeat Exit 6: End If 7: Variable Set Integer %new_number[%array_number%]% to %number% 8: Variable Modify Integer %array_number%: Increment 9: End Repeat use the variable values wherever you need them... new_number[1] new_number[2] new_number[3] etc etc
×
×
  • Create New...