Jump to content

if close, else continue to line xx?


Recommended Posts

soooooo, what im trying to do is copy text from a .txt file, and paste into another program. this first block of code is set up to find the text under "last name" and copy it. so the txt file is set up like this:

last name

smith

$scriptdir = "C:\Documents and Settings\dtpstaff\Desktop"
ShellExecute("DeleteAfterScriptFinishes.txt", "", $ScriptDir, "edit")
WinWaitActive ("[CLASS:Notepad]")
$NOexist = WinActivate ("[HANDLE:0x0027039C");<-----dialog box that says "cant find x"
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("smith")
send ("!F")
send ("!F")
if $NOexist then 
    send ("{enter}")
    send ("{esc}")
    else ???????

but sometimes the entry its searching for wont exist. so if there is no last name in the file, i want it to continue to a specified line. or at least another specified part of the script.

right now it closes the dialog box in notepad that says "cannot find X" because i dont know where to go from here.

it is going to repeat this task over and over for last name, first name, title, address, phone #, fax #, department, email and URL.

so heres my question:

1. can i name each of these blocks(name, title, etc.) as a function or something so i can define where i want the script to keep going?

2. can i tell the script to pickup at a certain line #?

this is the entire thing

;start file "save as text.au3" <------creates a text file from an email in outlook
WinWaitActive ("[CLASS:rctrl_renwnd32]")
send ("!F")
send ("!A")
send ("!T")
send ("te")
send ("{enter}")
send ("!n")
send ("DeleteAfterScriptFinishes.txt")
send ("{enter}")
sleep (300)
send ("!i")
sleep (4000)
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("!s")
WinClose ("[CLASS:rctrl_renwnd32]")
WinClose ("[CLASS:rctrl_renwnd32]")
sleep (3000)

;end file "save as text.au3"

;-------------------first name find text--------------------
$scriptdir = "C:\Documents and Settings\dtpstaff\Desktop"
ShellExecute("DeleteAfterScriptFinishes.txt", "", $ScriptDir, "edit")
WinWaitActive ("[CLASS:Notepad]")

send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("first name")
send ("!F")
send ("!F")
;<-----------------------------------this is where i want to add the new code in each section, i havent put it in yet.
send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")

;-------------------first name paste InDesign--------------------
winwaitactive ("[CLASS:indesign]")
send ("^f")
sleep (300)
send ("!f")
sleep (300)
send ("first")
sleep (300)
send ("!c")
sleep (300)
send ("^v")
sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")
;-------------------last name find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
sleep (300)
send ("!N")
sleep (300)
send ("last name")
send ("!F")

sleep (300)
send ("{esc}")
sleep (300)
send ("{right}")
sleep (300)
send ("{SHIFTDOWN}")
sleep (300)
send ("{down}")
sleep (300)
send ("{shiftup}")
sleep (300)
send ("^C")
sleep (300)
send ("!{tab}")
;---------------------last name paste indesign-------------------
winwaitactive ("[CLASS:indesign]")
send ("^f")
;sleep (300)
send ("!f")
;sleep (300)
send ("last")
;sleep (300)
send ("!c")
;sleep (300)
send ("^v")
;sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")


;-------------------title find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
sleep (300)
send ("!N")
sleep (300)

send ("title")

send ("!F")
sleep (300)
send ("{esc}")
sleep (300)
send ("{right}")
sleep (300)
send ("{SHIFTDOWN}")
sleep (300)
send ("{down}")
sleep (300)
send ("{shiftup}")
sleep (300)
send ("^C")
sleep (300)
send ("!{tab}")
;---------------------title name paste indesign-------------------
winwaitactive ("[CLASS:indesign]")
send ("^f")
sleep (600)
send ("!f")
sleep (600)

send ("title")

sleep (300)
send ("!c")
sleep (300)
send ("^v")
sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")

;-------------------department find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
sleep (300)
send ("!N")
sleep (300)
send ("department")
send ("!F")

sleep (300)
send ("{esc}")
sleep (300)
send ("{right}")
sleep (300)
send ("{SHIFTDOWN}")
sleep (300)
send ("{down}")
sleep (300)
send ("{shiftup}")
sleep (300)
send ("^C")
sleep (300)
send ("!{tab}")
;---------------------department name paste indesign-------------------
winwaitactive ("[CLASS:indesign]")
send ("^f")
;sleep (300)
send ("!f")
;sleep (300)
send ("department")
;sleep (300)
send ("!c")
;sleep (300)
send ("^v")
;sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")

DeleteAfterScriptFinishes.txt

Edited by RogerRabbitsClone
<--a good way to start you day
Link to comment
Share on other sites

  • Moderators

RogerRabbitsClone,

Why manipulate NotePad? :mellow: Why not read the file into an array within AutoIt - it would be much easier to search and you control the flow within AutoIt if nothing is found. :party:

Have you an example of the type of file you want to search - I presume it is DeleteAfterScriptFinishes.txt. We can then devise a script to search for the various items you wish to find. Please provide with an example where they are all included - we can build in the exceptions as we go along! :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Is there a reason to launch Notepad, load your text file into it, and then Send() control characters to notepad to process your text file?

Why not do a _FileReadToArray() to load your text file and then process the array programatically directly inside your script?

Edit: You're fast, Melba!

Edited by Spiff59
Link to comment
Share on other sites

im using the send command beacause

1. i know it, i can troubleshoot it and this is for my job so i have to be able to make this work

2. im not sure if _filereadtoarray() would work because theres 2 name, title etc. in every file

the text file was exported to txt file because it was originally a table in outlook and i couldnt figure out how to read it.

(old post below)

http://www.autoitscript.com/forum/index.php?showtopic=115843&st=0&p=808925&#entry808925

Edited by RogerRabbitsClone
<--a good way to start you day
Link to comment
Share on other sites

im using the send command beacause

1. i know it, i can troubleshoot it and this is for my job so i have to be able to make this work

2. im not sure if _filereadtoarray() would work because theres 2 name, title etc. in every file

the text file was exported to txt file because it was originally a table in outlook and i couldnt figure out how to read it.

(old post below)

http://www.autoitscript.com/forum/index.php?showtopic=115843&st=0&p=808925&#entry808925

You're likely less-comforatable manipulating your data internally, but believe me you have a lot more flexibiliy doing it that way.

Is there some sort of delimiter between each group of contact information? Or, lines that are not optional? Once you nail down the logic of how to separate your groups of data, the mechanics are cake.

Link to comment
Share on other sites

thats whats been a problem, is exactly how to extract the info. the original email i get with the information comes in a table (see link) and i couldnt figure out how to get the info out from there. so i made it into a text file, which puts everything on its own line.

download text file

is there a page defining _filereadtoarray()? i cant find it here: http://www.autoitscript.com/autoit3/docs/

Order Business Cards Result #5686389.htm

<--a good way to start you day
Link to comment
Share on other sites

The fastest way to get information from an HTML table is probably by evaluating the source and looking at your source this wouldn't be hard to do, but it can be a bit tricky when minor changes to the source are made.

The easiest way to get information from an HTML table is probably by using the IE functions as I've demonstrated below. It's also very update-proof.

As long as the information is in the first table on the page and this table has the type in collumn0 and data in collumn 1 it will work.

Here is an example on how to read your html table into an array aswell as a way to extract data from it. I'm not sure exactly what you want to do with the data, but hopefully this will be of some use.

#include <ie.au3>
$file = @ScriptDir & "\1.htm" ;make your script store the file localy, or point it to the open instance.

$oIE = _IECreate($file,0,0) ;open the file
$oTable = _IETableGetCollection ($oIE, 0) ;get the object for the table
$aTable = _IETableWriteToArray($oTable,True) ;read the array into an array
_IEQuit($oIE) ;close IE
FileDelete($file) ;remove the temp file. we got all the data we need in $aTable.

ConsoleWrite( _Getinfo($aTable, "Last name" ) & @CRLF) ;get the first occurence of "Last name"
ConsoleWrite( _Getinfo($aTable, "Last name", 2) & @CRLF) ;get the second occurence of "Last name"
ConsoleWrite( _Getinfo($aTable, "Last name", 3) & @CRLF) ;get the third occurence of "Last name" (does not exist)
ConsoleWrite( _Getinfo($aTable, "City") & @CRLF) ;gets the first city
;etc.

;===============================================================================
; Func              _Getinfo
; Params:           $a_data     - The array with the data
;                   $s_type     - The field of data to read
;                   $n_instance - Optional: The instance of the returned value. (1 based)
; Return Values:    Success:    A string containing the requested data
;                   Failure:    Returns 0 and sets @error.
Func _GetInfo($a_data,$s_type,$n_instance = 1)
    For $i = 0 To UBound($a_data)-1
        If $a_data[$i][0] = $s_type Then
            If $n_instance = 1 Then
                Return $a_data[$i][1]
            Else
                $n_instance -= 1
            EndIf
        EndIf
    Next
    Return SetError(1,0,0)
EndFunc
Link to comment
Share on other sites

i just want to say thank you all for helping. and tvyern, im going to try and rewrite it and apply your method because what i have is kinda buggy and slow.

BUT I FINISHED IT!!!!!!!!!!!!!

im so proud of myself i had to post my code. yes look upon it and laugh, for it is novice. but it works.

this will save a 2 collumn table from outlook into a .txt file, find specific text, (specifics in previous post) find where to paste said text in indesign and paste. BOO-YEA

