Jump to content

Recommended Posts

Posted

Id like my script to automatically copy (CTRL-C) the rest of the text on the row after a keyword on a site, does anyone know how to make that happen?

//Bill

Posted (edited)

Please define what you are grabbing the text from a little better, as that will likely give better answers to your specific useage... in the mean time I'll throw a sample together on how to do it for a simple string.

[edit] crude example

$source = "This is a line of text to use as an example"
$search = "line"
$searchlen = StringLen($search)
$position = StringInStr($source, $search)
$leftover = StringRight($source, StringLen($source) - $position - $searchlen)
ClipPut($leftover)
MsgBox(4096, "", "The clipboard now contains:" & @CRLF & $leftover)
Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Posted

Look into the source to search for the information that you want.

The info is there to use

#include <INet.au3>
ConsoleWrite(_INetGetSource('http://www.snuskigabrudar.com/trade.php'))

:)

Hi,

use RegExp for grabbing the words.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Posted

Hi,

use RegExp for grabbing the words.

So long,

Mega

Can you give me an example? This is a bit more advanced than im used to :)

Posted (edited)

You haven't shown any attempt at it yet. Post the code that doesn't work and you'll get lots of help.

:)

Ok i have tried this one:

$oIE = _IECreate("http://www.snuskigabrudar.com/trade.php")
_IELoadWait($oIE)
$source = ConsoleWrite(_INetGetSource($oIE))
$search = "Send Traffic To: "
$searchlen = StringLen($search)
$position = StringInStr($source, $search)
$leftover = StringRight($source, StringLen($source) - $position - $searchlen)
ClipPut($leftover)
MsgBox(4096, "", "The clipboard now contains:" & @CRLF & $leftover)

But its the same here, cant get anyhing out of the sourcepage. :)

Edited by bills
Posted

Hi,

you need to put the url into the func not the ieObject!

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Posted

Got it :) Thanks. How do I make it do this for the active window?

How do I make it stop at the first "<br>"?

This is what i got now:

$source = _INetGetSource("http://www.snuskigabrudar.com/trade.php")
$search = "Send Traffic To:"
$hitta = StringRegExp($source, $search)
$searchlen = StringLen($search)
$position = StringInStr($source, $search)
$leftover = StringRight($source, StringLen($source) - $position - $searchlen)
ClipPut($leftover)
MsgBox(4096, "", "The clipboard now contains:" & @CRLF & $leftover)

Thanks for all the help :)

Posted

Got it :) Thanks. How do I make it do this for the active window?

How do I make it stop at the first "<br>"?

This is what i got now:

$source = _INetGetSource("http://www.snuskigabrudar.com/trade.php")
$search = "Send Traffic To:"
$hitta = StringRegExp($source, $search)
$searchlen = StringLen($search)
$position = StringInStr($source, $search)
$leftover = StringRight($source, StringLen($source) - $position - $searchlen)
ClipPut($leftover)
MsgBox(4096, "", "The clipboard now contains:" & @CRLF & $leftover)
oÝ÷ Ù8ZK¢¶¥Ø^éiþ«¨µâ©àyØ­¶aÆ®¶­s`¢b33c¶ôRÒôT7&VFRgV÷C¶GG¢ò÷wwrç6çW6¶v''VF"æ6öÒ÷G&FRçgV÷C²¥ôTÆöEvBb33c¶ôR ¢b33c·6÷W&6RÒôTFö5&VDDÔÂb33c¶ôR¢b33c·6V&6ÒgV÷Cµ6VæBG&ff2Fó¢gV÷C°¢b33c·6V&6ÆVâÒ7G&ætÆVâb33c·6V&6¢b33c·÷6FöâÒ7G&ætå7G"b33c·6÷W&6RÂb33c·6V&6¢b33c¶ÆVgF÷fW"Ò7G&æu&vBb33c·6÷W&6RÂ7G&ætÆVâb33c·6÷W&6RÒb33c·÷6FöâÒb33c·6V&6ÆVâ¤6ÆWBb33c¶ÆVgF÷fW"¤×6t&÷CbÂgV÷C²gV÷C²ÂgV÷CµFR6Æ&ö&Bæ÷r6öçFç3¢gV÷C²fײ5$Äbfײb33c¶ÆVgF÷fW"

This works to get the source from the active page instead of an url, but how do i make it read from the searchword "Send Traffic To:" to the first "<br>" after the searchword?

Posted

I changed it to this:

$oIE = _IECreate("http://www.snuskigabrudar.com/trade.php")
_IELoadWait($oIE)

$source = _IEDocReadHTML ($oIE)
$search = "Send Traffic To:"
$searchlen = StringLen($search)
$position = StringInStr($source, $search)
$leftover = StringRight($source, StringLen($source) - $position - $searchlen)
ClipPut($leftover)
MsgBox(4096, "", "The clipboard now contains:" & @CRLF & $leftover)
oÝ÷ Ù8b³
+Ëhëmë(º·~º&¶rدz z)ìµæ¡ö§º¹[ºØhÁÚ"©ÚÞi×ë¢kazÇ­Èp¢·jºRzwS­§ßÄèªê-¶ayø«²Ú®¢Ùmn¸-ªê-iû^®Ø^±æ«r(­ßêº^(.­çb¶­jëh×6
$oIE = _IECreate("http://www.snuskigabrudar.com/trade.php")
_IELoadWait($oIE)
$source = _IEDocReadHTML ($oIE)
$beginning1 = "Send Traffic To: "
$searchlen1 = StringLen($beginning1)
$position1 = StringInStr($source, $beginning1)
$result1 = StringRight($source, StringLen($source) - $position1 - $searchlen1 + 1)

$end1 = "<br>"
$position2 = StringInStr($result1, $end1)
$result2 = StringLeft($result1, $position2 - 1)
ClipPut($result2)
MsgBox(4096, "", "The clipboard now contains:" & @CRLF & $result2)

Thanks for all of your help guys! //Bill

Posted

Hi,

could be done much easier. Have a look at _StringBetween.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...