Jump to content
Macro Express Forums

amonaghan

Members
  • Posts

    75
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by amonaghan

  1. Cory,

    I've searched high and low through the URL I posted and can't find any reference to the link you posted. Where did you find that from?

    How did you know to use the bold part, as I can't find any reference to it in the rest of the code?  https://www.premierinn.com/whitbread-services-unsecured/hotels/search/54.97814/-1.61622/40.

    Incidentally, great work so far, I still need date/price info, but don't know where (other than trawling through all the code) where or what link to use.

    I found several JSON->CSV/XLSX converters online for later as I tried loading as JSON data file in Excel 2016 but not yet experienced enough in handling the Data module (formally Power Pivot).

    Alan

     

  2. Cory,

    I know this is an old thread, but I can use the above External Script to grab a hotel website code, but this doesn't seem to include the data elements as displayed when using Chrome.

    I know I can fudge it and do the following:-

    1) Go to Elements tab

    2) Select Top most element

    3) Edit as HTML

    4) Select All

    5) Copy etc.

    but this kind of defeats the purpose of using VBscript.

    Do you know what lines in the above code that I need to change so that I can download the actual 'Elements' script rather than just the surrounding HTML code?

    I've looked at the code above and can't see how to do this.

    Regards,

    Alan

  3. Terry,

    I found a copy of PSP 9 lying around and the following works for me. Running man goes shortly after PSP starts up.

    <ACTIVATE OR LAUNCH Title="Jasc Paint Shop Pro" Exact_Match="FALSE" Wildcards="FALSE" Path="C:\\Users\\Alan\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Jasc Software\\Jasc Paint Shop Pro 9.lnk" Mode="\x00" Default_Path="TRUE" Wait="1" Wait_For_Program="12"/>

    Not sure if it matters, but I used a Shortkey (PSP).

    Alan

  4. Thanks everyone for the help. It gave me a few thing to think about. I even tried using VBScript to no avail.

    I eventually got this to work, although it requires 3 different variable types for each date.

    <DATE/TIME Flags="\xB0" Date="15/05/2017 20:28:11" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="0" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%CurrentDate%" IsDateVar="TRUE"/>
    <CONVERT DATE/TIME TO DECIMAL Source="%CurrentDate%" Dest="%dCurrentDate%"/>
    <VARIABLE MODIFY DECIMAL Option="\x06" Destination="%dCurrentDate%" Variable="%nCurrentDate%"/>
    <DATE/TIME Flags="\x93" Date="15/05/2017 20:35:05" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="0" Second_Offset="0" Prompt="Enter Target Date" Left="Center" Top="Center" Monitor="0" Variable="%TargetDate%" IsDateVar="TRUE"/>
    <CONVERT DATE/TIME TO DECIMAL Source="%TargetDate%" Dest="%dTargetDate%"/>
    <VARIABLE MODIFY DECIMAL Option="\x06" Destination="%dTargetDate%" Variable="%nTargetDate%"/>
    <VARIABLE MODIFY INTEGER Option="\x01" Destination="%nDateDiff%" Value1="%nTargetDate%" Value2="%nCurrentDate%"/>
    <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %CurrentDate%\r\n\\par %dCurrentDate%\r\n\\par %nCurrentDate%\r\n\\par %TargetDate%\r\n\\par %TargetDate%\r\n\\par %nTargetDate%\r\n\\par \r\n\\par \\f1 Diff = %nDateDiff%\\f0 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    Date/Time: Set %CurrentDate% to the current date/time
    Convert Date/Time to Decimal: %CurrentDate% => %dCurrentDate%
    Variable Modify Decimal %dCurrentDate%: Truncate to Integer (%nCurrentDate%)
    Date/Time: Set %TargetDate% to a user prompted date/time
    Convert Date/Time to Decimal: %TargetDate% => %dTargetDate%
    Variable Modify Decimal %dTargetDate%: Truncate to Integer (%nTargetDate%)
    Variable Modify Integer: %nDateDiff% = %nTargetDate% - %nCurrentDate%
    Text Box Display: 

    Output

    591a066f2dc8f_DateCalculator2.PNG.de7d0b0f3ed247869dc2530fde04a1fb.PNG

    A bit of a sledgehammer to crack a nut really, but it seems to work.

  5. Thanks, it looks easy like that when prompting for Date only rather than current Date/Time which doesn't seem to give the option of Date only.

    Simple macro with displayed results below:-

    <DATE/TIME Flags="\xB0" Date="13/05/2017 14:00:00" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="0" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%dCurrent%" IsDateVar="TRUE" _COMMENT="   Store Current Date"/>
    <DATE/TIME Flags="\x93" Date="13/05/2017 16:03:21" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="0" Second_Offset="0" Prompt="Enter date of stay" Left="Center" Top="Center" Monitor="0" Variable="%dDate%" IsDateVar="TRUE" _COMMENT="   Enter Future Date"/>
    <VARIABLE MODIFY DATE/TIME DateVar="%dDateDiff%" Option="\x01" LeftVar="%dDate%" RightVal="%dCurrent%" UseInteger="TRUE" MathOpt="\x00" _COMMENT="   Difference = Future Date - Current Date"/>
    <TEXT BOX DISPLAY Title="Date Calculation" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 Current Date: %dCurrent%\r\n\\par End Date: \\f1 %dDate%\r\n\\par \\f0 Difference: \\f1 %dDateDiff%\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>

    As you can see, I get a decimal part which is undesirable for what I want.

    59189ad7f1cb5_DateCalculation.PNG.52648fef0f029bb450598aa6cad0a81c.PNG

    I need the result here to be 7 exactly. Obviously rounding won't do it here.

     

    Date Calculation.PNG <--- Second image not required, but I can't work out how to delete it from my post.

  6. I know this has come up before but previous posts have just confused me further. I'm looking for a simple solution to the following:-

    Store today's date to variable (date or other type?)

    Set new date in future and store to variable (date or other type?)

    Calculate difference between the two dates in whole days. I'm not looking for time calculations on whole number of days. This should be easy, but I'm getting very frustrated with the way the Date functions work.

    e.g. Today  is 13/05/2017 - VarA

    A week from now is 20/05/17 - VarB

    VarB - VarA = 7

    P.S. I'm a bit upset today as my football team just got relegated to the third tier of Scottish football:(

  7. I followed the instruction posted in another thread here :- https://www.macros.com/faq/1.92.html for setting Macro Express up to run as an Administrator.

    Now I've noticed a simple one line macro desktop shortcut doesn't work.

    The only line in the macro is:-

    Hibernate

    I tried sending it to a log file and it doesn't record anything.

    If I run the same macro from Macro Explorer, it works every time.

    Oddly, if I right click the desktop shortcut and 'Run as Administrator' it DOES work, but not when double clicking or right clicking and selecting Open.

    Can someone else see if they are seeing this behaviour please before I submit it to support?

  8. I have gone back to using an older macro which I wrote to wait for a page to load in Chrome. It used the colour changes of the 'Reload' icon near the top left of the browser.


    Unfortunately, it looks like Google in their infinite wisdom (sic!) have decided to change the behaviour of the reload icon. It used to only change to a darker grey before fully loading the page, then it would revert to a lighter grey/white colour.

    The problem is, they seem to have changed its behaviour to now change to the darker grey as soon as you hover over it (which is what my test for change looked for while loading) this change has now broken my macro as it never returns to the 'loaded' state while the mouse cursor is hovering over it.


    Does anyone have any suggestions?


    Code below.



    Variable Set Integer %nCheck% to 0
    Get Mouse Position into (nXpos, nYpos) Relative to Current Window
    Mouse Move: 81, 55 Relative to Current Window
    Delay: 100 milliseconds
    Repeat Until %nCheck% Equals "1"
    Get Pixel Color at (82, 55) Relative to Current Window into %nPixelColour%
    Delay: 100 milliseconds
    Text Box Display:
    If Variable %nPixelColour% Equals "14671839"
    Variable Set Integer %nCheck% to 1
    End If
    End Repeat
    Mouse Move: %nXpos%, %nYpos% Relative to Current Window


    <VARIABLE SET INTEGER Option="\x00" Destination="%nCheck%" Value="0"/> <GET MOUSE POSITION Option="\x01" X="nXpos" Y="nYpos"/> <MOUSE MOVE Option="\x02" X="81" Y="55" _PROMPT="0x000A"/> <DELAY Flags="\x02" Time="100"/> <REPEAT UNTIL Variable="%nCheck%" Condition="\x00" Value="1"/> <GET PIXEL COLOR Option="\x01" Rel_To_Screen="FALSE" X="82" Y="55" Destination="%nPixelColour%"/> <DELAY Flags="\x02" Time="100"/> <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\f0\\fs16 %nPixelColour%\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="109" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <IF VARIABLE Variable="%nPixelColour%" Condition="\x00" Value="14671839" IgnoreCase="FALSE"/> <VARIABLE SET INTEGER Option="\x00" Destination="%nCheck%" Value="1"/> <END IF/> <END REPEAT/> <MOUSE MOVE Option="\x02" X="%nXpos%" Y="%nYpos%" _PROMPT="0x000A"/>

  9. I had an issue with macros not firing at all when engaging with Chrome. The workaround I found to work was to log macro errors to a log file. I have no idea why this worked, but it seems to have fixed my issues.

     

    To do this:

     

    1) Double click on the macro in Macro Explorer

    2) Go to the Miscellaneous tab

    3) Check 'Log all errors'

    4) Select 'Save to File'

    5) Add something like this:- "C:\Users\YourName\Documents\Insight Software\Macro Express\Macro Logs\chrome macros.log" (without the quotes)

    6) Click on [save and Close]

     

    Your documents folder may be different from mine.

     

    As I said, I don't know why this works for me and why I need to do it, but it might help get you moving in the right direction.

  10. I just did some quick comparisons in the various compatibility modes and the sluggishness starts from Win7 onward to Win10.

     

    I understand that these are compatibility modes and not the full kernel version of the OS, so it may be different in versions prior to Win10.

     

    I also agree the line rberq mentions, seems to be redundant here and does slow macro down.

     

    Interesting, if not a bit frustrating, as I don't particularly wish to run the product in compatibility mode.

×
×
  • Create New...