Hello guys,
I have a list urls like this which is contant....
Please help me with the script to to get the hylighted text which is in bold.
https siteurl.com /abcbac/ABCD123.php Broken Link for safety
Your help would be greatly appreciated.
Extract Text from URL Topic is solved
-
- Posts: 30
- Joined: 09 Mar 2019, 21:27
Re: Extract Text from URL
Code: Select all
URL := "https siteurl.com /abcbac/ABCD123.php"
MsgBox % "hylighted text:`n`n """ StrSplit(URL,"/").Pop()""""
-
- Posts: 30
- Joined: 09 Mar 2019, 21:27
Re: Extract Text from URL
Thank for your quick response. I really sorry for not being clear. What I am trying to do is import a list of urls in that format then the script will extract the text in bold then export these extracted text in a .txt file. Thank you again for your help.GEV wrote: ↑18 Aug 2019, 09:56https://www.autohotkey.com/docs/objects/Object.htmCode: Select all
URL := "https siteurl.com /abcbac/ABCD123.php" MsgBox % "hylighted text:`n`n """ StrSplit(URL,"/").Pop()""""
- flyingDman
- Posts: 2798
- Joined: 29 Sep 2013, 19:01
Re: Extract Text from URL
You are still not clear. What do you mean by "import" a list of urls. Where is this list? What's the format of the list?I really sorry for not being clear.
@GEV Nice use of POP()!
Last edited by flyingDman on 18 Aug 2019, 17:49, edited 1 time in total.
14.3 & 1.3.7
Re: Extract Text from URL Topic is solved
a short example to get last part from url , read url from file and save to new file
Code: Select all
#warn
setworkingdir,%a_scriptdir%
f1=%a_desktop%\input.txt
f2=%a_desktop%\output.txt
ifnotexist,%f1%
{
s=
(
https://siteurl.com/abcbac/ABCD121.php
https://siteurl.com/abcbac/ABCD122.php
https://siteurl.com/abcbac/ABCD123.php
https://siteurl.com/abcbac/ABCD124.php
)
fileappend,%s%,%f1%
}
e:=""
fileread,aa,%f1%
loop,parse,aa,`n,`r
{
x= %a_loopfield%
if x=
continue
splitPath,x, name, Path, ext, name_no_ext, drives
e .= name . "`r`n"
}
aa=
if e<>
{
ifexist,%f2%
filedelete,%f2%
fileappend,%e%,%f2%
run,%f2%
}
e=
exitapp
-
- Posts: 30
- Joined: 09 Mar 2019, 21:27
Re: Extract Text from URL
Thank you very much.garry wrote: ↑18 Aug 2019, 16:04a short example to get last part from url , read url from file and save to new fileCode: Select all
#warn setworkingdir,%a_scriptdir% f1=%a_desktop%\input.txt f2=%a_desktop%\output.txt ifnotexist,%f1% { s= ( https siteurl.com /abcbac/ABCD121.php Broken Link for safety https siteurl.com /abcbac/ABCD122.php Broken Link for safety https siteurl.com /abcbac/ABCD123.php Broken Link for safety https siteurl.com /abcbac/ABCD124.php Broken Link for safety ) fileappend,%s%,%f1% } e:="" fileread,aa,%f1% loop,parse,aa,`n,`r { x= %a_loopfield% if x= continue splitPath,x, name, Path, ext, name_no_ext, drives e .= name . "`r`n" } aa= if e<> { ifexist,%f2% filedelete,%f2% fileappend,%e%,%f2% run,%f2% } e= exitapp
Who is online
Users browsing this forum: -Garfle-, Descolada, Hema Elkady and 249 guests