-
Posts
75 -
Joined
-
Last visited
-
Days Won
3
Content Type
Profiles
Forums
Events
Posts posted by amonaghan
-
-
-
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
-
Is the drop-down list on a web page?
If so, you might be better viewing the HTML code and parsing that instead.
-
Terry, I'm on Windows 10 Home Version 1709 build 16299.214 if it helps.
-
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
-
Terry, there have been 11 newer versions of PSP since ver 8. Maybe it is just a compatibility issue with Win10. Have you tried running it in compatibility mode?
-
They both look identical to me.
-
-
Nothing wrong with your solutions Cory and I really do appreciate the help as it kick started my brain. The only difference was I needed it to take today's date automatically, rather than hard coding it or selecting it from the date picker.
-
I got the second last variable wrong in the DG. Output should be this:-
-
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
A bit of a sledgehammer to crack a nut really, but it seems to work.
-
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.
I need the result here to be 7 exactly. Obviously rounding won't do it here.
<--- Second image not required, but I can't work out how to delete it from my post.
-
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
-
As rberq suggests, it may be that you have set the scope to 'Word' only. Try changing it to 'Global' or better still, tell us what program you are running the macro in.
-
Thanks Cory, I'll look into your suggestions over the weekend.
-
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?
-
Thanks Alan, I like that suggestion and hope to find time at the weekend to try it.
-
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"/> -
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.
-
There is this old example, but I wouldn't say that it fell into the 'easy' category.
-
It appears to be true, unfortunately
https://msdn.microsoft.com/en-us/library/windows/desktop/hh848042.aspx.
-
Yes, I assumed that that was what the delay was for. I tend to do that to to edge on the side of caution.
Ooft! Two double words in the one post. Sorry,
-
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.
-
I'm getting just under 9 seconds on my Windows 10 Intel i7 machine.
Cool file downloader
in Macro Express and Macro Express Pro
Posted
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