I want to be able to pass a group of variables into a function and have it copy the output to the clipboard and then send it.
Output to the clipboard looks would look like this:
9916-01.50-N-003-DTF-1250
Variables in order for that part are:
SKU
SS.ss
H
QTY
SUB
MTTT
Code: Select all
; THIS WORKS BUT NOT AS A FUNCTION
ActualSKU := strReplace(masterVisibleSKU , "99999", strNewSKU)
ActualSKU := strReplace(ActualSKU, "SS.ss", BlankSize)
ActualSKU := strReplace(ActualSKU, "H", withorwithoutaHole)
ActualSKU := strReplace(ActualSKU, "SUB", newSubstrate )
ActualSKU := strReplace(ActualSKU, "MT", 1250)
ActualSKU := strReplace(ActualSKU, "QTY", Quantity)
tSKU := ActualSKU
; END THIS WORKS
Clipboard := tSKU
Send ^v
The system then sends a {Tab} and then sends another variable called PRICE
The only way I can get the price to send is to use the individual Send, instead of using the clipboard.
Code: Select all
Sleep 1000
Send, {Tab}
Send, .71{Tab}
Sleep 625
Code: Select all
Send, {Space} ; DISABLE DUE TO PRICE
Code: Select all
Send, {Tab}
Sleep 625
Send, {Tab}
Sleep 625
This is the "old" code using nothing but send, it actually runs for QTY of 1, 2, 3, 4, 5, 10, 25, 50 and 100.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance Force
; #1.5-Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^D::
InputBox, strNewSKU, Please Enter the Number to use as the New SKU: (When you press enter - please click back in the SKU box on Etsy within the next few seconds)
Sleep 6000
SetKeyDelay, 5
; ONE PIECE
; 1.5" WITH HOLE
; - BLANK ONLY
Send, %strNewSKU%-01.50-H-001-ACL-1250{Tab}
Sleep 625
Send, .71{Tab}
Sleep 625
Send, {Space} ; DISABLE DUE TO PRICE
Send, {Tab}
Sleep 625
Send, {Tab}
Sleep 625
; - TRANSFER ONLY
Send, %strNewSKU%-01.50-N-001-DTF-1250{Tab}
Sleep 625
Send, .89{Tab}
Sleep 625
Send, {Space} ; DISABLE DUE TO PRICE
Send, {Tab}
Sleep 625
Send, {Tab}
Sleep 625
; - COMBO BLANK AND TRANSFER
Send, %strNewSKU%-01.50-H-001-BUNACLDTF-1250{Tab}
Sleep 625
Send, 1.60{Tab}
Sleep 625
Send, {Space} ; DISABLE DUE TO PRICE
Send, {Tab}
Sleep 625
Send, {Tab}
Sleep 625
; TWO PIECES
; 1.5" WITH HOLE
; - BLANK ONLY
Send, %strNewSKU%-01.50-H-002-ACL-1250{Tab}
Sleep 625
Send, 1.41{Tab}
Sleep 625
Send, {Space} ; DISABLE DUE TO PRICE
Send, {Tab}
Sleep 625
Send, {Tab}
Sleep 625
; - TRANSFER ONLY
Send, %strNewSKU%-01.50-N-002-DTF-1250{Tab}
Sleep 625
Send, 1.76{Tab}
Sleep 625
Send, {Space} ; DISABLE DUE TO PRICE
Send, {Tab}
Sleep 625
Send, {Tab}
Sleep 625
; - COMBO BLANK AND TRANSFER
Send, %strNewSKU%-01.50-H-002-BUNACLDTF-1250{Tab}
Sleep 625
Send, 3.16{Tab}
Sleep 625
Send, {Tab} ; ENABLED
Sleep 625
Send, {Tab}
Sleep 625
; THREE PIECES
; 1.5" WITH HOLE
; - BLANK ONLY
Send, %strNewSKU%-01.50-H-003-ACL-1250{Tab}
Sleep 625
Send, 2.10{Tab}
Sleep 625
Send, {Space} ; DISABLE DUE TO PRICE
Send, {Tab}
Sleep 625
Send, {Tab}
Sleep 625
; - TRANSFER ONLY
Send, %strNewSKU%-01.50-N-003-DTF-1250{Tab}
Sleep 625
Send, 2.62{Tab}
Sleep 625
Send, {Space} ; DISABLE DUE TO PRICE
Send, {Tab}
Sleep 625
Send, {Tab}
Sleep 625
; - COMBO BLANK AND TRANSFER
Send, %strNewSKU%-01.50-H-003-BUNACLDTF-1250{Tab}
Sleep 625
Send, 4.72{Tab}
Sleep 625
Send, {Tab} ; ENABLED
Sleep 625
Send, {Tab}
Sleep 625
Not sure why, but although I can get the code to work using the first batch of code above, I can't get the code to work from a function - ideally I'd like to pass the variables
SKU - comes from a dialog box and doesn't change until the script has been run completely.
SS.SS - passed into the function
H - passed into the function with values of either H or N
QTY - passed into the function with values of of 001, 002, 003, 004, 005, 010, 025, 050 or 100
SUBSTRATE - passed into the function with values of ACL, DTF or BUNACLDTF
MTTT - passed into the function with a value of 1250
PRICE - passed into the function
VISIBLE - passed into the function - basic boolean value of true / false / 0 / 1 whatever I need to pass in. if enabled send key basically just tabs past the field, if disabled, it sends a space bar then tabs past the field.
Current script takes over 5 minutes to run using just send,.
Testing manually with line code using the Clipboard function send ^v is substantially faster - but the code is stupid without using a function.
Any help - greatly appreciated. Been using AutoHotkey for a while but just basics ... haven't tried to optimize it until now.
DIYCB
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]