Jump to content
Sign in to follow this  
Guest bloodbird

Could u help me translate this into v3Script?

Recommended Posts

Guest bloodbird

i have never used any script , can u help me to learn how to use the auto?

the only language i have used is pascl, so i describe it in pascl

-------------------------
Main Program
begin
   run  progamA ( the progamA is in the same dir with the auto.exe)
   run notepad
   set notepad is the active window
   wait 1 min
   while (notpad is the active window) do
   begin
      wait 1 min
      if SearhTextFromAlist(AString)=True then
      begin
         send some keystroke to notepad 
         wait 1 min
         send others keystoke to notepad
         wait 1 min
      end  
   end

----------------------------------------------------------------
function SearchTextFromAlist(AString:TString):Boolean;
begin
  if (find AString from B.txt) then 
    result:=true 
  else result:=false;
end;
----------------------------------------------------------------

the content of b.txt is like this

-----------

Peter

Mike

Rockefeller

...

-----------

thank you in advance!

Edited by bloodbird

Share this post


Link to post
Share on other sites
DirtyBanditos

i have never used any script , can u help me to learn how to use the auto?

the only language i have used is pascl, so i describe it in pascl

-------------------------
Main Program
begin
   run  progamA ( the progamA is in the same dir with the auto.exe)
   run notepad
   set notepad is the active window
   wait 1 min
   while (notpad is the active window) do
   begin
      wait 1 min
      if SearhTextFromAlist(AString)=True then
      begin
         send some keystroke to notepad 
         wait 1 min
         send others keystoke to notepad
         wait 1 min
      end  
   end

----------------------------------------------------------------
function SearchTextFromAlist(AString:TString):Boolean;
begin
  if (find AString from B.txt) then 
    result:=true 
  else result:=false;
end;
----------------------------------------------------------------

the content of b.txt is like this

-----------

Peter

Mike

Rockefeller

...

-----------

thank you in advance!

<{POST_SNAPBACK}>

Hi Mike :D I post this exampel use the Sitce Scriptwriter to teach your first autoit3 Script self :idiot: Look on my sig for the Scite Dwonload Site and use the Scriptwriter and look on the helps files from autoit3 help.files and Scite Helps for any simpel code exampel or you the search button his forums :lol:

Happy coding and Wilkommen on the Autoit3 forum.

Edit this code exapel for your prog! :D

I hope this help you ;)

Look and put you wat you need i have ade 5 exampel to run any prog look for more on the help files pls .

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
;;;; Body of program would go here;;;;

WinWaitActive("Sacred")
Opt ("WinWaitDelay", 1400)
Opt ("WinTitleMatchMode", 4)
Opt ("WinDetectHiddenText", 1)
Opt ("MouseCoordMode", 0)
WinWait("Sacred", "")
If Not WinActive("Sacred", "") Then WinActivate("Sacred", "")
WinWaitActive("Sacred", "")

; Exampel 1

Runwait(@Scriptdir &"\Sacred.exe", "", @SW_MAXIMIZE)

; Exampel 2

Run(@Scriptdir &"\Sacred.exe", "", @SW_MAXIMIZE)

; Exampel 3

Run("C:\Programme\ThcCleaner\ThcCleaner.exe", "", @SW_MAXIMIZE)


; Exampel 4

$rc = _RunDOS("start http://www.DirtyBanditos.de.vu/")

; Exampel 5

Func mRun1()
   AutoItSetOption("WinTitleMatchMode", 2)
   Runwait(@Scriptdir &"\Test.exe", "", @SW_MAXIMIZE)
         WinWait("Test.exe")
         $ln = StatusbarGetText("Test.exe", "")
         MsgBox(0, "Title", $ln & @CR & @error)
         WinWait("Test.exe")
EndFunc  ;==>mRun1
Edited by DirtyBanditos

Share this post


Link to post
Share on other sites
SlimShady

You should explain what the function does, because I don't understand.

Here's what I've got so far:

Opt("WinTitleMatchMode", 2)

Run(@ScriptDir & "\progamA.exe");( the progamA is in the same dir with the auto.exe)

;Run Notepad
Run("notepad", @SystemDir)

;Wait for Notepad to show up
WinWait("Notepad")

;set notepad is the active window
WinActivate("Notepad")

;wait 1 min
Sleep(60 * 1000)

While WinActive("Notepad")
  ;wait 1 min
   Sleep(60 * 1000)
   
  ;If SearhTextFromAlist(AString) then;<---- I don't know what to do with this one
      Send("some keystroke to notepad")
     ;wait 1 min
      Sleep(60 * 1000)
      Send("others keystoke to notepad")
     ;wait 1 min
      Sleep(60 * 1000)
  ;EndIf
WEnd

;I don't know what to do with this function
;----------------------------------------------------------------
function SearchTextFromAlist(AString:TString):Boolean;
begin
  if (find AString from B.txt) then
    result:=true
  else result:=false;
end;

Share this post


Link to post
Share on other sites
Doxie

Maybe when he said Notepad he meant a txt file?

So instead of opening notepad it will open B.txt in Notepad.

And Search for a string in the file, and then make some keystroke.

What do i know :idiot:


Were ever i lay my script is my home...

Share this post


Link to post
Share on other sites
Guest bloodbird

thanks all the guys.

a example of using SearhTextFromAlist

suppose the content of b.txt is this

-----------

Peter

Mike

Rockefeller

-----------

var

Flag:Boolean;

begin

Flag:=SearchTextFromAlist(Mike);//the value of Flag is True;

end;

var

Flag:Boolean;

begin

Flag:=SearchTextFromoAlist(White);//the Value of Flag is False;

end;

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.