Jump to content
Macro Express Forums

duchi

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by duchi

  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
  15. Alan, it seems like you're attempting to automate something very similar to what i am looking to accomplish. i've been searching high and low for a couple months now for ways to use java, or vb, or something similar to fill fields and click buttons and finally came across this series which the info in the article got me to thinking: https://www.youtube.com/playlist?list=PL6OYc4rwKjcOu3UL7LYpvO_S2waYO-hVU it's about web scraping using excel but he goes thru and explains ALOT of VBA scripting to accomplish it. it's very intuitive and goes on to how to create and use forms and form controls and assigning tasks to those controls for much of the same logic you and i are looking for thought this might be of some help here regarding external scripts with automating processes using mxp.
  16. not sure how you're requesting to 'capture' values in your scenario, but using the 'Prompt' for value command should work. the loop would continue to log each value from the prompt into your array until a ZERO is entered which a conditional statement can catch and exit the loop. or if you can highlight a value then the 'Pause' command can be utilized. i believe you would assign a variable to the array variable (almost a variable within a variable) and increment it within the array so that you'd have unique variables and not re-use the same variable over and over and ending up with just the last one after the loop is ended. using the array variables at that point to display is almost limitless... use the Message Box, notepad, excel, word, email, etc etc etc
  17. thank you for your quick response Joe! and Cory via PM. all i can say is wow!... i am enlightened. i have just read the article and i apologize for not checking the Articles first... i had read the first 3 but had not yet made it down to Anchors Aweigh. thought is was about boating or pirates and not a clever pun. guess i'll need to get to learning VB or .net or something that can better manipulate the DOM of a webpage. i also watched the vid and think that the application is brilliant!
  18. so i've had this mxpro software since about this past March 2014... i believe that it's the best thing since sliced bread and i've created some really powerful routines using it and have only recently found that this forum existed after searching for some assistance for some scenarios which i've 'hit a wall' with. i believe that i've exhausted the provided programming parameters of mxpro for a few scenarios which i've encountered. at this point, i've been learning a bit of java, c, and vb out of the need to expand the capabilities that i thought i might be able to utilize using the 'external script' function. i've searched this forum and others' for a solution but have not found anything which satisfies the requirements of what i envision. having said that, please forgive me if i may have overlooked a similar thread which has already covered this topic. I'm looking to automate the entry of contents into a web form coded in html/java... fields and button(s). i have seen routines in java and vba which can manipulate the data as i envision it. thus, i thought that i could implement those scripts into my routine to manipulate the form as well....however, it seems that there are specific parameters which the external script command can accommodate. for the record, i have successfully created a mxpro routine which does exactly what i want; however, since there are a few mouse movements involved, the routine will not execute reliably if the window is not sized properly, or if there are different text sizes or zoom properties. and tabbing thru fields DOES work, however, the webpage reacts differently if there are values entered into some fields and thus the amount of tabs can differ based upon what fields have values and those that do not. so the Tab order can change. what i need to do is 3 things(in Internet Explorer): 1. copy the source code of a webpage(which i have already successfully done using right click and moving down the right click menu to 'view source' - there are frames in the page so ctrl>U doesn't work); additionally, i would like this to occur without opening a separate view source window; 2. be able to enter data directly into a form field based upon its field ID/name/value(in other words, not using Tab to move to the field to manipulate its contents); 3. be able to click on a 'submit' button using its name/ID/value(not using the mouse). -the above, all without using the keyboard or mouse. ultimately, i need the routine to be scalable... meaning whatever the user preferences are(i.e. Internet Explorer zoom setting, window size, text size, etc etc) the routine needs to still complete as programmed. i figure that using other programming languages which are more suitable to manipulating web pages and its contents would only expand the ability that mxpro routines can accomplish. i have downloaded, viewed, and ran the external scripts which the gentleman from Insight wrote years ago which all work fine... however, creating my own scripts yielded ONLY the simple "Hello World" output to console from VB's 'MsgBox("Hello World!")' command to print to the console... console.log("Hello World") doesn't output, nor does System.out.println("Hello World"); anything that i have tried does not log to the console or function as it would in an API. i have changed the output type or language type to match the entered type within the 'external script' command. i tried these simple examples to test the external script function... let alone more complex routines to complete the 3 scenarios i outlined above. any suggestions are appreciated and sorry for the long post! just wanted to be thorough. i'm sure more info may be necessary which i can provide.
  19. I'm new to this forum and have been lurking(read 'reading' in the background) for a month or two and appreciate the massive amount of support this software has garnered.... i watched the vid and have read posts about all kinds of scenarios and again, am greatly appreciative of you folks who put in the time and effort to create what I consider 'masterpieces'. Since I've developed a bit of CTS from years/decades of manipulating a keyboard and mouse, creating macro's/applications to streamline my work flow has become an obsession in an effort to reduce those symptoms. thank you very much for your contributions!
×
×
  • Create New...