yaqwa Posted December 10, 2011 Report Share Posted December 10, 2011 Hi my Friends - maybe you can help me a bit! I have at least 32 schedules a day - and yes i can see them in a list :-) So what i want to do is this Click on a button or create a shoertcut (whatever) and i get a window who tells me when the last schedule was ansd when the next schedule is and begins. Means i (in the perfect way) want to see a window with Now it is 14:00 Next Schedule begins in 30 min and 00 sec at 14:30 Help please What must i do? BTW. The Times are differnet but the same every day. Here is some times i need every day 12:37 13:15 13:45 14:45 15:45 16:45 17:15 14:40 14:43 17:45 Quote Link to comment Share on other sites More sharing options...
terrypin Posted December 10, 2011 Report Share Posted December 10, 2011 Are all of those existing ME Pro macros you already run? I think Scheduled Tasks built into Windows might be a better approach, as it displays the sort of information you want: -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
yaqwa Posted December 10, 2011 Author Report Share Posted December 10, 2011 Are all of those existing ME Pro macros you already run? I think Scheduled Tasks built into Windows might be a better approach, as it displays the sort of information you want: -- Terry, East Grinstead, UK nono i think i explained it wrong. I have normal schedules i have to do - not in me pro or so just to do's over the day but i want to know how long it takes for the next todo do i explained it better now? sorry for my english Quote Link to comment Share on other sites More sharing options...
yaqwa Posted December 10, 2011 Author Report Share Posted December 10, 2011 next try to explain :-) normally i look at my watch - see it is 14:00 than i look at my desktop to see when the next date happens so i look at a lot of dates and must look where the next date happens. so what i want to do in MEX pro is just to click on a icon or a shortcut and a textbox appears who just told me what time it is now and how long it is until the next date. so at the moment i look at my pc watch and than look at this picture on my desktop and count for myself how long until the next date. And now i want a It is 17:00 - your next date is in 22 minutes at 17:22 for example thats all Quote Link to comment Share on other sites More sharing options...
terrypin Posted December 11, 2011 Report Share Posted December 11, 2011 Doesn't look too difficult. What does your macro look like so far? Are you specifying the schedules as a text or CSV or Excel file with a fixed name and location, or what? With the data in time sequence, a search or 'look-up' followed by use of the Date/Time commands and a bit of calculation should do it. -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
yaqwa Posted December 11, 2011 Author Report Share Posted December 11, 2011 Doesn't look too difficult. What does your macro look like so far? Are you specifying the schedules as a text or CSV or Excel file with a fixed name and location, or what? With the data in time sequence, a search or 'look-up' followed by use of the Date/Time commands and a bit of calculation should do it. -- Terry, East Grinstead, UK i can create a txt file or an excel sheet - no problem with both - what you think it is better so far i just created a time and a text box but i do not know how to insert the other times and how to use it <DATE/TIME Format="hh:mm:ss" Flags="\xB0" Date="01.06.2009 13:42:08" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="25" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%Now%" IsDateVar="FALSE" _COMMENT="Set the current time."/><TEXT BOX DISPLAY Title="Countdown" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 Now it is %NOW%\r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _COMMENT="Create the initial text box to be updated."/> Quote Link to comment Share on other sites More sharing options...
terrypin Posted December 12, 2011 Report Share Posted December 12, 2011 Sorry, but I'm having trouble following you. In your first post you said: "I have at least 32 schedules a day - and yes i can see them in a list." I asked "Are you specifying the schedules as a text or CSV or Excel file with a fixed name and location, or what?" Now you seem to be asking me what sort of file to put your schedule in! Once your data (your 'schedule') is in a text file of some sort you can process it as a single variable or each line with commands from ASCII File Process or Text File Process. Or, if the data is very small, just use a variable and work on that. I see you have 91 posts logged and joined 6 years ago, so I assume you know your way around ME Pro. -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
yaqwa Posted December 13, 2011 Author Report Share Posted December 13, 2011 Sorry - it is my bad english So no schedules - i meant tasks or dates! and yes 6 years and i can do a lot - but i have problems with these if /else things and variables - these are thing i do not really know how to create. So i have a variable to send the correct time to a text box. But i really do not know how to compare this with the dates and to see this in the box. i created a txt file where i can put in every row a time so it look like this 13:15 13:45 14:45 15:45 16:45 17:15 14:40 14:43 17:45 18:15 19:35 20:00 but what i do not understand is - how to take these times in a variable so i get a text box with " it is 14:00" (this i can do :-)) "next date is in 45 minutes at 14:45" (this is what i do not know how to do) so what i did it this (thanks for the help with the text file process) <DATE/TIME Format="hh:mm:ss" Flags="\xB0" Date="01.06.2009 13:42:08" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="25" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%Now%" IsDateVar="FALSE" _COMMENT="Set the current time."/><TEXT FILE BEGIN PROCESS Filename="C:\\Users\\PK\\Desktop\\Dates.txt" Start_Record="1" Process_All="TRUE" Records="1" Variable="%Dates%"/> <TEXT FILE END PROCESS/> <TEXT BOX DISPLAY Title="Countdown" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 Now it is %NOW%\r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _COMMENT="Create the initial text box to be updated."/> but i think my brain did not understand how to go on Quote Link to comment Share on other sites More sharing options...
terrypin Posted December 13, 2011 Report Share Posted December 13, 2011 ... but i think my brain did not understand how to go on Did you read the detailed Help topic 'Text File Process'? Your macro has no commands between the start and end of the process, so you cannot expect it to do anything! Your list of times had two entries (14:40 and 14:43) out of sequence. Or perhaps you typed these carelessly and they should have been 17:40 and 17:43? I have changed your variable name from Dates to Times, as that's what this list contains. I've also changed the file name to Times.txt, but I've left its path the same as you specified, to minimise the changes you need to make. It makes the logic easier if you arrange the list in descending order, like this: 20:00 19:35 18:15 17:45 17:15 16:45 15:45 14:45 14:43 14:40 13:45 13:15 I'm afraid I'm still not sure I understand exactly what you're trying to achieve, but based on my assumptions here's something to get you started. I've left you to do the date/time/decimal work and the subtraction to calculate the remaining time. Good luck. <DATE/TIME Format="hh:mm" Flags="\xB0" Date="30/12/1899" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="25" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%Now%" IsDateVar="FALSE" _COMMENT="Set the current time."/> <TEXT FILE BEGIN PROCESS Filename="C:\\Users\\PK\\Desktop\\Times.txt" Start_Record="2" Process_All="TRUE" Records="1" Variable="%Times%"/> <IF VARIABLE Variable="%Now%" Condition="\x03" Value="%Times%" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="Countdown" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs20 The time now is %NOW%\r\n\\par \r\n\\par Which is later than ALL the times in the list!\\b0\\fs16 \r\n\\par \\pard \r\n\\par }\r\n" Left="821" Top="Center" Width="318" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _COMMENT="Display appropriate message."/> <END IF/> <IF VARIABLE Variable="%Now%" Condition="\x05" Value="%Times%" IgnoreCase="FALSE"/> <COMMENT Value="Script here to calculate minutes remaining."/> <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs20 The time is now \\f1 %Now%\r\n\\par \r\n\\par \\f0 The next schedule is at %Times%\r\n\\par \r\n\\par Which is in xxx minutes.\\f1 \r\n\\par \\pard\\b0\\fs16 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <BREAK _COMMENT="No need to process further Time entries."/> <END IF/> <TEXT FILE END PROCESS/> Note that I've started processing from record 2 (and left an empty line in record 1). I'm puzzled by the unexpected behaviour I see when I process from record 1, these odd characters in the displayed record: -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
yaqwa Posted December 13, 2011 Author Report Share Posted December 13, 2011 Thanks it is working in that way so i get no data or at least one time But always the time who is found at the second record line. Btw. yes i changed the times - this is the real times at the end of this message - but ok i tried and read the text file process - i understand now that mex reads all the lines in the text file into variables. ok but why does he always shows the time standing in the first (or second row of the file)(i did not get these odd characters so i selected the 1 record) Hey it is ok to give me the work to calculate and to the work - but i really do not know how. oh - when i write this - i got ideas but i did not get the point how to do it in my simple words ............... i think i have to read the currend time chenged in decimal? then i must calculate the difference between %now% and one of the rows who comes next to this time so if it is 20:00 i have to change it into 2000 then the next row to find is 2030 subtract 2030 with 2000 and get 30 change from decimal into time = 30 minutes so first i have to change the %now% time into decimal then i have to change the times in the text file into decimal? the convert time/into decimal - i had to create a new variable........? and then i do not know how does mex knows what he should convert when i must use a new variable how can i tell him that it must be the %now% and the "times"???? how do i or mex finds out where the next number is? how does mex finds out it is 2030 (in this example) the more i think of this the less i understand ---------------------- i know you have more to do than be my baby sitter - but can you at least tell me the commands i have to use ??? with one or two hints? so i can use the help ? --------------------- 20:55 20:30 20:00 19:35 18:15 17:45 17:15 16:45 15:45 14:45 14:43 14:40 13:45 13:15 12:37 12:17 12:07 11:47 11:33 11:00 so again - i attached the macro and my text file Times.txt <DATE/TIME Format="hh:mm" Flags="\xB0" Date="30.12.1899" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="25" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%Now%" IsDateVar="FALSE" _COMMENT="Set the current time."/><TEXT FILE BEGIN PROCESS Filename="C:\\Users\\PK\\Desktop\\Times.txt" Start_Record="2" Process_All="TRUE" Records="1" Variable="%Times%"/> <IF VARIABLE Variable="%Now%" Condition="\x03" Value="%Times%" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="Countdown" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs20 The time now is %NOW%\r\n\\par \r\n\\par Which is later than ALL the times in the list!\\b0\\fs16 \r\n\\par \\pard \r\n\\par }\r\n" Left="821" Top="Center" Width="318" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x02" Delay="1" _COMMENT="Display appropriate message."/> <DELAY Flags="\x01" Time="3"/> <MACRO STOP/> <END IF/> <IF VARIABLE Variable="%Now%" Condition="\x05" Value="%Times%" IgnoreCase="FALSE"/> <COMMENT Value="Script here to calculate minutes remaining."/> <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs20 The time is now \\f1 %Now%\r\n\\par \r\n\\par \\f0 The next schedule is at %Times%\r\n\\par \r\n\\par Which is in xxx minutes.\\f1 \r\n\\par \\pard\\b0\\fs16 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <BREAK _COMMENT="No need to process further Time entries."/> <END IF/> <TEXT FILE END PROCESS/> Quote Link to comment Share on other sites More sharing options...
yaqwa Posted December 16, 2011 Author Report Share Posted December 16, 2011 Any chance you can tell me where i can read about that calculation thing? i did not find anything in The help file! Quote Link to comment Share on other sites More sharing options...
terrypin Posted December 17, 2011 Report Share Posted December 17, 2011 I'm sorry but I think the language barrier is too high! But you're on the right lines now. I suggest you: 1. Study the Date/Time commands 2. Write a couple of simple macros to subtract times and get them working, without any Repeat loops. 3. Study Repeat loops, as (surprisingly IMO!) you seem to have some difficulty with this basic area (unless I've misundersttod). 4. Similarly, you seem a bit confused about how to use variables, so some more reading is needed in that IMO. 5. Use the Search tool here widely to follow other date calculations, looping, variables, etc. An alternative would be for you to pay someone (Cory?) to write the macro for you! -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
yaqwa Posted December 17, 2011 Author Report Share Posted December 17, 2011 ok thanks so far. If you have an example macro how this substract think is working i will be very thankfull! I will read the help files - but you know if you have a simple axample you can study it is really better then the words you read. Quote Link to comment Share on other sites More sharing options...
terrypin Posted December 17, 2011 Report Share Posted December 17, 2011 ok thanks so far. If you have an example macro how this substract think is working i will be very thankfull! I will read the help files - but you know if you have a simple axample you can study it is really better then the words you read. OK, I give in! I was hoping to avoid having to actually do it for you. Not just because it's time consuming but also because I think you'd learn more by doing it yourself. But I'll give you the benefit of the doubt and and accept that you've put some effort in. Study the macro carefully. I've commented it generously explaining each stage. The final result after a test run looks like this: Here's the code, and an MEX file is attached. <COMMENT Value="Macro for Yaqwa re thread http://pgmacros.invisionzone.com/index.php?showtopic=5021&st=0&gopid=21577"/> <DATE/TIME Format="hh:mm" Flags="\xB0" Date="30/12/1899" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="25" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%tNow%" IsDateVar="FALSE" _COMMENT="Set the current time."/> <TEXT FILE BEGIN PROCESS Filename="C:\\Users\\PK\\Desktop\\Times.txt" Start_Record="2" Process_All="TRUE" Records="1" Variable="%tTimes%"/> <IF VARIABLE Variable="%tNow%" Condition="\x05" Value="%tTimes%" IgnoreCase="FALSE"/> <COMMENT Value="Store it as tNext and look at next tTimes."/> <VARIABLE MODIFY STRING Option="\x08" Destination="%tNext%" Variable="%tTimes%" NoEmbeddedVars="FALSE"/> <END IF/> <TEXT FILE END PROCESS/> <COMMENT Value="Now need to calculate the number of minutes between time Now and time of next schedule."/> <COMMENT Value="IOW, calculate the minutes between tNow andtNext."/> <VARIABLE SET INTEGER Option="\x13" Destination="nNowHours"/> <COMMENT Value="So first express current time as Minutes. (Ignore days, months, years. And ignore seconds.)"/> <COMMENT Value="There are several ways of doing this. Here's one:"/> <COMMENT Value="Method 1"/> <VARIABLE SET INTEGER Option="\x14" Destination="nNowMinutes"/> <VARIABLE SET INTEGER Option="\x13" Destination="%nNowHours%"/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%nNowTotalMinutes%" Value1="%nNowHours%" Value2="60"/> <VARIABLE MODIFY INTEGER Option="\x00" Destination="%nNowTotalMinutes%" Value1="%nNowTotalMinutes%" Value2="%nNowMinutes%"/> <COMMENT Value="Now need to express tNext as minutes."/> <SPLIT STRING Source="%tNext%" SplitChar=":" Dest="T" Index="1"/> <COMMENT Value="So hours element will now be in T(1) and minutes in T(2). But both are still in text form, so conversion is now necessary."/> <VARIABLE MODIFY STRING Option="\x04" Destination="%T[1]%" Variable="nNextHours"/> <VARIABLE MODIFY STRING Option="\x04" Destination="%T[2]%" Variable="%nNextMins%"/> <COMMENT Value="Now do the simple calculation as before."/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%nNextTotalMinutes%" Value1="%nNextHours%" Value2="60"/> <VARIABLE MODIFY INTEGER Option="\x00" Destination="%nNextTotalMinutes%" Value1="%nNextTotalMinutes%" Value2="%nNextMins%"/> <COMMENT Value="So now we can do the subtraction."/> <VARIABLE MODIFY INTEGER Option="\x01" Destination="%nDifferenceMins%" Value1="%nNextTotalMinutes%" Value2="%nNowTotalMinutes%"/> <TEXT BOX DISPLAY Title="Result" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs24 It is now = \\f1 %tNow%\r\n\\par Next\\f0 schedule is at = \\f1 %tNext%\r\n\\par \r\n\\par \\f0 Which is in %nDifferenceMins% minutes\\b0\\f1\\fs16 \r\n\\par }\r\n" Left="756" Top="454" Width="537" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> -- Terry, East Grinstead, UK Yaqwa.mex Quote Link to comment Share on other sites More sharing options...
yaqwa Posted December 17, 2011 Author Report Share Posted December 17, 2011 Thank you soooooooo much. I swear i will work on it and learn what and how you did it so i can do it for my self the next time :-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.