Created
June 29, 2017 19:28
-
-
Save krisrice/1dedd080b09f24d80cdd7fc5925fdd3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// grab the results of the page | |
var PAGE = prev == null ? null : prev.getResponseDataAsString(); | |
// debug | |
OUT.println('PRE PROCESSING...'); | |
function put(id){ | |
vars.put(id, getValue(PAGE,id,'')); | |
} | |
// simple function to grab the value from the page or return the default x | |
function getValue(page,id,v){ | |
if ( page == null ){ | |
return v; | |
} | |
var find = 'name="'+id+'" value="'; | |
var start = page.indexOf(find); | |
var ret=null; | |
var mypage = page; | |
while ( start != -1 ) { | |
start = start + find.length; | |
var end = mypage.indexOf('"',start); | |
if ( ret == null ) { | |
ret = mypage.substring(start ,end); | |
} else { | |
ret = ret + "," + mypage.substring(start ,end); | |
} | |
mypage = mypage.substring(end+1); | |
start = mypage.indexOf(find); | |
} | |
OUT.println(id + "=" + ret); | |
return ret == null ? v : ret ; | |
} | |
put('p_instance'); | |
put('p_flow_id'); | |
put('p_flow_step_id'); | |
put('p_page_submission_id'); | |
put('p_md5_checksum'); | |
put('p_arg_names'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment