Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

anyway to pass params to script while running ?


  • Please log in to reply
17 replies to this topic
geeneeyes
  • Members
  • 66 posts
  • Last active: Jan 26 2012 01:02 PM
  • Joined: 24 May 2006
thanks SKAN !!
it took me a while to comprehend it.. wonder how you do it! :)

have almost finished adapting the code for my script...

will let you know if I have any stubborn problems ;)
irc://irc.freenode.net/ahk
Opera: SpeedDial, Email, Extensions, Widgets, Unite, UserJS, Notes, Contacts, IRC, BitTorrent, Download Manager, Tab Stacking, Thumbnails, Sessions, VoiceControl, Mouse Gestures, Content/Flash Blocker, Opera Link, Turbo mode

dmg
  • Members
  • 2395 posts
  • Last active: Nov 04 2015 06:46 AM
  • Joined: 19 Nov 2010

I am aware that reviving old posts is generally frowned upon, but I thought I would point out an alternative solution in case someone (as I did) finds this post in a search for a similar problem.

This issue can also be resolved using a hidden gui in the running script and using the ControlSetText command to send data.

main script:

gui, add, edit, w50 h20 vedit1_var gedit1_sub ;lines 1 and 2 create a hidden gui with an edit control.
gui, show, hide, scriptcomwin_1
return

edit1_sub: ;whenever the text in the edit control is changed this subroutine is launched.
 {
   gui, submit
   gosub, label%edit1_var% ;this gosub launches a subroutine based on the number entered into the edit control.
 }
return

label1: ;subroutine launched if the number 1 is sent to the edit control.
 {
   msgbox, ABC
 }
return

label2: ;subroutine launched if the number 2 is sent to the edit control.
 {
   msgbox, XYZ
 }
return

command1:

detecthiddenwindows, on ;allows the script to detect hidden windows.
controlsettext, edit1, 1, scriptcomwin_1 ;sends a text string to the first edit control in a specified window.

command2:

detecthiddenwindows, on ;allows the script to detect hidden windows.
controlsettext, edit1, 2, scriptcomwin_1 ;sends a text string to the first edit control in a specified window.

If you have the main script running, launching one of the command scripts will cause the main script to run the corresponding subroutine. This method is reliable, simple and (IMHO) easier to work with than the other solutions posted above. smile.png


"My dear Mr Gyrth, I am never more serious than when I am joking."
~Albert Campion

-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact

  • Guests
  • Last active:
  • Joined: --
Various other methods <!-- m -->https://ahknet.autoh....html#variables<!-- m -->