$scriptdir = "C:\Documents and Settings\dtpstaff\Desktop"
$NOexist = WinActivate ("[CLASS:#32770]", "Find")
$doesexist =  Winactive ("[CLASS:#32770]", "Notepad")
;start file "save as text.au3"
WinWaitActive ("[CLASS:rctrl_renwnd32]")
send ("!F")
send ("!A")
send ("!T")
send ("te")
send ("{enter}")
send ("!n")
send ("DeleteAfterScriptFinishes.txt")
send ("{enter}")
sleep (300)
send ("!i")
sleep (4000)
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("{up}")
send ("!s")
WinClose ("[CLASS:rctrl_renwnd32]")
WinClose ("[CLASS:rctrl_renwnd32]")
sleep (3000)

;end file "save as text.au3"

;-------------------first name find text--------------------
ShellExecute("DeleteAfterScriptFinishes.txt", "", $ScriptDir, "edit")
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("first name")
send ("!F")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")
;-------------------first name paste indesign--------------------

winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
sleep (300)
send ("first")
sleep (300)
send ("!c")
sleep (300)
send ("^v")
sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")
    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif

;-------------------last name find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("last name")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")
;---------------------last name paste indesign-------------------
winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
sleep (300)
send ("last")
sleep (300)
send ("!c")
sleep (300)
send ("^v")
sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")
    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif
;-------------------title find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("title")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")
;---------------------title name paste indesign-------------------
winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
sleep (300)
send ("title")
sleep (300)
send ("!c")
sleep (300)
send ("^v")
sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")

    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif

;-------------------department find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("department")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")
;---------------------department name paste indesign-------------------
winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
sleep (300)
send ("department")
sleep (300)
send ("!c")
sleep (300)
send ("^v")
sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")
    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif

;-------------------Street Address find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("Street Address")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")
;------street address name paste indesign------
winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
sleep (300)
send ("street_address")
sleep (300)
send ("!c")
sleep (300)
send ("^v")
sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")
    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif

;-------------------Address Line 2 find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("Address Line 2")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
sleep (300)
send ("{right}")
sleep (300)
send ("{SHIFTDOWN}")
sleep (300)
send ("{down}")
sleep (300)
send ("{shiftup}")
sleep (300)
send ("^C")
send ("!{tab}")
;------Address Line 2 name paste indesign------
winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
sleep (300)
send ("street_address2")
sleep (300)
send ("!c")
sleep (300)
send ("^v")
sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
sleep (100)
send ("!{tab}")
    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif

;-------------------City find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("City")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")
;------city name paste indesign------
winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
;sleep (300)
send ("City")
;sleep (300)
send ("!c")
;sleep (300)
send ("^v")
;sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")
    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif

;-------------------state find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("state")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")
;------state paste indesign------
winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
sleep (300)
send ("state")
sleep (300)
send ("!c")
;sleep (300)
send ("^v")
;sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")
    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif


;-------------------Zip Code find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("Zip Code")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")
;------Zip Code paste indesign------
winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
;sleep (300)
send ("zip_code")
;sleep (300)
send ("!c")
;sleep (300)
send ("^v")
;sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")
    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif

;-------------------Phone Number find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("Phone Number")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")
;------Phone Number paste indesign------
winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
;sleep (300)
send ("phone_number")
;sleep (300)
send ("!c")
;sleep (300)
send ("^v")
;sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")
    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif


;-------------------Fax Number find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("Fax Number")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")
;------Fax Number paste indesign------
winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
;sleep (300)
send ("fax_number")
;sleep (300)
send ("!c")
;sleep (300)
send ("^v")
;sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")
    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif

;-------------------Email Address find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("Email Address")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")
;------Email Address paste indesign------
winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
;sleep (300)
send ("Email_Address")
;sleep (300)
send ("!c")
;sleep (300)
send ("^v")
;sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")
    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif


;-------------------URL find text--------------------
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
;sleep (300)
send ("!N")
;sleep (300)
send ("url")
send ("!F")
if Winactive ("Find") then 
    send ("{esc}")
;sleep (300)
send ("{right}")
;sleep (300)
send ("{SHIFTDOWN}")
;sleep (300)
send ("{down}")
;sleep (300)
send ("{shiftup}")
;sleep (300)
send ("^C")
send ("!{tab}")
;------url paste indesign------
winwaitactive ("[CLASS:indesign]")
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
send ("!f")
;sleep (300)
send ("www.URL.com")
;sleep (300)
send ("!c")
;sleep (300)
send ("^v")
;sleep (300)
send ("{right}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("{bs}")
sleep (300)
send ("!N")
sleep (300)
send ("!h")
send ("!d")
send ("!{tab}")
    Elseif  WinActivate ("Notepad") then 
    send ("{enter}")
    send ("{esc}")
    send ("{esc}")
endif

Filerecycle ("C:\Documents and Settings\dtpstaff\Desktop\DeleteAfterScriptFinishes.txt")
<--a good way to start you day
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...