Jump to content

send percentage


Recommended Posts

Morning all - total newbie here with what is hopefully a daft question and easy to point me in the right direction

I'm running my script as an exe and need to pass parameters. All is ok except when parameter 4 is used (the value of which is "WIP Val%") I was using

send($CmdLine[4])

but getting strange results (WIP Val followed by more garbage text) I though that the script was interpreting the % as a special character so changed the code to use raw:

send($CmdLine[4],1)

but get the same garbage!

Any ideas?

Edited by gfcaim
[font="Comic Sans MS"]"I'm not usually a praying man, but if you are up there, please save me Superman!" (Homer J. Simpson)[/font]
Link to comment
Share on other sites

Are these values stored in an array? Because that's what $CmdLine[4] looks like. Maybe if you could show the part of the code where you define $CmdLine.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

The values are in an array, but the array is specified by AutioIt as command line parameters. So the 4th parameter on my command line is "WIP Val%" which is what is passed at the part of the code that uses it, i.e. send($CmdLine[4],1)

[font="Comic Sans MS"]"I'm not usually a praying man, but if you are up there, please save me Superman!" (Homer J. Simpson)[/font]
Link to comment
Share on other sites

I need to see how you are building your array and how you are calling the variables in your script because

$a="WIP Val%"

Run("Notepad.exe")
WinWait("Untitled - Notepad")
Send($a)

works fine

and so does

Dim $a[3]
$a[0]="WIP Val%"
$a[1]="something else"
$a[2]="another"
Run("Notepad.exe")
WinWait("Untitled - Notepad")
Send($a[0]&@CRLF)
Send($a[1]&@CRLF)
Send($a[2])

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

I understand, sorry.

I have a .bat file that runs the following

"C:\Documents and Settings\whited4\My Documents\Docs\AutoIT\Paul_Report.exe" SMITHP qpalzm "BCS_RUNCORN_OM_INQRY" "WIP Value Report" "C:\Documents and Settings\whited4\My Documents\Docs\AutoIT\Paul_Report.txt"

where:

: CmdLine[1] = Login Username

: CmdLine[2] = Login Password

: CmdLine[3] = Responsibility

: CmdLine[4] = Job Name

: CmdLine[5] = Save Path

this runs the following:

#include <IE.au3>
#Include <Clipboard.au3>
AutoItSetOption ("TrayIconDebug", 1);
Opt("WinTitleMatchMode", 2)
;-------------------------------------------------------------------------
;$CmdLine[1] = Login Username
;$CmdLine[2] = Login Password
;$CmdLine[3] = Responsibility
;$CmdLine[4] = Job Name
;$CmdLine[5] = Save Path

;Open IE
$oIE = _IECreate("http://ebsp760.eur.alcoa.com:8000/OA_HTML/AppsLocalLogin.jsp")
winwaitactive("Login")
winsetstate("Login","",@SW_MAXIMIZE)

;Log In
send($CmdLine[1])
send("{TAB}")
send($CmdLine[2])
send("{TAB}{ENTER}")
winwaitactive("OracleMyPage.home")
sleep(3000)

;Find and click on responsibility
$ypos=180
$found=0
MouseMove(70,$ypos)
Do
    $ypos=$ypos+10
    mousemove(70,$ypos)
    if StatusbarGetText("OracleMyPage.home") = $CmdLine[3] then $found=1
Until $ypos=700 or $found=1

;Act on result
if $found=0 Then
    msgbox(0,"Oracle","Responsibility not found...")
    Exit
EndIf
MouseClick("main")
sleep(20000)
send("{ENTER}") ;May be notifications window
sleep(10000)

;View requests
send("!vr")
sleep(20000)

;Enter criteria
send("!s{TAB}{TAB}")
send($CmdLine[4],1)
send("{TAB}{TAB}{TAB}{TAB}{TAB}")
send($CmdLine[1])
send("{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}")
;Wait for requests to be populated
sleep(20000)

;Find first completed request
opt("SendKeyDelay",500)
send("{TAB}{TAB}^c")
$found=0
do
    $cb=ClipGet()
    if $cb="Completed" then
        $found=1
    Else
        send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}^c")
    endif
until $found=1 or $cb=""

;Act on result
if $found=0 Then
    msgbox(0,"Oracle","Completed request not found...")
    Exit
EndIf

;Save output
send("{TAB}{TAB}{TAB}{TAB}{ENTER}")
sleep(30000)
send("!fa")
opt("SendKeyDelay",50)
send($CmdLine[5])
send("{ENTER}y")
sleep(30000)
send("!fc")

;Exit Oracle
send("!fxo")
winactivate("Oracle Applications 11i")
send("!{F4}")
winactivate("OracleMyPage.home")
send("!fc")
[font="Comic Sans MS"]"I'm not usually a praying man, but if you are up there, please save me Superman!" (Homer J. Simpson)[/font]
Link to comment
Share on other sites

Isn't there a limit to command-line total length? (Just asking)

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

The problem is not with the command line or parameters, did an _ArrayDisplay($CmdLine) as soon as the program starts and got all the parameters back just fine. Even when changing parameter 4 to "WIN Val%"

Link to comment
Share on other sites

Hmmm... Must be app specific issue then? (it's Oracle Business Suite and has been wierd from the start!)

Thanks for the replies, all.

[font="Comic Sans MS"]"I'm not usually a praying man, but if you are up there, please save me Superman!" (Homer J. Simpson)[/font]
Link to comment
Share on other sites

Very possible that it is app specific. I have a similar issue with an app I work with. It's output uses % to indicate a variable in the output name (example: .%e tells the program to use the default file extension type) but only with some instances in this app does it give an error, most of the time it works.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

It's not reproducible as an AutoIt issue. I tried this to see if the command shell didn't like it:

$iPID = Run("notepad.exe")
WinWait("Untitled - Notepad")
$hWin = WinGetHandle("Untitled - Notepad")
WinActivate($hWin)
If $CmdLine[0] Then
    For $n = 1 To $CmdLine[0]
        Send("Command line parameter " & $n & ":  " & $CmdLine[$n] & @CRLF)
    Next
Else
    Send("No command line parameters passed" & @CRLF)
EndIf

Compiled that and ran it from a command line with a version of your parameters from post #5 (with "WIP Val%") and got this in notepad:

Command line parameter 1:  username

Command line parameter 2:  password

Command line parameter 3:  BCS_RUNCORN_OM_INQRY

Command line parameter 4:  WIP Val%

Command line parameter 5:  C:\Documents and Settings\whited4\My Documents\Docs\AutoIT\Paul_Report.txt

:(

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Most likely it's the app then. The app I automate is a variable data app that will take a database and you can add script and merge it all together with text to create a personalized post (letter).

The app supports various output types like pdf, ps, jpg etc.

I have 15 jobs automated which all pretty much run the same way but on 1 of them, it does not like % being sent to the app to produce a filename.

No apparent reason, just won't let me. (and it's not autoit)

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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...